|
| 1 | +name: Test iOS native test scripts |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - '.github/workflows/scripts-ios-native.yml' |
| 7 | + - 'scripts/setup-workspace.sh' |
| 8 | + - 'scripts/build-ios-port.sh' |
| 9 | + - 'scripts/build-ios-app.sh' |
| 10 | + - 'scripts/run-ios-native-tests.sh' |
| 11 | + - 'scripts/ios/create-shared-scheme.py' |
| 12 | + - 'scripts/ios/notification-tests/native-tests/**' |
| 13 | + - 'scripts/ios/notification-tests/install-native-notification-tests.sh' |
| 14 | + - 'scripts/ios/notification-tests/**' |
| 15 | + - 'scripts/hellocodenameone/**' |
| 16 | + - 'scripts/templates/**' |
| 17 | + - '!scripts/templates/**/*.md' |
| 18 | + - 'CodenameOne/src/**' |
| 19 | + - '!CodenameOne/src/**/*.md' |
| 20 | + - 'Ports/iOSPort/**' |
| 21 | + - '!Ports/iOSPort/**/*.md' |
| 22 | + - 'vm/**' |
| 23 | + - '!vm/**/*.md' |
| 24 | + - 'tests/**' |
| 25 | + - '!tests/**/*.md' |
| 26 | + - '!docs/**' |
| 27 | + - 'maven/**' |
| 28 | + - '!maven/core-unittests/**' |
| 29 | + push: |
| 30 | + branches: [ master ] |
| 31 | + paths: |
| 32 | + - '.github/workflows/scripts-ios-native.yml' |
| 33 | + - 'scripts/setup-workspace.sh' |
| 34 | + - 'scripts/build-ios-port.sh' |
| 35 | + - 'scripts/build-ios-app.sh' |
| 36 | + - 'scripts/run-ios-native-tests.sh' |
| 37 | + - 'scripts/ios/create-shared-scheme.py' |
| 38 | + - 'scripts/ios/notification-tests/native-tests/**' |
| 39 | + - 'scripts/ios/notification-tests/install-native-notification-tests.sh' |
| 40 | + - 'scripts/ios/notification-tests/**' |
| 41 | + - 'scripts/hellocodenameone/**' |
| 42 | + - 'scripts/templates/**' |
| 43 | + - '!scripts/templates/**/*.md' |
| 44 | + - 'CodenameOne/src/**' |
| 45 | + - '!CodenameOne/src/**/*.md' |
| 46 | + - 'Ports/iOSPort/**' |
| 47 | + - '!Ports/iOSPort/**/*.md' |
| 48 | + - 'vm/**' |
| 49 | + - '!vm/**/*.md' |
| 50 | + - 'tests/**' |
| 51 | + - '!tests/**/*.md' |
| 52 | + - '!docs/**' |
| 53 | + - 'maven/**' |
| 54 | + - '!maven/core-unittests/**' |
| 55 | + |
| 56 | +jobs: |
| 57 | + native-ios: |
| 58 | + permissions: |
| 59 | + contents: read |
| 60 | + runs-on: macos-15 |
| 61 | + timeout-minutes: 65 |
| 62 | + concurrency: |
| 63 | + group: mac-ci-${{ github.workflow }}-${{ github.ref_name }} |
| 64 | + cancel-in-progress: true |
| 65 | + |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@v4 |
| 68 | + |
| 69 | + - name: Ensure CocoaPods tooling |
| 70 | + run: | |
| 71 | + mkdir -p ~/.codenameone |
| 72 | + cp maven/UpdateCodenameOne.jar ~/.codenameone/ |
| 73 | + set -euo pipefail |
| 74 | + if ! command -v ruby >/dev/null; then |
| 75 | + echo "ruby not found"; exit 1 |
| 76 | + fi |
| 77 | + GEM_USER_DIR="$(ruby -e 'print Gem.user_dir')" |
| 78 | + export PATH="$GEM_USER_DIR/bin:$PATH" |
| 79 | + gem install cocoapods xcodeproj --no-document --user-install |
| 80 | + pod --version |
| 81 | +
|
| 82 | + - name: Compute setup-workspace hash |
| 83 | + id: setup_hash |
| 84 | + run: | |
| 85 | + set -euo pipefail |
| 86 | + echo "hash=$(shasum -a 256 scripts/setup-workspace.sh | awk '{print $1}')" >> "$GITHUB_OUTPUT" |
| 87 | +
|
| 88 | + - name: Set TMPDIR |
| 89 | + run: echo "TMPDIR=${{ runner.temp }}" >> $GITHUB_ENV |
| 90 | + |
| 91 | + - name: Cache codenameone-tools |
| 92 | + uses: actions/cache@v4 |
| 93 | + with: |
| 94 | + path: ${{ runner.temp }}/codenameone-tools |
| 95 | + key: ${{ runner.os }}-cn1-tools-${{ steps.setup_hash.outputs.hash }} |
| 96 | + restore-keys: | |
| 97 | + ${{ runner.os }}-cn1-tools- |
| 98 | +
|
| 99 | + - name: Restore cn1-binaries cache |
| 100 | + uses: actions/cache@v4 |
| 101 | + with: |
| 102 | + path: ../cn1-binaries |
| 103 | + key: cn1-binaries-${{ runner.os }}-${{ steps.setup_hash.outputs.hash }} |
| 104 | + restore-keys: | |
| 105 | + cn1-binaries-${{ runner.os }}- |
| 106 | +
|
| 107 | + - name: Setup workspace |
| 108 | + run: ./scripts/setup-workspace.sh -q -DskipTests |
| 109 | + timeout-minutes: 40 |
| 110 | + |
| 111 | + - name: Build iOS port |
| 112 | + run: ./scripts/build-ios-port.sh -q -DskipTests |
| 113 | + timeout-minutes: 40 |
| 114 | + |
| 115 | + - name: Build sample iOS app |
| 116 | + id: build_ios_app |
| 117 | + env: |
| 118 | + IOS_UISCENE: "false" |
| 119 | + run: ./scripts/build-ios-app.sh -q -DskipTests |
| 120 | + timeout-minutes: 30 |
| 121 | + |
| 122 | + - name: Run native iOS notification tests (XCTest) |
| 123 | + env: |
| 124 | + ARTIFACTS_DIR: ${{ github.workspace }}/artifacts/native-ios-tests |
| 125 | + run: | |
| 126 | + set -euo pipefail |
| 127 | + mkdir -p "${ARTIFACTS_DIR}" |
| 128 | + ./scripts/run-ios-native-tests.sh \ |
| 129 | + "${{ steps.build_ios_app.outputs.workspace }}" \ |
| 130 | + "${{ steps.build_ios_app.outputs.scheme }}" |
| 131 | + timeout-minutes: 25 |
| 132 | + |
| 133 | + - name: Upload native iOS artifacts |
| 134 | + if: always() |
| 135 | + uses: actions/upload-artifact@v4 |
| 136 | + with: |
| 137 | + name: ios-native-tests |
| 138 | + path: artifacts |
| 139 | + if-no-files-found: warn |
| 140 | + retention-days: 14 |
0 commit comments