Skip to content

Initial commit

Initial commit #1

Workflow file for this run

name: MiN E2E
description: "Builds MiN app and runs e2e test"
on:
push:
branches:
- main
- moo/MOO-1455-setup-MiN-test-job
pull_request:
branches:
- main
- moo/MOO-1455-setup-MiN-test-job
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: ""
jobs:
mendix-version:
runs-on: ubuntu-latest
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-latest
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/native-widgets/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/native-widgets/mxbuild:${{ needs.mendix-version.outputs.mendix_version }}
project:
needs: [mendix-version]
runs-on: ubuntu-latest
container:
image: ghcr.io/mendix/native-widgets/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-latest
steps:
- name: Build android apk
uses: ./.github/actions/build-android
android-test:
needs: [mendix-version, project, android-app]
runs-on: ubuntu-22.04
steps:
- name: "Check out code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- 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: "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
- name: "Archive runtime logs"
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
if: always()
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: ignore