|
| 1 | +--- |
| 2 | +name: iOS end-to-end tests |
| 3 | +permissions: |
| 4 | + contents: read |
| 5 | + issues: write |
| 6 | + pull-requests: write |
| 7 | +on: |
| 8 | + pull_request: |
| 9 | + types: |
| 10 | + - closed |
| 11 | + branches: |
| 12 | + - main |
| 13 | + workflow_dispatch: |
| 14 | +jobs: |
| 15 | + test: |
| 16 | + if: github.event.pull_request.merged || github.event_name == 'workflow_dispatch' |
| 17 | + name: End to end tests |
| 18 | + runs-on: [self-hosted, macOS, ios-test] |
| 19 | + env: |
| 20 | + IOS_DEVICE_PIN_CODE: ${{ secrets.IOS_DEVICE_PIN_CODE }} |
| 21 | + TEST_DEVICE_IDENTIFIER_UUID: ${{ secrets.IOS_TEST_DEVICE_IDENTIFIER_UUID }} |
| 22 | + TEST_DEVICE_UDID: ${{ secrets.IOS_TEST_DEVICE_UDID }} |
| 23 | + HAS_TIME_ACCOUNT_NUMBER: ${{ secrets.IOS_HAS_TIME_ACCOUNT_NUMBER }} |
| 24 | + NO_TIME_ACCOUNT_NUMBER: ${{ secrets.IOS_NO_TIME_ACCOUNT_NUMBER }} |
| 25 | + steps: |
| 26 | + - name: Checkout repository |
| 27 | + uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - name: Configure Rust |
| 30 | + run: rustup target install aarch64-apple-ios aarch64-apple-ios-sim |
| 31 | + |
| 32 | + - name: Configure Xcode project |
| 33 | + run: | |
| 34 | + for file in *.xcconfig.template ; do cp $file ${file//.template/} ; done |
| 35 | + sed -i "" \ |
| 36 | + "/MULLVAD_IOS_DEVICE_PIN_CODE =/ s/= .*/= $IOS_DEVICE_PIN_CODE/" \ |
| 37 | + UITests.xcconfig |
| 38 | + sed -i "" \ |
| 39 | + "/MULLVAD_TEST_DEVICE_IDENTIFIER_UUID =/ s/= .*/= $TEST_DEVICE_IDENTIFIER_UUID/" \ |
| 40 | + UITests.xcconfig |
| 41 | + sed -i "" \ |
| 42 | + "/MULLVAD_HAS_TIME_ACCOUNT_NUMBER =/ s/= .*/= $HAS_TIME_ACCOUNT_NUMBER/" \ |
| 43 | + UITests.xcconfig |
| 44 | + sed -i "" \ |
| 45 | + "/MULLVAD_NO_TIME_ACCOUNT_NUMBER =/ s/= .*/= $NO_TIME_ACCOUNT_NUMBER/" \ |
| 46 | + UITests.xcconfig |
| 47 | + working-directory: ios/Configurations |
| 48 | + |
| 49 | + - name: Run end-to-end-tests |
| 50 | + run: | |
| 51 | + set -o pipefail && env NSUnbufferedIO=YES xcodebuild \ |
| 52 | + -project MullvadVPN.xcodeproj \ |
| 53 | + -scheme MullvadVPNUITests \ |
| 54 | + -testPlan MullvadVPNUITestsSmoke \ |
| 55 | + -destination "platform=iOS,id=$TEST_DEVICE_UDID" \ |
| 56 | + test 2>&1 | xcbeautify --report junit --report-path test-report |
| 57 | + working-directory: ios/ |
| 58 | + |
| 59 | + - name: Comment PR on test failure |
| 60 | + if: failure() && github.event_name != 'workflow_dispatch' |
| 61 | + uses: actions/github-script@v7 |
| 62 | + with: |
| 63 | + github-token: ${{secrets.GITHUB_TOKEN}} |
| 64 | + script: | |
| 65 | + const issue_number = context.issue.number; |
| 66 | + const run_id = context.runId; |
| 67 | + const run_url = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${run_id}`; |
| 68 | + github.rest.issues.createComment({ |
| 69 | + owner: context.repo.owner, |
| 70 | + repo: context.repo.repo, |
| 71 | + issue_number: issue_number, |
| 72 | + body: `🚨 End to end tests failed. Please check the [failed workflow run](${run_url}).` |
| 73 | + }); |
| 74 | +
|
| 75 | + - name: Store test report artifact |
| 76 | + if: always() |
| 77 | + uses: actions/upload-artifact@v4 |
| 78 | + with: |
| 79 | + name: test-report |
| 80 | + path: ios/test-report/junit.xml |
0 commit comments