Skip to content

Merge pull request #10 from emartech/dependabot/github_actions/dev/go… #403

Merge pull request #10 from emartech/dependabot/github_actions/dev/go…

Merge pull request #10 from emartech/dependabot/github_actions/dev/go… #403

name: Last push build
on:
workflow_dispatch:
push:
branches: [ dev ]
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 }}
USE_LOCAL_DEPENDENCY: ${{ vars.USE_LOCAL_DEPENDENCY }}
RELEASE_MODE: ${{ vars.RELEASE_MODE }}
ANDROID_RELEASE_STORE_FILE_BASE64: ${{ secrets.ANDROID_RELEASE_STORE_FILE_BASE64 }}
ANDROID_RELEASE_STORE_PASSWORD: ${{ secrets.ANDROID_RELEASE_STORE_PASSWORD }}
ANDROID_RELEASE_KEY_ALIAS: ${{ secrets.ANDROID_RELEASE_KEY_ALIAS }}
ANDROID_RELEASE_KEY_PASSWORD: ${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }}
FIREBASE_PROJECT_ID: ${{ vars.FIREBASE_PROJECT_ID }}
FIREBASE_SERVICE_ACCOUNT_JSON: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }}
GOOGLE_OAUTH_SERVER_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_SERVER_CLIENT_ID }}
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
SONATYPE_SIGNING_KEY_ID: ${{ secrets.SONATYPE_SIGNING_KEY_ID }}
SONATYPE_SIGNING_PASSWORD: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
SONATYPE_SIGNING_SECRET_KEY_RING_FILE_BASE64: ${{ secrets.SONATYPE_SIGNING_SECRET_KEY_RING_FILE_BASE64 }}
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_ICON: https://icons.iconarchive.com/icons/martz90/circle/256/android-icon.png
SLACK_TITLE: Commit status
SLACK_USERNAME: Emarsys SDK - Android
SLACK_WEBHOOK: ${{ secrets.SLACK_MOBILE_TEAM_CI_CHANNEL_WEBHOOK }}
jobs:
Build:
# The type of runner that the job will run on
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@v4
with:
distribution: 'temurin'
java-version: 17
- name: Prepare CI
run: make prepare-ci
- name: Build with Gradle
run: make build-test
- name: upload sample app artifact
uses: actions/upload-artifact@v4
with:
name: sample
path: sample/build/outputs/apk/androidTest/debug/sample-debug-androidTest.apk
- name: upload core test apk artifact
uses: actions/upload-artifact@v4
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@v4
with:
name: mobile-engage
path: mobile-engage/build/outputs/apk/androidTest/debug/mobile-engage-debug-androidTest.apk
- name: upload emarsys-sdk test apk artifact
uses: actions/upload-artifact@v4
with:
name: predict
path: predict/build/outputs/apk/androidTest/debug/predict-debug-androidTest.apk
- name: upload emarsys test apk artifact
uses: actions/upload-artifact@v4
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@v4
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@v4
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@v4
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@v4
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 }}
GradleLint:
name: Run lint on project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
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@v4
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
CreateReleaseBundle:
name: Create release bundle
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
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@v4
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@v4
with:
name: mobile-sdk-sample
path: sample/build/outputs/bundle/release/sample-release.aab
TestCore:
name: Run core tests on Firebase
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
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@v4
with:
name: sample
- name: Download core tests
uses: actions/download-artifact@v4
with:
name: core
- name: Run tests
uses: asadmansr/[email protected]
with:
arg-spec: 'testWithSomeVirtualDevices.yml:core'
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
TestMobileEngage:
name: Run mobile-engage tests on Firebase
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
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@v4
with:
name: sample
- name: Download mobile-engage tests
uses: actions/download-artifact@v4
with:
name: mobile-engage
- name: Run tests
uses: asadmansr/[email protected]
with:
arg-spec: 'testWithSomeVirtualDevices.yml:mobile-engage'
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
TestPredict:
name: Run predict tests on Firebase
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
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@v4
with:
name: sample
- name: Download predict tests
uses: actions/download-artifact@v4
with:
name: predict
- name: Run tests
uses: asadmansr/[email protected]
with:
arg-spec: 'testWithSomeVirtualDevices.yml:predict'
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
TestEmarsysSDK:
name: Run emarsys-sdk tests on Firebase
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
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@v4
with:
name: sample
- name: Download emarsys-sdk tests
uses: actions/download-artifact@v4
with:
name: emarsys-sdk
- name: Display structure of downloaded files
run: ls -R
- name: Run tests
uses: asadmansr/[email protected]
with:
arg-spec: 'testWithSomeVirtualDevices.yml:emarsys-sdk'
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
TestEmarsys:
name: Run emarsys tests on Firebase
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
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@v4
with:
name: sample
- name: Download emarsys tests
uses: actions/download-artifact@v4
with:
name: emarsys
- name: Run tests
uses: asadmansr/[email protected]
with:
arg-spec: 'testWithSomeVirtualDevices.yml:emarsys'
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
TestCommon:
name: Run common tests on Firebase
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
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@v4
with:
name: sample
- name: Download common tests
uses: actions/download-artifact@v4
with:
name: common
- name: Run tests
uses: asadmansr/[email protected]
with:
arg-spec: 'testWithSomeVirtualDevices.yml:common'
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
TestEmarsysFirebase:
name: Run emarsys-firebase tests on Firebase
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
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@v4
with:
name: sample
- name: Download emarsys-firebase tests
uses: actions/download-artifact@v4
with:
name: emarsys-firebase
- name: Run tests
uses: asadmansr/[email protected]
with:
arg-spec: 'testWithSomeVirtualDevices.yml:emarsys-firebase'
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
TestEmarsysHuawei:
name: Run emarsys-huawei tests on Firebase
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
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@v4
with:
name: sample
- name: Download emarsys-huawei tests
uses: actions/download-artifact@v4
with:
name: emarsys-huawei
- name: Run tests
uses: asadmansr/[email protected]
with:
arg-spec: 'testWithSomeVirtualDevices.yml:emarsys-huawei'
env:
SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
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:
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@v4
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: alpha
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: 'Last push 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: ${{ failure() }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0 # 0 indicates all history
- run: git fetch --all || echo "==> Accept any result"
- name: Slack Notification
uses: megamegax/[email protected]
with:
channel: '${{env.SLACK_CHANNEL}}'
message: 'Last push 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/" }]'