Nightly build #1114
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nightly build | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 2 * * *' | |
env: | |
RELEASE_KEY_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD }} | |
RELEASE_KEY_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }} | |
RELEASE_STORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
RELEASE_STORE_FILE: ${{ secrets.RELEASE_STORE_FILE }} | |
DEVELOPMENT_MODE: ${{ secrets.DEVELOPMENT_MODE }} | |
GOOGLE_SERVICES_API_KEY: ${{ secrets.GOOGLE_SERVICES_API_KEY }} | |
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }} | |
SLACK_ICON: https://icons.iconarchive.com/icons/martz90/circle/256/android-icon.png | |
SLACK_TITLE: Nightly build status | |
SLACK_USERNAME: Emarsys SDK - Android | |
SLACK_WEBHOOK: ${{ secrets.SLACK_MOBILE_TEAM_CI_CHANNEL_WEBHOOK }} | |
jobs: | |
Build: | |
runs-on: ubuntu-latest | |
name: Build job | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: dev | |
submodules: true | |
fetch-depth: 0 # 0 indicates all history | |
- run: git fetch --all || echo "==> Accept any result" | |
- name: set up JDK 1.17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: create-google services json | |
uses: jsdaniell/[email protected] | |
with: | |
name: google-services.json | |
json: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
dir: sample | |
- name: create local.properties | |
run: echo $ANDROID_HOME > local.properties | |
- name: Create file 'FAILURE.TXT' and write 'false' into it | |
run: echo 'false' > FAILURE.TXT | |
- name: Upload file 'FAILURE.TXT' as an artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: failure_file | |
path: FAILURE.TXT | |
- name: Build with Gradle | |
run: ./gradlew assembleAndroidTest -x lint | |
- name: upload sample app artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: sample | |
path: sample/build/outputs/apk/androidTest/debug/sample-debug-androidTest.apk | |
- name: upload core test apk artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: core | |
path: core/build/outputs/apk/androidTest/debug/core-debug-androidTest.apk | |
- name: upload mobile-engage test apk artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: mobile-engage | |
path: mobile-engage/build/outputs/apk/androidTest/debug/mobile-engage-debug-androidTest.apk | |
- name: upload predict test apk artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: predict | |
path: predict/build/outputs/apk/androidTest/debug/predict-debug-androidTest.apk | |
- name: upload emarsys test apk artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: emarsys | |
path: emarsys/build/outputs/apk/androidTest/debug/emarsys-debug-androidTest.apk | |
- name: upload emarsys-sdk test apk artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: emarsys-sdk | |
path: emarsys-sdk/build/outputs/apk/androidTest/debug/emarsys-sdk-debug-androidTest.apk | |
- name: upload common test apk artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: common | |
path: common/build/outputs/apk/androidTest/debug/common-debug-androidTest.apk | |
- name: upload emarsys-firebase test apk artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: emarsys-firebase | |
path: emarsys-firebase/build/outputs/apk/androidTest/debug/emarsys-firebase-debug-androidTest.apk | |
- name: upload emarsys-huawei test apk artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: emarsys-huawei | |
path: emarsys-huawei/build/outputs/apk/androidTest/debug/emarsys-huawei-debug-androidTest.apk | |
- name: create testlab services json | |
uses: jsdaniell/[email protected] | |
with: | |
name: sacc_key.json | |
json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} | |
- name: Create file 'FAILURE.TXT' and write 'true' into it | |
if: ${{ failure() }} | |
run: echo 'true' > FAILURE.TXT | |
- name: Upload file 'FAILURE.TXT' as an artifact | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v1 | |
with: | |
name: failure_file | |
path: FAILURE.TXT | |
GradleLint: | |
name: Run lint on project | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: dev | |
submodules: true | |
fetch-depth: 0 # 0 indicates all history | |
- run: git fetch --all || echo "==> Accept any result" | |
- name: set up JDK 1.17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: create-google services json | |
uses: jsdaniell/[email protected] | |
with: | |
name: google-services.json | |
json: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
dir: sample | |
- name: create local.properties | |
run: echo $ANDROID_HOME > local.properties | |
- name: Lint project with Gradle | |
run: ./gradlew lint | |
- name: Create file 'FAILURE.TXT' and write 'true' into it | |
if: ${{ failure() }} | |
run: echo 'true' > FAILURE.TXT | |
- name: Upload file 'FAILURE.TXT' as an artifact | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v1 | |
with: | |
name: failure_file | |
path: FAILURE.TXT | |
CreateReleaseBundle: | |
name: Create release bundle | |
needs: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: dev | |
submodules: true | |
fetch-depth: 0 # 0 indicates all history | |
- run: git fetch --all || echo "==> Accept any result" | |
- name: set up JDK 1.17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: create-google services json | |
uses: jsdaniell/[email protected] | |
with: | |
name: google-services.json | |
json: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
dir: sample | |
- name: create local.properties | |
run: echo $ANDROID_HOME > local.properties | |
- name: Create release keystore file | |
shell: bash | |
run: | | |
echo "${{ secrets.ANDROID_KEYSTORE }}" > mobile-team-android.jks.asc | |
gpg -d --passphrase "${{ secrets.ANDROID_GPG_PASSWORD }}" --batch mobile-team-android.jks.asc > sample/mobile-team-android.jks | |
- name: Create release sample app with Gradle | |
run: ./gradlew :sample:bundleRelease | |
- name: Upload bundle | |
uses: actions/upload-artifact@v2 | |
with: | |
name: mobile-sdk-sample | |
path: sample/build/outputs/bundle/release/sample-release.aab | |
- name: Create file 'FAILURE.TXT' and write 'true' into it | |
if: ${{ failure() }} | |
run: echo 'true' > FAILURE.TXT | |
- name: Upload file 'FAILURE.TXT' as an artifact | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v1 | |
with: | |
name: failure_file | |
path: FAILURE.TXT | |
TestCore: | |
name: Run core tests on Firebase | |
needs: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: dev | |
submodules: true | |
fetch-depth: 0 # 0 indicates all history | |
- run: git fetch --all || echo "==> Accept any result" | |
- name: Download sample app | |
uses: actions/download-artifact@v2 | |
with: | |
name: sample | |
- name: Download core tests | |
uses: actions/download-artifact@v2 | |
with: | |
name: core | |
- name: Run tests | |
uses: asadmansr/[email protected] | |
with: | |
arg-spec: 'testWithAllDevices.yml:core' | |
env: | |
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} | |
- name: Create file 'FAILURE.TXT' and write 'true' into it | |
if: ${{ failure() }} | |
run: echo 'true' > FAILURE.TXT | |
- name: Upload file 'FAILURE.TXT' as an artifact | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v1 | |
with: | |
name: failure_file | |
path: FAILURE.TXT | |
TestMobileEngage: | |
name: Run mobile-engage tests on Firebase | |
needs: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: dev | |
submodules: true | |
fetch-depth: 0 # 0 indicates all history | |
- run: git fetch --all || echo "==> Accept any result" | |
- name: Download sample app | |
uses: actions/download-artifact@v2 | |
with: | |
name: sample | |
- name: Download mobile-engage tests | |
uses: actions/download-artifact@v2 | |
with: | |
name: mobile-engage | |
- name: Run tests | |
uses: asadmansr/[email protected] | |
with: | |
arg-spec: 'testWithAllDevices.yml:mobile-engage' | |
env: | |
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} | |
- name: Create file 'FAILURE.TXT' and write 'true' into it | |
if: ${{ failure() }} | |
run: echo 'true' > FAILURE.TXT | |
- name: Upload file 'FAILURE.TXT' as an artifact | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v1 | |
with: | |
name: failure_file | |
path: FAILURE.TXT | |
TestPredict: | |
name: Run predict tests on Firebase | |
needs: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: dev | |
submodules: true | |
fetch-depth: 0 # 0 indicates all history | |
- run: git fetch --all || echo "==> Accept any result" | |
- name: Download sample app | |
uses: actions/download-artifact@v2 | |
with: | |
name: sample | |
- name: Download predict tests | |
uses: actions/download-artifact@v2 | |
with: | |
name: predict | |
- name: Run tests | |
uses: asadmansr/[email protected] | |
with: | |
arg-spec: 'testWithAllDevices.yml:predict' | |
env: | |
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} | |
- name: Create file 'FAILURE.TXT' and write 'true' into it | |
if: ${{ failure() }} | |
run: echo 'true' > FAILURE.TXT | |
- name: Upload file 'FAILURE.TXT' as an artifact | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v1 | |
with: | |
name: failure_file | |
path: FAILURE.TXT | |
TestEmarsysSDK: | |
name: Run emarsys-sdk tests on Firebase | |
needs: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: dev | |
submodules: true | |
fetch-depth: 0 # 0 indicates all history | |
- run: git fetch --all || echo "==> Accept any result" | |
- name: Download sample app | |
uses: actions/download-artifact@v2 | |
with: | |
name: sample | |
- name: Download emarsys-sdk tests | |
uses: actions/download-artifact@v2 | |
with: | |
name: emarsys-sdk | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Run tests | |
uses: asadmansr/[email protected] | |
with: | |
arg-spec: 'testWithAllDevices.yml:emarsys-sdk' | |
env: | |
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} | |
- name: Create file 'FAILURE.TXT' and write 'true' into it | |
if: ${{ failure() }} | |
run: echo 'true' > FAILURE.TXT | |
- name: Upload file 'FAILURE.TXT' as an artifact | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v1 | |
with: | |
name: failure_file | |
path: FAILURE.TXT | |
TestEmarsys: | |
name: Run emarsys tests on Firebase | |
needs: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: dev | |
submodules: true | |
fetch-depth: 0 # 0 indicates all history | |
- run: git fetch --all || echo "==> Accept any result" | |
- name: Download sample app | |
uses: actions/download-artifact@v2 | |
with: | |
name: sample | |
- name: Download emarsys tests | |
uses: actions/download-artifact@v2 | |
with: | |
name: emarsys | |
- name: Run tests | |
uses: asadmansr/[email protected] | |
with: | |
arg-spec: 'testWithAllDevices.yml:emarsys' | |
env: | |
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} | |
- name: Create file 'FAILURE.TXT' and write 'true' into it | |
if: ${{ failure() }} | |
run: echo 'true' > FAILURE.TXT | |
- name: Upload file 'FAILURE.TXT' as an artifact | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v1 | |
with: | |
name: failure_file | |
path: FAILURE.TXT | |
TestCommon: | |
name: Run common tests on Firebase | |
needs: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: dev | |
submodules: true | |
fetch-depth: 0 # 0 indicates all history | |
- run: git fetch --all || echo "==> Accept any result" | |
- name: Download sample app | |
uses: actions/download-artifact@v2 | |
with: | |
name: sample | |
- name: Download common tests | |
uses: actions/download-artifact@v2 | |
with: | |
name: common | |
- name: Run tests | |
uses: asadmansr/[email protected] | |
with: | |
arg-spec: 'testWithAllDevices.yml:common' | |
env: | |
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} | |
- name: Create file 'FAILURE.TXT' and write 'true' into it | |
if: ${{ failure() }} | |
run: echo 'true' > FAILURE.TXT | |
- name: Upload file 'FAILURE.TXT' as an artifact | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v1 | |
with: | |
name: failure_file | |
path: FAILURE.TXT | |
TestEmarsysFirebase: | |
name: Run emarsys-firebase tests on Firebase | |
needs: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: dev | |
submodules: true | |
fetch-depth: 0 # 0 indicates all history | |
- run: git fetch --all || echo "==> Accept any result" | |
- name: Download sample app | |
uses: actions/download-artifact@v2 | |
with: | |
name: sample | |
- name: Download emarsys-firebase tests | |
uses: actions/download-artifact@v2 | |
with: | |
name: emarsys-firebase | |
- name: Run tests | |
uses: asadmansr/[email protected] | |
with: | |
arg-spec: 'testWithAllDevices.yml:emarsys-firebase' | |
env: | |
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} | |
- name: Create file 'FAILURE.TXT' and write 'true' into it | |
if: ${{ failure() }} | |
run: echo 'true' > FAILURE.TXT | |
- name: Upload file 'FAILURE.TXT' as an artifact | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v1 | |
with: | |
name: failure_file | |
path: FAILURE.TXT | |
TestEmarsysHuawei: | |
name: Run emarsys-huawei tests on Firebase | |
needs: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: dev | |
submodules: true | |
fetch-depth: 0 # 0 indicates all history | |
- run: git fetch --all || echo "==> Accept any result" | |
- name: Download sample app | |
uses: actions/download-artifact@v2 | |
with: | |
name: sample | |
- name: Download emarsys-huawei tests | |
uses: actions/download-artifact@v2 | |
with: | |
name: emarsys-huawei | |
- name: Run tests | |
uses: asadmansr/[email protected] | |
with: | |
arg-spec: 'testWithAllDevices.yml:emarsys-huawei' | |
env: | |
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} | |
- name: Create file 'FAILURE.TXT' and write 'true' into it | |
if: ${{ failure() }} | |
run: echo 'true' > FAILURE.TXT | |
- name: Upload file 'FAILURE.TXT' as an artifact | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v1 | |
with: | |
name: failure_file | |
path: FAILURE.TXT | |
ReleaseSample: | |
name: Release sample app | |
runs-on: ubuntu-latest | |
needs: [ Build, TestCore, TestMobileEngage, TestPredict, TestEmarsysSDK, TestEmarsys, TestCommon, TestEmarsysFirebase, TestEmarsysHuawei, CreateReleaseBundle, GradleLint ] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: dev | |
submodules: true | |
fetch-depth: 0 # 0 indicates all history | |
- run: git fetch --all || echo "==> Accept any result" | |
- name: Download sample app | |
uses: actions/download-artifact@v2 | |
with: | |
name: mobile-sdk-sample | |
- name: create-google services json | |
uses: jsdaniell/[email protected] | |
with: | |
name: google-play-services.json | |
json: ${{ secrets.GOOGLE_PLAY_STORE_SEVICE_ACCOUNT_JSON }} | |
- name: Playstore upload | |
uses: r0adkll/[email protected] | |
with: | |
serviceAccountJson: google-play-services.json | |
packageName: com.emarsys.sample | |
releaseFile: sample-release.aab | |
track: beta | |
- name: Create file 'FAILURE.TXT' and write 'true' into it | |
if: ${{ failure() }} | |
run: echo 'true' > FAILURE.TXT | |
- name: Upload file 'FAILURE.TXT' as an artifact | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v1 | |
with: | |
name: failure_file | |
path: FAILURE.TXT | |
SlackNotification: | |
name: Send slack notification | |
runs-on: ubuntu-latest | |
needs: [ ReleaseSample ] | |
steps: | |
- name: Slack Notification | |
uses: megamegax/[email protected] | |
with: | |
channel: '${{env.SLACK_CHANNEL}}' | |
message: 'Nightly build successful! :man-gesturing-ok: :bananadance:' | |
user_name: '${{env.SLACK_USERNAME}}' | |
job_status: 'success' | |
user_icon: '${{env.SLACK_ICON}}' | |
actions: '[{ "type": "button", "text": "View actions", "url": "https://github.com/emartech/android-emarsys-sdk/actions" },{ "type": "button", "text": "View Firebase", "url": "https://console.firebase.google.com/project/ems-mobile-sdk/testlab/histories/" },{ "type": "button", "text": "Install page", "url": "http://ems-mobileteam-artifacts.s3-website-eu-west-1.amazonaws.com/index-ems.html" }]' | |
SlackNotificationOnError: | |
name: Send slack on error | |
runs-on: ubuntu-latest | |
needs: [ ReleaseSample ] | |
if: always() | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: dev | |
submodules: true | |
fetch-depth: 0 # 0 indicates all history | |
- run: git fetch --all || echo "==> Accept any result" | |
- name: Download file 'FAILURE.TXT' from artifact | |
uses: actions/download-artifact@v1 | |
with: | |
name: failure_file | |
- name: Read file 'FAILURE.TXT' and set output parameter | |
id: set_output | |
run: echo "::set-output name=FAILURE::$(<failure_file/FAILURE.TXT)" | |
- name: Slack Notification | |
if: steps.set_output.outputs.FAILURE == 'true' | |
uses: megamegax/[email protected] | |
with: | |
channel: '${{env.SLACK_CHANNEL}}' | |
message: 'Nightly build failed! :man-gesturing-no: :blobcatfearful:' | |
user_name: '${{env.SLACK_USERNAME}}' | |
job_status: 'failure' | |
user_icon: '${{env.SLACK_ICON}}' | |
actions: '[{ "type": "button", "text": "View actions", "url": "https://github.com/emartech/android-emarsys-sdk/actions" },{ "type": "button", "text": "View Firebase", "url": "https://console.firebase.google.com/project/ems-mobile-sdk/testlab/histories/" }]' | |
Blackduck: | |
name: Run Blackduck scan | |
runs-on: ubuntu-latest | |
needs: [ Build ] | |
steps: | |
- name: Trigger Blackduck Scan | |
uses: peter-evans/repository-dispatch@v1 | |
with: | |
token: ${{ secrets.REPO_ACCESS_TOKEN }} | |
event-type: security-scan |