Skip to content

Commit 800d340

Browse files
authored
[MOO-1927] Add js actions test (#279)
2 parents c2d2c1f + 09440ac commit 800d340

File tree

30 files changed

+542
-97
lines changed

30 files changed

+542
-97
lines changed

.github/scripts/determine-widget-scope.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,13 @@ if [ "$event_name" == "pull_request" ]; then
3939
echo "widgets=${all_widgets}" >> $GITHUB_OUTPUT
4040
fi
4141
else
42-
if [ -n "$input_workspace" ] && [ "$input_workspace" != "*-native" ]; then
42+
if [ -n "$input_workspace" ] && [ "$input_workspace" != "*-native" ] && [ "$input_workspace" != "js-actions" ]; then
4343
selected_workspaces=$(echo "$input_workspace" | sed 's/,/ /g')
4444
echo "scope=--all --include '${selected_workspaces}'" >> $GITHUB_OUTPUT
4545
echo "widgets=[\"$input_workspace\"]" >> $GITHUB_OUTPUT
46+
elif [ "$input_workspace" == "js-actions" ]; then
47+
echo "scope=--all --include 'mobile-resources-native nanoflow-actions-native'" >> $GITHUB_OUTPUT
48+
echo "widgets=[\"mobile-resources-native\",\"nanoflow-actions-native\"]" >> $GITHUB_OUTPUT
4649
else
4750
echo "scope=--all --include '*-native'" >> $GITHUB_OUTPUT
4851
echo "widgets=${all_widgets}" >> $GITHUB_OUTPUT

.github/workflows/NativePipeline.yml

Lines changed: 216 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ on:
1818
type: choice
1919
options:
2020
- "*-native"
21+
- js-actions
2122
- accordion-native
2223
- activity-indicator-native
2324
- animation-native
@@ -83,7 +84,7 @@ jobs:
8384
- name: "Debug Scope Output"
8485
run: |
8586
echo "Scope is: ${{ steps.scope.outputs.scope }}"
86-
echo "Widgets are: ${{ steps.scope.outputs.widgets }}"
87+
echo "Widgets or js actions are: ${{ steps.scope.outputs.widgets }}"
8788
mendix-version:
8889
runs-on: ubuntu-22.04
8990
outputs:
@@ -196,14 +197,35 @@ jobs:
196197
run: yarn install --immutable
197198
- name: "Force rebuild resources"
198199
run: |
199-
yarn workspaces foreach ${{ needs.scope.outputs.scope }} run build # Ensure all resources are rebuilt
200+
# Build JS actions if needed
201+
if [ "${{ github.event.inputs.workspace }}" = "js-actions" ] || \
202+
[ "${{ github.event.inputs.workspace }}" = "*-native" ] || \
203+
[ "${{ github.event_name }}" = "schedule" ]; then
204+
yarn workspace mobile-resources-native run build
205+
yarn workspace nanoflow-actions-native run build
206+
fi
207+
208+
# Build widgets if needed (any specific widget, *-native, or nightly)
209+
if [ "${{ github.event.inputs.workspace }}" != "js-actions" ] || \
210+
[ "${{ github.event.inputs.workspace }}" = "*-native" ] || \
211+
[ "${{ github.event_name }}" = "schedule" ]; then
212+
widgets=$(echo '${{ needs.scope.outputs.widgets }}' | jq -r '.[]')
213+
for w in $widgets; do
214+
yarn workspace $w run build
215+
done
216+
fi
200217
- name: "Unit test"
201218
run: yarn workspaces foreach ${{ needs.scope.outputs.scope }} run test
202-
- name: "Run build for development"
203-
run: yarn workspaces foreach ${{ needs.scope.outputs.scope }} run build
204-
env:
205-
NODE_OPTIONS: --max_old_space_size=6144
206-
- name: "Upload resources artifact"
219+
- name: "Upload JS actions resources artifact"
220+
if: ${{ github.event.inputs.workspace == 'js-actions' }}
221+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
222+
with:
223+
name: resources
224+
path: |
225+
packages/jsActions/mobile-resources-native/dist/**/*
226+
packages/jsActions/nanoflow-actions-native/dist/**/*
227+
- name: "Upload widget and JS actions resources artifact"
228+
if: ${{ github.event.inputs.workspace != 'js-actions' }}
207229
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
208230
with:
209231
name: resources
@@ -238,6 +260,7 @@ jobs:
238260
- name: "List resources"
239261
run: ls -R resources
240262
- name: "Move widgets"
263+
if: ${{ github.event.inputs.workspace != 'js-actions' }}
241264
shell: bash
242265
run: |
243266
if compgen -G 'resources/pluggableWidgets/**/dist/*/*.mpk' > /dev/null; then
@@ -436,8 +459,9 @@ jobs:
436459
name: ios-app
437460
path: native-template/ios/build/Build/Products/**/*.app
438461

439-
android-tests:
462+
android-widget-tests:
440463
needs: [scope, mendix-version, project, android-app]
464+
if: ${{ github.event.inputs.workspace != 'js-actions' || github.event_name == 'schedule' }}
441465
runs-on: ubuntu-22.04
442466
timeout-minutes: 60
443467
strategy:
@@ -518,7 +542,7 @@ jobs:
518542
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
519543
sudo udevadm control --reload-rules
520544
sudo udevadm trigger --name-match=kvm
521-
- name: "Run the android tests"
545+
- name: "Run android tests"
522546
uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.0.0
523547
with:
524548
api-level: 30
@@ -529,9 +553,9 @@ jobs:
529553
disable-animations: true
530554
script: |
531555
chmod +x maestro/helpers/prepare_android.sh
532-
chmod +x maestro/run_maestro_tests.sh
556+
chmod +x maestro/run_maestro_widget_tests.sh
533557
bash maestro/helpers/prepare_android.sh
534-
bash maestro/run_maestro_tests.sh android "${{ matrix.widget }}"
558+
bash maestro/run_maestro_widget_tests.sh android "${{ matrix.widget }}"
535559
536560
- name: "Archive runtime logs"
537561
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
@@ -555,8 +579,9 @@ jobs:
555579
path: packages/pluggableWidgets/**/artifacts/
556580
if-no-files-found: ignore
557581

558-
ios-tests:
582+
ios-widget-tests:
559583
needs: [scope, mendix-version, project, ios-app]
584+
if: ${{ github.event.inputs.workspace != 'js-actions' || github.event_name == 'schedule' }}
560585
runs-on: macos-15
561586
timeout-minutes: 60
562587
strategy:
@@ -645,9 +670,9 @@ jobs:
645670
- name: "Run iOS tests"
646671
run: |
647672
chmod +x maestro/helpers/prepare_ios.sh
648-
chmod +x maestro/run_maestro_tests.sh
673+
chmod +x maestro/run_maestro_widget_tests.sh
649674
bash maestro/helpers/prepare_ios.sh
650-
bash maestro/run_maestro_tests.sh ios "${{ matrix.widget }}"
675+
bash maestro/run_maestro_widget_tests.sh ios "${{ matrix.widget }}"
651676
652677
- name: "Archive runtime logs"
653678
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
@@ -671,8 +696,176 @@ jobs:
671696
path: packages/pluggableWidgets/**/artifacts/
672697
if-no-files-found: ignore
673698

699+
android-js-tests:
700+
if: ${{ github.event.inputs.workspace == '*-native' || github.event_name == 'schedule' || github.event.inputs.workspace == 'js-actions'}}
701+
needs: [mendix-version, project, android-app]
702+
runs-on: ubuntu-22.04
703+
timeout-minutes: 90
704+
steps:
705+
- name: "Check out code"
706+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
707+
with:
708+
fetch-depth: 0
709+
- name: "Set up node"
710+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
711+
with:
712+
node-version-file: .nvmrc
713+
cache: yarn
714+
- name: "Install dependencies"
715+
run: yarn install --immutable
716+
- name: "Download project MDA file"
717+
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
718+
with:
719+
name: mda
720+
- name: "Download Android app"
721+
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
722+
with:
723+
name: android-app
724+
path: android-app
725+
- name: "Start runtime"
726+
uses: ./.github/actions/start-runtime
727+
with:
728+
mda-file: automation.mda
729+
mendix-version: ${{ needs.mendix-version.outputs.mendix_version }}
730+
- name: "Install Maestro"
731+
run: |
732+
mkdir -p $HOME/.local/bin
733+
curl -L "https://github.com/mobile-dev-inc/maestro/releases/latest/download/maestro.zip" -o maestro.zip
734+
unzip maestro.zip -d $HOME/.local/bin
735+
chmod +x $HOME/.local/bin/maestro/bin/maestro
736+
echo "$HOME/.local/bin" >> $GITHUB_PATH
737+
- name: Verify maestro
738+
run: $HOME/.local/bin/maestro/bin/maestro --version
739+
- name: Set up Android SDK
740+
run: echo "ANDROID_HOME=$ANDROID_SDK_ROOT" >> $GITHUB_ENV
741+
- name: Enable KVM
742+
run: |
743+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
744+
sudo udevadm control --reload-rules
745+
sudo udevadm trigger --name-match=kvm
746+
- name: "Run android tests"
747+
uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.0.0
748+
with:
749+
api-level: 30
750+
target: google_apis
751+
arch: x86_64
752+
profile: pixel
753+
emulator-options: "-no-window -gpu swiftshader_indirect -no-boot-anim -no-snapshot -memory 4096 -cores 4"
754+
disable-animations: true
755+
script: |
756+
chmod +x maestro/helpers/prepare_android.sh
757+
chmod +x maestro/run_maestro_jsactions_tests.sh
758+
bash maestro/helpers/prepare_android.sh
759+
bash maestro/run_maestro_jsactions_tests.sh android
760+
761+
- name: "Archive runtime logs"
762+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
763+
if: always()
764+
with:
765+
name: android-runtime-logs-js-actions
766+
path: log/*.log
767+
if-no-files-found: ignore
768+
- name: "Archive test screenshots"
769+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
770+
if: always()
771+
with:
772+
name: android-screenshots-js-actions
773+
path: ${{ github.workspace }}/maestro/images/actual/android/**/*.png
774+
if-no-files-found: ignore
775+
- name: "Archive artifacts"
776+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
777+
if: always()
778+
with:
779+
name: android-artifacts-js-actions
780+
path: packages/pluggableWidgets/**/artifacts/
781+
if-no-files-found: ignore
782+
783+
ios-js-tests:
784+
if: ${{ github.event.inputs.workspace == '*-native' || github.event_name == 'schedule' || github.event.inputs.workspace == 'js-actions'}}
785+
needs: [mendix-version, project, ios-app]
786+
runs-on: macos-15
787+
timeout-minutes: 90
788+
steps:
789+
- name: "Check out code"
790+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
791+
with:
792+
fetch-depth: 0
793+
- name: "Set up node"
794+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
795+
with:
796+
node-version-file: .nvmrc
797+
cache: yarn
798+
- name: "Install dependencies"
799+
run: |
800+
yarn cache clean
801+
yarn install --immutable
802+
- name: "Download project MDA file"
803+
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
804+
with:
805+
name: mda
806+
- name: "Start runtime"
807+
uses: ./.github/actions/start-runtime
808+
with:
809+
mda-file: automation.mda
810+
mendix-version: ${{ needs.mendix-version.outputs.mendix_version }}
811+
812+
- name: "Download iOS app"
813+
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
814+
with:
815+
name: ios-app
816+
path: ios-app
817+
- name: Check iOS App Path
818+
run: ls ios-app
819+
820+
- name: "Verify Xcode CLI Tools"
821+
run: |
822+
if ! xcode-select --print-path; then
823+
echo "Xcode CLI tools not set. Setting them now."
824+
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
825+
else
826+
echo "Xcode CLI tools are already configured."
827+
fi
828+
- name: "Install Maestro"
829+
run: |
830+
mkdir -p $HOME/.local/bin
831+
curl -L "https://github.com/mobile-dev-inc/maestro/releases/latest/download/maestro.zip" -o maestro.zip
832+
unzip maestro.zip -d $HOME/.local/bin
833+
chmod +x $HOME/.local/bin/maestro/bin/maestro
834+
echo "$HOME/.local/bin" >> $GITHUB_PATH
835+
- name: "Verify maestro"
836+
run: $HOME/.local/bin/maestro/bin/maestro --version
837+
- name: "List Available Simulators"
838+
run: xcrun simctl list devices
839+
- name: "Run iOS tests"
840+
run: |
841+
chmod +x maestro/helpers/prepare_ios.sh
842+
chmod +x maestro/run_maestro_jsactions_tests.sh
843+
bash maestro/helpers/prepare_ios.sh
844+
bash maestro/run_maestro_jsactions_tests.sh ios
845+
846+
- name: "Archive runtime logs"
847+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
848+
if: always()
849+
with:
850+
name: ios-runtime-logs-js-actions
851+
path: log/*.log
852+
if-no-files-found: ignore
853+
- name: "Archive test screenshots"
854+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
855+
if: always()
856+
with:
857+
name: ios-screenshots-js-actions
858+
path: ${{ github.workspace }}/maestro/images/actual/ios/**/*.png
859+
if-no-files-found: ignore
860+
- name: "Archive artifacts"
861+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
862+
if: always()
863+
with:
864+
name: ios-artifacts-js-actions
865+
path: packages/pluggableWidgets/**/artifacts/
866+
if-no-files-found: ignore
674867
compare-screenshots:
675-
needs: [scope, android-tests, ios-tests]
868+
needs: [scope, android-widget-tests, ios-widget-tests, android-js-tests, ios-js-tests]
676869
runs-on: ubuntu-latest
677870
if: always()
678871
env:
@@ -690,6 +883,10 @@ jobs:
690883
gh run download ${{ github.run_id }} --name android-screenshots-${widget} --dir images/actual/android/ || true
691884
ls -l images/actual/android/
692885
done
886+
# Download JS actions screenshots
887+
echo "Downloading android-screenshots-js-actions"
888+
gh run download ${{ github.run_id }} --name android-screenshots-js-actions --dir images/actual/android/ || true
889+
ls -l images/actual/android/
693890
694891
- name: "Download iOS screenshots"
695892
run: |
@@ -700,8 +897,11 @@ jobs:
700897
gh run download ${{ github.run_id }} --name ios-screenshots-${widget} --dir images/actual/ios/ || true
701898
ls -l images/actual/ios/
702899
done
900+
# Download JS actions screenshots
901+
echo "Downloading ios-screenshots-js-actions"
902+
gh run download ${{ github.run_id }} --name ios-screenshots-js-actions --dir images/actual/ios/ || true
903+
ls -l images/actual/ios/
703904
704-
705905
- name: "Set up node"
706906
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
707907
with:
Loading
59.3 KB
Loading
Loading
Loading
215 KB
Loading
Binary file not shown.
104 KB
Loading
58.5 KB
Loading

0 commit comments

Comments
 (0)