iOS end-to-end tests #468
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: iOS end-to-end tests | |
permissions: | |
contents: read | |
issues: write | |
pull-requests: write | |
on: | |
pull_request: | |
types: | |
- closed | |
branches: | |
- main | |
paths: | |
- .github/workflows/ios-end-to-end-tests.yml | |
- ios/** | |
workflow_dispatch: | |
schedule: | |
# At midnight every day. | |
# Notifications for scheduled workflows are sent to the user who last modified the cron | |
# syntax in the workflow file. If you update this you must have notifications for | |
# Github Actions enabled, so these don't go unnoticed. | |
# https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/notifications-for-workflow-runs | |
- cron: '0 0 * * *' | |
jobs: | |
test: | |
if: github.event.pull_request.merged || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' | |
name: End to end tests | |
runs-on: [self-hosted, macOS, ios-test] | |
steps: | |
- name: Configure Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
target: aarch64-apple-ios | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Select test plan to execute | |
run: | | |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
echo "XCODE_TEST_PLAN=MullvadVPNUITestsSmoke" >> $GITHUB_ENV | |
elif [[ "${{ github.event_name }}" == "schedule" ]]; then | |
echo "XCODE_TEST_PLAN=MullvadVPNUITestsAll" >> $GITHUB_ENV | |
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
echo "XCODE_TEST_PLAN=MullvadVPNUITestsAll" >> $GITHUB_ENV | |
fi | |
- name: iOS end to end tests action | |
uses: ./.github/actions/ios-end-to-end-tests | |
with: | |
xcode_test_plan: ${{ env.XCODE_TEST_PLAN }} | |
ios_device_pin_code: ${{ secrets.IOS_DEVICE_PIN_CODE }} | |
test_device_identifier_uuid: ${{ secrets.IOS_TEST_DEVICE_IDENTIFIER_UUID }} | |
has_time_account_number: ${{ secrets.IOS_HAS_TIME_ACCOUNT_NUMBER_PRODUCTION }} | |
no_time_account_number: ${{ secrets.IOS_NO_TIME_ACCOUNT_NUMBER_PRODUCTION }} | |
test_device_udid: ${{ secrets.IOS_TEST_DEVICE_UDID }} | |
- name: Comment PR on test failure | |
if: failure() && github.event_name == 'pull_request' | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const issue_number = context.issue.number; | |
const run_id = context.runId; | |
const run_url = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${run_id}`; | |
github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: issue_number, | |
body: `🚨 End to end tests failed. Please check the [failed workflow run](${run_url}).` | |
}); | |
- name: Store test report artifact | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-report | |
path: ios/test-report/junit.xml |