Skip to content

Enable Play Store connection #64

Enable Play Store connection

Enable Play Store connection #64

Workflow file for this run

name: MiN E2E
description: "Builds MiN app and runs e2e test"
on:
workflow_dispatch:
inputs:
mendix_version:
description: "Provide the SP version to be used (e.g., 10.14.0.43709) - has to be a released version (Default: latest from Mendix versions.json)"
required: false
default: ""
push:
pull_request:
permissions:
packages: write
jobs:
mendix-version:
runs-on: ubuntu-22.04
outputs:
mendix_version: ${{ steps.set-mendix-version.outputs.MENDIX_VERSION }}
steps:
- name: "Check out code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: "Get Mendix version from JSON"
id: get-mendix-version
uses: notiz-dev/github-action-json-property@7a701887f4b568b23eb7b78bb0fc49aaeb1b68d3 # v0.2.0
with:
path: configs/e2e/mendix-versions.json
prop_path: latest
- name: Set Mendix version
id: set-mendix-version
run: |
if [[ -n "${{ github.event.inputs.mendix_version }}" ]]; then
echo "MENDIX_VERSION=${{ github.event.inputs.mendix_version }}" >> $GITHUB_OUTPUT
else
echo "MENDIX_VERSION=${{ steps.get-mendix-version.outputs.prop }}" >> $GITHUB_OUTPUT
fi
- name: "Debug Mendix Version"
run: |
echo "Mendix Version: ${{ steps.set-mendix-version.outputs.MENDIX_VERSION }}"
docker-images:
needs: mendix-version
runs-on: ubuntu-22.04
steps:
- name: "Login to GitHub Container Registry"
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Check if docker image already exists"
run: |
docker manifest inspect ghcr.io/mendix/make-it-native/mxbuild:${{ needs.mendix-version.outputs.mendix_version }} || EXIT_CODE=$?
echo "IMAGE_MISSING=$EXIT_CODE" >> $GITHUB_ENV
- name: "Check out code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
if: ${{ env.IMAGE_MISSING != 0 }}
- name: "Build mxbuild image"
if: ${{ env.IMAGE_MISSING != 0 }}
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
file: ./.github/scripts/mxbuild.Dockerfile
context: ./.github/scripts
build-args: |
MENDIX_VERSION=${{ needs.mendix-version.outputs.mendix_version }}
push: true
tags: ghcr.io/mendix/make-it-native/mxbuild:${{ needs.mendix-version.outputs.mendix_version }}
project:
needs: [docker-images, mendix-version]
runs-on: ubuntu-22.04
container:
image: ghcr.io/mendix/make-it-native/mxbuild:${{ needs.mendix-version.outputs.mendix_version }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: "Make sure curl is installed"
run: |
apt update && apt upgrade -y
apt install curl -y
- name: "Download test project"
run: curl -L -o project.zip https://github.com/mendix/Native-Mobile-Resources/archive/refs/heads/main.zip
- name: "Extract test project"
uses: montudor/action-zip@0852c26906e00f8a315c704958823928d8018b28 # v1.0.0
with:
args: unzip -qq project.zip -d .
- name: "Force rebuild test project"
run: |
mxbuild -o automation.mda --loose-version-check Native-Mobile-Resources-main/NativeComponentsTestProject.mpr
- name: "Upload MDA"
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
with:
name: mda
path: automation.mda
android-app:
runs-on: ubuntu-22.04
steps:
- name: "Check out code"
uses: actions/checkout@v4
# - name: Retrieve the secrets and decode it to a file
# env:
# UPLOAD_KEYSTORE_BASE64: ${{ secrets.UPLOAD_KEYSTORE_BASE64 }}
# PLAY_STORE_CREDENTIALS_BASE64: ${{ secrets.PLAY_STORE_CREDENTIALS_BASE64 }}
# run: |
# mkdir -p ./android/keystores
# echo $UPLOAD_KEYSTORE_BASE64 | base64 --decode > ./android/keystores/upload.keystore
# echo $PLAY_STORE_CREDENTIALS_BASE64 | base64 --decode > ./android/fastlane/play-store-credentials.json
# shell: bash
- name: Build Android apk
uses: ./.github/actions/build-android
with:
google_services_json: ${{ secrets.GOOGLE_SERVICES_JSON }}
firebaseAPIKey: ${{ secrets.FIREBASE_API_KEY }}
keystoreBase64: ${{ secrets.UPLOAD_KEYSTORE_BASE64 }}
keystoreAlias: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
keystorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
keystoreKeyPassword: ${{ secrets.ANDROID_KEYSTORE_KEY_PASSWORD }}
playStoreCredentialsBase64: ${{ secrets.PLAY_STORE_CREDENTIALS_BASE64 }}
# keystorePath: ${{ secrets.UPLOAD_KEYSTORE_BASE64 }}
# playStoreCredentialsPath: ${{ secrets.PLAY_STORE_CREDENTIALS_BASE64 }}
# # keystorePath: ${{ github.workspace }}/android/keystores/upload.keystore
# # playStoreCredentialsPath: ${{ github.workspace }}/android/fastlane/play-store-credentials.json
ios-app:
runs-on: macOS-15
steps:
- name: "Check out code"
uses: actions/checkout@v4
- name: Build ios app
uses: ./.github/actions/build-ios
- name: "Upload iOS App"
uses: actions/upload-artifact@v4
with:
name: ios-app
path: ios/build/DeveloperApp-Debug.ipa
android-test:
needs: [mendix-version, project, android-app]
runs-on: ubuntu-22.04
steps:
- name: "Check out code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: "Download project MDA file"
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: mda
- name: "Download Android app"
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: android-app
path: android-app
# - name: "Install GitHub CLI"
# run: |
# curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
# sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
# echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
# sudo apt update
# sudo apt install gh
# - name: "Authenticate GitHub CLI"
# run: |
# unset GITHUB_TOKEN
# echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
# - name: "Fetch artifacts from run 41"
# id: fetch-artifacts
# run: |
# artifacts_url=$(gh api "repos/${{ github.repository }}/actions/runs/14242504528/artifacts" --jq '.artifacts[] | select(.name == "android-app") | .archive_download_url')
# echo "Artifacts URL: $artifacts_url"
# echo "artifacts_url=$artifacts_url" >> $GITHUB_ENV
# - name: "Download Android app"
# if: env.artifacts_url != ''
# run: |
# if [ -z "$artifacts_url" ]; then
# echo "No artifacts URL found."
# exit 1
# fi
# curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -o android-app.zip "$artifacts_url"
# unzip android-app.zip -d android-app
- name: "Check for APK file"
run: |
echo "Checking for APK file..."
if [ -f android-app/app-production-debug.apk ]; then
echo "APK file found: android-app/app-production-debug.apk"
else
echo "APK file not found!"
exit 1
fi
shell: bash
- name: "Start runtime"
uses: ./.github/actions/start-runtime
with:
mda-file: automation.mda
mendix-version: ${{ needs.mendix-version.outputs.mendix_version }}
- name: "Install Maestro"
run: |
mkdir -p $HOME/.local/bin
curl -L "https://github.com/mobile-dev-inc/maestro/releases/latest/download/maestro.zip" -o maestro.zip
unzip maestro.zip -d $HOME/.local/bin
chmod +x $HOME/.local/bin/maestro/bin/maestro
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Verify maestro
run: $HOME/.local/bin/maestro/bin/maestro --version
- name: Set up Android SDK
run: echo "ANDROID_HOME=$ANDROID_SDK_ROOT" >> $GITHUB_ENV
- 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 the android tests"
uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.0.0
with:
api-level: 30
target: google_apis
arch: x86_64
profile: pixel
emulator-options: "-no-window -gpu swiftshader_indirect -no-boot-anim -no-snapshot -memory 4096 -cores 4"
disable-animations: true
script: |
chmod +x maestro/helpers/prepare_android.sh
chmod +x maestro/run_maestro_tests.sh
bash maestro/helpers/prepare_android.sh
bash maestro/run_maestro_tests.sh android
# - name: "Capture emulator logs"
# if: always()
# continue-on-error: true
# run: |
# mkdir -p ${{ github.workspace }}/emulator-logs
# adb logcat -d > ${{ github.workspace }}/emulator-logs/emulator-logcat.txt
# adb shell dmesg > ${{ github.workspace }}/emulator-logs/emulator-dmesg.txt
# shell: bash
# - name: "Upload emulator logs"
# uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
# continue-on-error: true
# if: always()
# with:
# name: emulator-logs
# path: ${{ github.workspace }}/emulator-logs/
# if-no-files-found: warn
- name: "Debug root folder"
if: always()
continue-on-error: true
run: |
echo "Checking contents of the root folder:"
ls -R ${{ github.workspace }}
- name: "Archive runtime logs"
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
if: always()
continue-on-error: true
with:
name: android-runtime-logs
path: log/*.log
if-no-files-found: ignore
- name: "Archive test screenshots"
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
if: always()
with:
name: android-screenshots
path: ${{ github.workspace }}/maestro/tests/images/actual/android/**/*.png
if-no-files-found: warn
compare-screenshots:
needs: [android-test]
runs-on: ubuntu-latest
if: always()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: "Check out code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: "Download all Android screenshots"
run: |
mkdir -p images/actual/android/
echo "Downloading all Android screenshots..."
gh run download ${{ github.run_id }} --name android-screenshots --dir images/actual/android/ || echo "⚠️ Failed to download Android screenshots."
ls -l images/actual/android/
- name: "Download all iOS screenshots"
run: |
mkdir -p images/actual/ios/
echo "Downloading all iOS screenshots..."
gh run download ${{ github.run_id }} --name ios-screenshots --dir images/actual/ios/ || echo "⚠️ Failed to download iOS screenshots."
ls -l images/actual/ios/
- name: "Set up node"
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
with:
node-version-file: .nvmrc
cache: npm
- name: "Install npm and dependencies"
run: npm install && npm install @actions/core pixelmatch
- name: "Compare Android screenshots"
continue-on-error: true
run: node ${{ github.workspace }}/maestro/helpers/compare_screenshots.js android
- name: "Compare iOS screenshots"
continue-on-error: true
run: node ${{ github.workspace }}/maestro/helpers/compare_screenshots.js ios
- name: "Archive diff results"
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
with:
name: screenshot-diffs
path: maestro/tests/images/diffs/
if-no-files-found: ignore
- name: "Archive comparison results"
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
with:
name: comparison-results
path: compare_output.txt
if-no-files-found: ignore
- name: "Fail if comparisons failed"
run: |
if [ "$ANDROID_COMPARISON_FAILED" == "true" ] || [ "$IOS_COMPARISON_FAILED" == "true" ]; then
echo "One or more comparisons failed."
exit 1
fi