Skip to content

Commit 5782004

Browse files
committed
Cache tool setup to save resources
1 parent b47e79a commit 5782004

4 files changed

Lines changed: 77 additions & 43 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: 'Setup Maestro'
2+
description: 'Install and cache Maestro'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: "Cache Maestro"
7+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
8+
with:
9+
path: $HOME/.local/bin/maestro
10+
key: maestro-${{ runner.os }}-v1
11+
12+
- name: "Install Maestro"
13+
shell: bash
14+
run: |
15+
if [ ! -f "$HOME/.local/bin/maestro/bin/maestro" ]; then
16+
mkdir -p $HOME/.local/bin
17+
curl -L "https://github.com/mobile-dev-inc/maestro/releases/latest/download/maestro.zip" -o maestro.zip
18+
unzip maestro.zip -d $HOME/.local/bin
19+
chmod +x $HOME/.local/bin/maestro/bin/maestro
20+
fi
21+
echo "$HOME/.local/bin" >> $GITHUB_PATH
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: 'Setup Node with Cached Dependencies'
2+
description: 'Set up Node.js and install dependencies with caching'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: "Set up node"
7+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
8+
with:
9+
node-version-file: .nvmrc
10+
cache: yarn
11+
12+
- name: "Cache yarn dependencies"
13+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
14+
with:
15+
path: |
16+
.yarn/cache
17+
.yarn/unplugged
18+
.yarn/install-state.gz
19+
node_modules
20+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}
21+
restore-keys: |
22+
${{ runner.os }}-yarn-
23+
24+
- name: "Install dependencies"
25+
shell: bash
26+
run: |
27+
if [ ! -d "node_modules" ]; then
28+
yarn install --immutable
29+
else
30+
echo "Dependencies already installed from cache"
31+
fi
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: "Setup Xcode CLI Tools"
2+
description: "Ensure Xcode CLI tools are configured"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: "Verify and set Xcode CLI tools"
7+
shell: bash
8+
run: |
9+
if ! xcode-select --print-path; then
10+
echo "Xcode CLI tools not set. Setting them now."
11+
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
12+
else
13+
echo "Xcode CLI tools are already configured."
14+
fi

.github/workflows/NativePipeline.yml

Lines changed: 11 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ jobs:
465465
runs-on: ubuntu-22.04
466466
timeout-minutes: 60
467467
strategy:
468-
max-parallel: 10
468+
max-parallel: 5
469469
matrix:
470470
widget: ${{ fromJson(needs.scope.outputs.widgets) }}
471471
fail-fast: false
@@ -474,13 +474,8 @@ jobs:
474474
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
475475
with:
476476
fetch-depth: 0
477-
- name: "Set up node"
478-
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
479-
with:
480-
node-version-file: .nvmrc
481-
cache: yarn
482-
- name: "Install dependencies"
483-
run: yarn install --immutable
477+
- name: "Setup Node and dependencies"
478+
uses: ./.github/actions/setup-node-with-cache
484479
- name: "Download project MDA file"
485480
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
486481
with:
@@ -527,12 +522,7 @@ jobs:
527522
mendix-version: ${{ needs.mendix-version.outputs.mendix_version }}
528523

529524
- name: "Install Maestro"
530-
run: |
531-
mkdir -p $HOME/.local/bin
532-
curl -L "https://github.com/mobile-dev-inc/maestro/releases/latest/download/maestro.zip" -o maestro.zip
533-
unzip maestro.zip -d $HOME/.local/bin
534-
chmod +x $HOME/.local/bin/maestro/bin/maestro
535-
echo "$HOME/.local/bin" >> $GITHUB_PATH
525+
uses: ./.github/actions/setup-maestro
536526
- name: Verify maestro
537527
run: $HOME/.local/bin/maestro/bin/maestro --version
538528
- name: Set up Android SDK
@@ -586,7 +576,7 @@ jobs:
586576
runs-on: macos-15
587577
timeout-minutes: 60
588578
strategy:
589-
max-parallel: 10
579+
max-parallel: 5
590580
matrix:
591581
widget: ${{ fromJson(needs.scope.outputs.widgets) }}
592582
fail-fast: false
@@ -595,15 +585,9 @@ jobs:
595585
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
596586
with:
597587
fetch-depth: 0
598-
- name: "Set up node"
599-
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
600-
with:
601-
node-version-file: .nvmrc
602-
cache: yarn
603-
- name: "Install dependencies"
604-
run: |
605-
yarn cache clean
606-
yarn install --immutable
588+
- name: "Setup Node and dependencies"
589+
uses: ./.github/actions/setup-node-with-cache
590+
607591
- name: "Download project MDA file"
608592
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
609593
with:
@@ -645,29 +629,13 @@ jobs:
645629
with:
646630
name: ios-app
647631
path: ios-app
648-
- name: Check iOS App Path
649-
run: ls ios-app
632+
- name: "Setup Xcode CLI Tools"
633+
uses: ./.github/actions/setup-xcode-cli-tools
650634

651-
- name: "Verify Xcode CLI Tools"
652-
run: |
653-
if ! xcode-select --print-path; then
654-
echo "Xcode CLI tools not set. Setting them now."
655-
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
656-
else
657-
echo "Xcode CLI tools are already configured."
658-
fi
659-
660635
- name: "Install Maestro"
661-
run: |
662-
mkdir -p $HOME/.local/bin
663-
curl -L "https://github.com/mobile-dev-inc/maestro/releases/latest/download/maestro.zip" -o maestro.zip
664-
unzip maestro.zip -d $HOME/.local/bin
665-
chmod +x $HOME/.local/bin/maestro/bin/maestro
666-
echo "$HOME/.local/bin" >> $GITHUB_PATH
636+
uses: ./.github/actions/setup-maestro
667637
- name: "Verify maestro"
668638
run: $HOME/.local/bin/maestro/bin/maestro --version
669-
- name: "List Available Simulators"
670-
run: xcrun simctl list devices
671639

672640
- name: "Run iOS tests"
673641
run: |

0 commit comments

Comments
 (0)