Test App #66
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: Test App | |
on: | |
workflow_dispatch: | |
inputs: | |
job: | |
description: Job to run | |
required: true | |
type: choice | |
options: | |
- ios | |
- android | |
default: ios | |
flavor: | |
description: Build Flavor | |
type: choice | |
default: stg | |
options: | |
- stg | |
- prod | |
max-parallel: | |
description: The maximum number of jobs that can run simultaneously | |
default: '1' | |
type: choice | |
options: | |
- '1' | |
- '2' | |
- '3' | |
slack: | |
description: Send report info to Slack | |
type: boolean | |
default: false | |
jobs: | |
test-ios: | |
runs-on: macos-latest | |
if: ${{ github.event.inputs.job == 'ios'}} | |
permissions: | |
contents: write | |
actions: write | |
strategy: | |
max-parallel: ${{github.event.inputs.max-parallel}} | |
matrix: | |
os: [17.5] | |
model: [iPhone 15,iPhone SE (3rd generation)] | |
env: | |
APP_PATH: ${{ github.workspace }}/finna.app | |
ZIP_PATH: ${{ github.workspace }}/finna.zip | |
XCODE_VERSION: 15.4 | |
PROD: ${{github.event.inputs.flavor == 'prod' && 'true' || 'false'}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download APP file from AWS S3 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
run: | | |
aws s3 cp s3://appium-finna/${{github.event.inputs.flavor == 'stg' && 'finna.zip' || 'finna-prod.zip' }} \ | |
${{ env.ZIP_PATH }} | |
- name: Unzip the app | |
run: | | |
unzip ${{ env.ZIP_PATH }} -d ${{ github.workspace }} | |
# Add Appium cache | |
- name: Cache Appium | |
uses: actions/cache@v4 | |
with: | |
path: ~/.appium | |
key: ${{ runner.os }}-appium-${{ hashFiles('**/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-appium- | |
- name: Setup Appium | |
run: | | |
npm install -g appium | |
appium driver install xcuitest || true | |
- name: Install wdio dependencies | |
run: npm install | |
- name: Set Xcode Version | |
uses: maxim-lobanov/[email protected] | |
with: | |
xcode-version: ${{ env.XCODE_VERSION }} | |
- name: Launch iOS Simulator | |
uses: futureware-tech/simulator-action@v4 | |
with: | |
os_version: ${{ matrix.os }} | |
model: ${{ matrix.model }} | |
wait_for_boot: 'true' | |
- name: Run iOS test suite | |
continue-on-error: true | |
env: | |
FINNA_USER_EMAIL: ${{ secrets.FINNA_USER_EMAIL }} | |
FINNA_USER_PASSWORD: ${{ secrets.FINNA_USER_PASSWORD }} | |
FINNA_USER_PIN: ${{ secrets.FINNA_USER_PIN }} | |
MAILOSAUR_ID: ${{ secrets.MAILOSAUR_ID }} | |
MAILOSAUR_KEY: ${{ secrets.MAILOSAUR_KEY }} | |
BUNDLE_ID: 'com.finna.protocol.stg' | |
OS_VERSION: ${{ matrix.os }} | |
DEVICE_NAME: ${{ matrix.model }} | |
run: | | |
appium driver doctor xcuitest || true | |
npm run ios${{github.event.inputs.flavor == 'prod' && '-prod' || '' }} | |
- name: Deploy Allure report | |
uses: cybersokari/[email protected] | |
with: | |
allure_results_path: ${{ github.workspace }}/reports/ios/allure-results | |
target: firebase | |
google_credentials_json: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}} | |
gcs_bucket: ${{ secrets.GCS_BUCKET }} | |
gcs_bucket_prefix: 'finna-ci-ios/${{github.event.inputs.flavor}}/${{matrix.os}}' | |
show_history: 'true' | |
retries: 5 | |
slack_token: ${{ github.event.inputs.slack == 'true' && secrets.SLACK_TOKEN || '' }} | |
slack_channel: ${{ github.event.inputs.slack == 'true' && secrets.SLACK_CHANNEL || '' }} | |
report_name: 'iOS Finna' | |
test-android: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.inputs.job == 'android'}} | |
permissions: | |
contents: write | |
actions: write | |
strategy: | |
max-parallel: 3 | |
matrix: | |
api-level: [31, 32, 33] | |
device: [Nexus 6] | |
env: | |
APK_PATH: ${{ github.workspace }}/app-finna.apk | |
PROD: ${{github.event.inputs.flavor == 'prod' && 'true' || 'false'}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download APK from AWS S3 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
run: | | |
aws s3 cp s3://appium-finna/${{github.event.inputs.flavor == 'stg' && 'finna.apk' || 'finna-prod.apk' }} \ | |
${{ env.APK_PATH }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
# Add Node modules caching | |
- name: Cache Node modules | |
uses: actions/cache@v4 | |
id: npm-cache | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Setup Java JDK | |
uses: actions/[email protected] | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
with: | |
log-accepted-android-sdk-licenses: 'false' | |
# Add Android SDK cache | |
- name: Cache Android SDK | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.android/cache | |
~/.android/repositories | |
key: ${{ runner.os }}-android-sdk-${{ hashFiles('~/.android/repositories') }} | |
restore-keys: | | |
${{ runner.os }}-android-sdk- | |
# Add Appium cache | |
- name: Cache Appium | |
uses: actions/cache@v4 | |
with: | |
path: ~/.appium | |
key: ${{ runner.os }}-appium-${{ hashFiles('**/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-appium- | |
- name: Setup Appium | |
run: | | |
npm install -g appium | |
appium driver install uiautomator2 || true | |
- name: Install wdio dependencies | |
run: npm install | |
- name: Enable KVM | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Run test in Emulator | |
uses: ReactiveCircus/[email protected] | |
continue-on-error: true | |
env: | |
FINNA_USER_EMAIL: ${{ secrets.FINNA_USER_EMAIL }} | |
FINNA_USER_PASSWORD: ${{ secrets.FINNA_USER_PASSWORD }} | |
FINNA_USER_PIN: ${{ secrets.FINNA_USER_PIN }} | |
MAILOSAUR_ID: ${{ secrets.MAILOSAUR_ID }} | |
MAILOSAUR_KEY: ${{ secrets.MAILOSAUR_KEY }} | |
PACKAGE_NAME: ${{ secrets.PACKAGE_NAME }} | |
OS_VERSION: ${{ matrix.api-level }} | |
DEVICE_NAME: ${{matrix.device}} | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: 'google_apis' | |
arch: 'x86_64' | |
profile: ${{matrix.device}} | |
ram-size: 4096M | |
script: | | |
$ANDROID_HOME/cmdline-tools/latest/bin/avdmanager list device || true | |
appium driver doctor uiautomator2 || true | |
npm run android${{github.event.inputs.flavor == 'prod' && '-prod' || '' }} | |
- name: Deploy Allure report | |
uses: cybersokari/[email protected] | |
with: | |
allure_results_path: ${{ github.workspace }}/reports/android/allure-results | |
target: firebase | |
google_credentials_json: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}} | |
gcs_bucket: ${{ secrets.GCS_BUCKET }} | |
gcs_bucket_prefix: 'finna-ci-android/${{github.event.inputs.flavor}}/${{matrix.api-level}}' | |
show_history: 'true' | |
retries: 5 | |
slack_token: ${{ github.event.inputs.slack == 'true' && secrets.SLACK_TOKEN || '' }} | |
slack_channel: ${{ github.event.inputs.slack == 'true' && secrets.SLACK_CHANNEL || '' }} | |
report_name: 'Android Finna' |