-
Notifications
You must be signed in to change notification settings - Fork 392
164 lines (154 loc) · 6.26 KB
/
ios-end-to-end-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
---
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:
inputs:
# Optionally specify a test case or suite to run.
# Must be in the format MullvadVPNUITest/<test-suite-name>/<test-case-name> where test case name is optional.
test_name:
description: 'Only run test case/suite'
required: false
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 * * *'
env:
TEST_DEVICE_UDID: 00008130-0019181022F3803A
jobs:
generate-derived-data-cache-uuid:
if: github.event.pull_request.merged || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'
name: Generate derived data cache UUID
runs-on: [self-hosted, macOS, ios-test]
outputs:
uuid: ${{ steps.generate-uuid.outputs.uuid }}
steps:
- name: Generate cache key for derived data
id: generate-uuid
shell: bash
run: echo "::set-output name=uuid::$(uuidgen)"
determine-test-plan-to-use:
if: github.event.pull_request.merged || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'
name: Determine test plan to use
runs-on: [self-hosted, macOS, ios-test]
outputs:
test_plan: ${{ steps.determine-test-plan.outputs.test_plan }}
steps:
- name: Select test plan to execute
id: determine-test-plan
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "::set-output name=test_plan::MullvadVPNUITestsSmoke"
elif [[ "${{ github.event_name }}" == "schedule" ]]; then
echo "::set-output name=test_plan::MullvadVPNUITestsAll"
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "::set-output name=test_plan::MullvadVPNUITestsAll"
fi
build:
if: github.event.pull_request.merged || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'
name: Build for end to end tests
runs-on: [self-hosted, macOS, ios-test]
needs: determine-test-plan-to-use
timeout-minutes: 20
env:
XCODE_TEST_PLAN: ${{ needs.determine-test-plan-to-use.outputs.test_plan }}
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
with:
clean: true
- 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: Build iOS end to end tests action
uses: ./.github/actions/build-ios-e2e-tests
with:
xcode_test_plan: ${{ env.XCODE_TEST_PLAN }}
test_name: ${{ github.event.inputs.test_name }}
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: ${{ env.TEST_DEVICE_UDID }}
partner_api_token: ${{ secrets.STAGEMOLE_PARTNER_AUTH }}
# - name: Store derived data in cache
# id: store-derived-data-cache
# uses: actions/cache/save@v4
# with:
# path: ios/derived-data
# key: ${{ env.DERIVED_DATA_CACHE_KEY }}
test:
if: github.event.pull_request.merged || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'
name: Run tests
runs-on: [self-hosted, macOS, ios-test]
needs: [build, determine-test-plan-to-use]
timeout-minutes: 60
env:
XCODE_TEST_PLAN: ${{ needs.determine-test-plan-to-use.outputs.test_plan }}
steps:
# - name: Restore derived data cache
# uses: actions/cache/restore@v4
# with:
# path: ios/derived-data
# key: ${{ env.DERIVED_DATA_CACHE_KEY }}
- name: Uninstall app
run: ios-deploy --id $IOS_TEST_DEVICE_UDID --uninstall_only --bundle_id net.mullvad.MullvadVPN
shell: bash
env:
IOS_TEST_DEVICE_UDID: ${{ env.TEST_DEVICE_UDID }}
- name: Run iOS end to end tests action
uses: ./.github/actions/run-ios-e2e-tests
with:
test_name: "MullvadVPNUITests/AccountTests"
xcode_test_plan: ${{ needs.determine-test-plan-to-use.outputs.test_plan }}
# - 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-results
# path: |
# ios/junit-test-report/junit.xml
# ios/xcode-test-report.xcresult
#