|
1 | 1 | name: Build |
2 | 2 |
|
| 3 | +permissions: |
| 4 | + contents: read |
| 5 | + |
3 | 6 | env: |
4 | 7 | NX_BRANCH: ${{ github.event.number || github.ref_name }} |
5 | 8 | NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} |
6 | 9 |
|
| 10 | + # --- Customize the test environment here --- |
| 11 | + NODE_VERSION: lts/* |
| 12 | + TEST_PROJECT: nativescript-demo-ng |
| 13 | + # NativeScript CLI (provides the `ns` binary the nx test executor spawns) |
| 14 | + NS_CLI_VERSION: latest |
| 15 | + # iOS (runner label is set on the job's `runs-on`, it can't read env) |
| 16 | + XCODE_VERSION: "^16.0" |
| 17 | + # Android |
| 18 | + JAVA_VERSION: "21" |
| 19 | + ANDROID_API: "34" |
| 20 | + ANDROID_ABI: x86_64 |
| 21 | + ANDROID_TARGET: google_apis |
| 22 | + EMULATOR_NAME: ns-emu |
| 23 | + |
7 | 24 | on: |
8 | 25 | push: |
9 | 26 | branches: ["main"] |
|
29 | 46 | run: npm install --force |
30 | 47 | - name: Build.all affected |
31 | 48 | run: npx nx affected --target=build,test --exclude nativescript-demo-ng |
| 49 | + |
| 50 | + test-ios: |
| 51 | + name: Test (iOS) |
| 52 | + runs-on: macos-15 |
| 53 | + steps: |
| 54 | + - name: Setup Xcode |
| 55 | + uses: maxim-lobanov/setup-xcode@v1 |
| 56 | + with: |
| 57 | + xcode-version: ${{ env.XCODE_VERSION }} |
| 58 | + - name: Checkout |
| 59 | + uses: actions/checkout@v6 |
| 60 | + with: |
| 61 | + fetch-depth: 0 |
| 62 | + - uses: actions/setup-node@v6 |
| 63 | + with: |
| 64 | + node-version: ${{ env.NODE_VERSION }} |
| 65 | + cache: npm |
| 66 | + - uses: nrwl/nx-set-shas@v5 |
| 67 | + - name: npm install |
| 68 | + run: npm install --force |
| 69 | + - name: Install NativeScript CLI |
| 70 | + run: npm install -g nativescript@${{ env.NS_CLI_VERSION }} |
| 71 | + - name: Test on iOS Simulator |
| 72 | + run: npx nx test ${{ env.TEST_PROJECT }} ios --flags="--justlaunch" |
| 73 | + |
| 74 | + test-android: |
| 75 | + name: Test (Android) |
| 76 | + runs-on: ubuntu-latest |
| 77 | + steps: |
| 78 | + - name: Checkout |
| 79 | + uses: actions/checkout@v6 |
| 80 | + with: |
| 81 | + fetch-depth: 0 |
| 82 | + - uses: actions/setup-node@v6 |
| 83 | + with: |
| 84 | + node-version: ${{ env.NODE_VERSION }} |
| 85 | + cache: npm |
| 86 | + - uses: actions/setup-java@v5 |
| 87 | + with: |
| 88 | + distribution: temurin |
| 89 | + java-version: ${{ env.JAVA_VERSION }} |
| 90 | + cache: gradle |
| 91 | + - name: Setup Android SDK |
| 92 | + uses: android-actions/setup-android@v4 |
| 93 | + - uses: nrwl/nx-set-shas@v5 |
| 94 | + - name: npm install |
| 95 | + run: npm install --force |
| 96 | + - name: Install NativeScript CLI |
| 97 | + run: npm install -g nativescript@${{ env.NS_CLI_VERSION }} |
| 98 | + - name: Enable KVM |
| 99 | + run: | |
| 100 | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules |
| 101 | + sudo udevadm control --reload-rules |
| 102 | + sudo udevadm trigger --name-match=kvm |
| 103 | + - name: Test on Android Emulator |
| 104 | + uses: ReactiveCircus/android-emulator-runner@v2 |
| 105 | + with: |
| 106 | + api-level: ${{ env.ANDROID_API }} |
| 107 | + target: ${{ env.ANDROID_TARGET }} |
| 108 | + arch: ${{ env.ANDROID_ABI }} |
| 109 | + avd-name: ${{ env.EMULATOR_NAME }} |
| 110 | + script: npx nx test ${{ env.TEST_PROJECT }} android --flags="--justlaunch" |
0 commit comments