Skip to content

Commit 0c706e2

Browse files
committed
Refactor tooling setup
1 parent 7297706 commit 0c706e2

3 files changed

Lines changed: 90 additions & 162 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: "Setup Python Common"
2+
description: "Setup Python and install dependencies"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
7+
with:
8+
python-version: '3.x'
9+
cache: 'pip'
10+
- run: pip install PyYAML httplib2
11+
shell: bash
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: "Setup Tools"
2+
description: "Common setup for widget and js test jobs"
3+
inputs:
4+
mendix_version:
5+
description: "Mendix version"
6+
required: true
7+
outputs:
8+
java-path:
9+
description: "Path to the installed Java"
10+
value: ${{ steps.setup-java.outputs.path }}
11+
runs:
12+
using: "composite"
13+
steps:
14+
- name: "Setup Python and dependencies"
15+
uses: ./.github/actions/setup-python
16+
- name: "Cache pip"
17+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4
18+
with:
19+
path: ~/.cache/pip
20+
key: ${{ runner.os }}-pip-pyaml-httplib2
21+
22+
- name: "Setup Node and dependencies"
23+
uses: ./.github/actions/setup-node-with-cache
24+
25+
- name: "Setup Java 21"
26+
id: setup-java
27+
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 #v4
28+
with:
29+
distribution: "temurin"
30+
java-version: "21"
31+
32+
- name: "Cache Mendix runtime"
33+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4
34+
with:
35+
path: tmp/runtime.tar.gz
36+
key: mendix-runtime-${{ inputs.mendix_version }}
37+
38+
- name: "Cache m2ee-tools"
39+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4
40+
with:
41+
path: tmp/m2ee
42+
key: m2ee-tools-v1
43+
44+
- name: "Install Maestro"
45+
uses: ./.github/actions/setup-maestro
46+
47+

.github/workflows/NativePipeline.yml

Lines changed: 32 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,6 @@ jobs:
481481
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
482482
with:
483483
fetch-depth: 0
484-
- name: "Setup Node and dependencies"
485-
uses: ./.github/actions/setup-node-with-cache
486484
- name: "Download project MDA file"
487485
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
488486
with:
@@ -521,29 +519,11 @@ jobs:
521519
with:
522520
name: android-app
523521
path: android-app
524-
- name: "Setup Python"
525-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
526-
with:
527-
python-version: '3.x'
528-
cache: 'pip'
529-
- name: "Install Python dependencies"
530-
run: pip install PyYAML httplib2
531-
- name: "Cache Mendix runtime"
532-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4
533-
with:
534-
path: tmp/runtime.tar.gz
535-
key: mendix-runtime-${{ needs.mendix-version.outputs.mendix_version }}
536-
- name: "Cache m2ee-tools"
537-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4
538-
with:
539-
path: tmp/m2ee
540-
key: m2ee-tools-v1
541-
- name: "Setup Java 21"
542-
id: setup-java
543-
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 #v4
522+
- name: "Setup needed tools"
523+
id: setup-needed-tools
524+
uses: ./.github/actions/setup-tools
544525
with:
545-
distribution: "temurin"
546-
java-version: "21"
526+
mendix_version: ${{ needs.mendix-version.outputs.mendix_version }}
547527

548528
- name: "Start runtime with retry"
549529
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 #v3.0.2
@@ -552,15 +532,7 @@ jobs:
552532
max_attempts: 3
553533
command: |
554534
chmod +x .github/scripts/start-runtime-with-verification.sh
555-
.github/scripts/start-runtime-with-verification.sh automation.mda ${{ needs.mendix-version.outputs.mendix_version }} "${{ steps.setup-java.outputs.path }}" "${{ github.workspace }}"
556-
557-
- name: "Install Maestro"
558-
uses: ./.github/actions/setup-maestro
559-
- name: Verify maestro
560-
run: $HOME/.local/bin/maestro/bin/maestro --version
561-
- name: Set up Android SDK
562-
run: echo "ANDROID_HOME=$ANDROID_SDK_ROOT" >> $GITHUB_ENV
563-
535+
.github/scripts/start-runtime-with-verification.sh automation.mda ${{ needs.mendix-version.outputs.mendix_version }} "${{ steps.setup-needed-tools.outputs.java-path }}" "${{ github.workspace }}"
564536
- name: Enable KVM
565537
run: |
566538
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
@@ -618,15 +590,11 @@ jobs:
618590
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
619591
with:
620592
fetch-depth: 0
621-
- name: "Setup Node and dependencies"
622-
uses: ./.github/actions/setup-node-with-cache
623-
624593
- name: "Download project MDA file"
625594
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
626595
with:
627596
name: mda
628597

629-
630598
# USED ONLY FOR TESTING PURPOSE - TO SKIP APP BUILD PART AND DOWNLOAD APP FROM SPECIFIC RUN
631599
# - name: "Install GitHub CLI"
632600
# run: |
@@ -651,57 +619,27 @@ jobs:
651619
# curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -o ios-app.zip "$artifacts_url"
652620
# unzip ios-app.zip -d ios-app
653621

654-
- name: "Setup Python"
655-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
622+
- name: "Download iOS app"
623+
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
656624
with:
657-
python-version: '3.x'
658-
cache: 'pip'
659-
- name: "Install Python dependencies"
660-
run: pip install PyYAML httplib2
661-
662-
- name: "Cache Mendix runtime"
663-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4
664-
with:
665-
path: tmp/runtime.tar.gz
666-
key: mendix-runtime-${{ needs.mendix-version.outputs.mendix_version }}
667-
- name: "Cache m2ee-tools"
668-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4
669-
with:
670-
path: tmp/m2ee
671-
key: m2ee-tools-v1
672-
- name: "Cache pip"
673-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4
674-
with:
675-
path: ~/.cache/pip
676-
key: ${{ runner.os }}-pip-pyaml-httplib2
677-
- name: "Setup Java 21"
678-
id: setup-java
679-
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 #v4
625+
name: ios-app
626+
path: ios-app
627+
- name: "Setup needed tools"
628+
id: setup-needed-tools
629+
uses: ./.github/actions/setup-tools
680630
with:
681-
distribution: "temurin"
682-
java-version: "21"
683-
631+
mendix_version: ${{ needs.mendix-version.outputs.mendix_version }}
684632
- name: "Start runtime with retry"
685633
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 #v3.0.2
686634
with:
687635
timeout_minutes: 10
688636
max_attempts: 3
689637
command: |
690638
chmod +x .github/scripts/start-runtime-with-verification.sh
691-
.github/scripts/start-runtime-with-verification.sh automation.mda ${{ needs.mendix-version.outputs.mendix_version }} "${{ steps.setup-java.outputs.path }}" "${{ github.workspace }}"
692-
693-
- name: "Download iOS app"
694-
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
695-
with:
696-
name: ios-app
697-
path: ios-app
639+
.github/scripts/start-runtime-with-verification.sh automation.mda ${{ needs.mendix-version.outputs.mendix_version }} "${{ steps.setup-needed-tools.outputs.java-path }}" "${{ github.workspace }}"
640+
698641
- name: "Setup Xcode CLI Tools"
699642
uses: ./.github/actions/setup-xcode-cli-tools
700-
- name: "Install Maestro"
701-
uses: ./.github/actions/setup-maestro
702-
- name: "Verify maestro"
703-
run: $HOME/.local/bin/maestro/bin/maestro --version
704-
705643
- name: "Run iOS tests"
706644
run: |
707645
chmod +x maestro/helpers/prepare_ios.sh
@@ -741,8 +679,6 @@ jobs:
741679
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
742680
with:
743681
fetch-depth: 0
744-
- name: "Setup Node and dependencies"
745-
uses: ./.github/actions/setup-node-with-cache
746682
- name: "Download project MDA file"
747683
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
748684
with:
@@ -752,46 +688,19 @@ jobs:
752688
with:
753689
name: android-app
754690
path: android-app
755-
- name: "Setup Python and dependencies"
756-
run: |
757-
sudo apt-get update
758-
sudo apt-get install -y python3 python3-pip
759-
pip3 install PyYAML httplib2
760-
761-
- name: "Cache Mendix runtime"
762-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4
763-
with:
764-
path: tmp/runtime.tar.gz
765-
key: mendix-runtime-${{ needs.mendix-version.outputs.mendix_version }}
766-
- name: "Cache m2ee-tools"
767-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4
768-
with:
769-
path: tmp/m2ee
770-
key: m2ee-tools-v1
771-
- name: "Cache pip"
772-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4
773-
with:
774-
path: ~/.cache/pip
775-
key: ${{ runner.os }}-pip-pyaml-httplib2
776-
- name: "Setup Java 21"
777-
id: setup-java
778-
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 #v4
691+
- name: "Setup needed tools"
692+
id: setup-needed-tools
693+
uses: ./.github/actions/setup-tools
779694
with:
780-
distribution: "temurin"
781-
java-version: "21"
695+
mendix_version: ${{ needs.mendix-version.outputs.mendix_version }}
782696
- name: "Start runtime with retry"
783697
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 #v3.0.2
784698
with:
785699
timeout_minutes: 10
786700
max_attempts: 3
787701
command: |
788702
chmod +x .github/scripts/start-runtime-with-verification.sh
789-
.github/scripts/start-runtime-with-verification.sh automation.mda ${{ needs.mendix-version.outputs.mendix_version }} "${{ steps.setup-java.outputs.path }}" "${{ github.workspace }}"
790-
791-
- name: "Install Maestro"
792-
uses: ./.github/actions/setup-maestro
793-
- name: Verify maestro
794-
run: $HOME/.local/bin/maestro/bin/maestro --version
703+
.github/scripts/start-runtime-with-verification.sh automation.mda ${{ needs.mendix-version.outputs.mendix_version }} "${{ steps.setup-needed-tools.outputs.java-path }}" "${{ github.workspace }}"
795704
- name: Enable KVM
796705
run: |
797706
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
@@ -844,64 +753,31 @@ jobs:
844753
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
845754
with:
846755
fetch-depth: 0
847-
- name: "Setup Node and dependencies"
848-
uses: ./.github/actions/setup-node-with-cache
849756
- name: "Download project MDA file"
850757
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
851758
with:
852759
name: mda
853-
- name: "Setup Python"
854-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
855-
with:
856-
python-version: '3.x'
857-
cache: 'pip'
858-
- name: "Install Python dependencies"
859-
run: pip install PyYAML httplib2
860-
- name: "Cache Mendix runtime"
861-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4
862-
with:
863-
path: tmp/runtime.tar.gz
864-
key: mendix-runtime-${{ needs.mendix-version.outputs.mendix_version }}
865-
- name: "Cache m2ee-tools"
866-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4
867-
with:
868-
path: tmp/m2ee
869-
key: m2ee-tools-v1
870-
- name: "Cache pip"
871-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4
872-
with:
873-
path: ~/.cache/pip
874-
key: ${{ runner.os }}-pip-pyaml-httplib2
875-
- name: "Setup Java 21"
876-
id: setup-java
877-
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 #v4
760+
- name: "Download iOS app"
761+
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
878762
with:
879-
distribution: "temurin"
880-
java-version: "21"
881-
763+
name: ios-app
764+
path: ios-app
765+
- name: "Setup needed tools"
766+
id: setup-needed-tools
767+
uses: ./.github/actions/setup-tools
768+
with:
769+
mendix_version: ${{ needs.mendix-version.outputs.mendix_version }}
882770
- name: "Start runtime with retry"
883771
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 #v3.0.2
884772
with:
885773
timeout_minutes: 10
886774
max_attempts: 3
887775
command: |
888776
chmod +x .github/scripts/start-runtime-with-verification.sh
889-
.github/scripts/start-runtime-with-verification.sh automation.mda ${{ needs.mendix-version.outputs.mendix_version }} "${{ steps.setup-java.outputs.path }}" "${{ github.workspace }}"
777+
.github/scripts/start-runtime-with-verification.sh automation.mda ${{ needs.mendix-version.outputs.mendix_version }} "${{ steps.setup-needed-tools.outputs.java-path }}" "${{ github.workspace }}"
890778
891779
- name: "Setup Xcode CLI Tools"
892780
uses: ./.github/actions/setup-xcode-cli-tools
893-
- name: "Install Maestro"
894-
uses: ./.github/actions/setup-maestro
895-
- name: Verify maestro
896-
run: $HOME/.local/bin/maestro/bin/maestro --version
897-
898-
- name: "Download iOS app"
899-
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
900-
with:
901-
name: ios-app
902-
path: ios-app
903-
- name: Check iOS App Path
904-
run: ls ios-app
905781
- name: "Run iOS tests"
906782
run: |
907783
chmod +x maestro/helpers/prepare_ios.sh
@@ -968,15 +844,9 @@ jobs:
968844
gh run download ${{ github.run_id }} --name ios-screenshots-js-actions --dir images/actual/ios/ || true
969845
ls -l images/actual/ios/
970846
971-
- name: "Set up node"
972-
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
973-
with:
974-
node-version-file: .nvmrc
975-
cache: yarn
847+
- name: "Setup Node and dependencies"
848+
uses: ./.github/actions/setup-node-with-cache
976849

977-
- name: "Install dependencies"
978-
run: yarn install
979-
980850
- name: "Compare Android screenshots"
981851
continue-on-error: true
982852
run: node ${{ github.workspace }}/maestro/helpers/compare_screenshots.js android

0 commit comments

Comments
 (0)