-
-
Notifications
You must be signed in to change notification settings - Fork 2
225 lines (216 loc) · 9.38 KB
/
integration-test.yaml
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: Integration Tests
run-name: Test ${{ inputs.runs-on }} for Mercurial ${{ inputs.hg-version }} on ${{ inputs.environment }}
on:
workflow_call:
inputs:
environment:
description: 'The environment to test'
required: true
type: string
runs-on:
description: 'The runner to use'
required: true
type: string
hg-version:
description: 'The version of hg to test (3 or 6, default 6)'
required: false
default: '6'
type: string
run-dotnet:
description: 'Whether to run dotnet tests'
required: false
default: true
type: boolean
run-playwright:
description: 'Whether to run Playwright tests'
required: false
default: true
type: boolean
workflow_dispatch:
inputs:
environment:
description: 'The environment to test'
required: true
type: string
runs-on:
description: 'The runner to use'
required: true
type: string
hg-version:
description: 'The version of hg to test (3 or 6, default 6)'
required: false
default: '6'
type: string
run-dotnet:
description: 'Whether to run dotnet tests'
required: false
default: true
type: boolean
run-playwright:
description: 'Whether to run Playwright tests'
required: false
default: true
type: boolean
# TODO: Set up caching for /home/runner/.cache/ms-playwright
# TODO: Ditto for /home/runner/.pnpm-store/v3
# TODO: Ditto for /home/runner/.nuget/packages
# TODO: Ditto for /var/cache/apt/archives/
jobs:
dotnet-test:
if: ${{ inputs.run-dotnet }}
timeout-minutes: 120
name: Dotnet tests on ${{ inputs.runs-on }} for Mercurial ${{ inputs.hg-version }} on ${{ inputs.environment }}
permissions:
checks: write
environment:
name: ${{ inputs.environment }}
runs-on: ${{ inputs.runs-on }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: testspace-com/[email protected]
with:
domain: ${{ github.repository_owner }}
- name: Setup self-hosted dependencies
if: ${{ inputs.runs-on == 'self-hosted' }}
run: |
sudo apt-get update
sudo apt-get install -y p7zip-full iputils-ping python3-venv wget zlib1g-dev libssl-dev #needed by setup python
wget -q https://github.com/PowerShell/PowerShell/releases/download/v7.4.1/powershell_7.4.1-1.deb_amd64.deb
sudo dpkg -i powershell_7.4.1-1.deb_amd64.deb
sudo apt-get install -f
rm powershell_7.4.1-1.deb_amd64.deb
pwsh #validate that powershell installed correctly
- uses: actions/setup-dotnet@v4
env:
DOTNET_INSTALL_DIR: ${{ inputs.runs-on == 'self-hosted' && '/opt/hostedtoolcache/dotnet' || '' }} #poor man's conditional
with:
dotnet-version: '8.x'
- uses: MatteoH2O1999/setup-python@429b7dee8a48c31eb72ce0b420ea938ff51c2f11 # v3.2.1
id: python
if: ${{ inputs.runs-on != 'windows-latest' && !env.act && inputs.hg-version == '3' }}
with:
python-version: '2.7.18'
cache-build: true
allow-build: allow
- name: Link python
if: ${{ inputs.runs-on != 'windows-latest' && inputs.hg-version == '3' }}
run: |
sudo ln -s ${{ steps.python.outputs.python-path }} /usr/bin/python2
- name: Dotnet build
# limit cpu count for self-hosted due to memory constraints
run: dotnet build LexBoxOnly.slnf ${{ inputs.runs-on == 'self-hosted' && '-maxcpucount:2' || '' }}
- name: Build for tests
run: "dotnet build LexBoxOnly.slnf /p:MercurialVersion=$MERCURIAL_VERSION"
env:
MERCURIAL_VERSION: ${{ inputs.hg-version }}
- name: Integration tests (.NET)
env:
TEST_SERVER_HOSTNAME: ${{ vars.TEST_SERVER_HOSTNAME }}
# this is not a typo, we need to use the lf domain because it has a cert that hg will validate
TEST_STANDARD_HG_HOSTNAME: ${{ vars.TEST_STANDARD_HG_HOSTNAME }}
TEST_RESUMABLE_HG_HOSTNAME: ${{ vars.TEST_RESUMABLE_HG_HOSTNAME }}
TEST_PROJECT_CODE: 'sena-3'
TEST_DEFAULT_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
# 1.5gb max heap size, must be in hex https://learn.microsoft.com/en-us/dotnet/core/runtime-config/garbage-collector#heap-limit
# the self hosted runner only has 2gb so this should prevent it from running out of memory
DOTNET_GCHeapHardLimit: '0x2CB417800'
run: dotnet test LexBoxOnly.slnf --output ./bin --logger trx --results-directory ./test-results --filter Category=Integration
- name: Flaky Integration tests (.NET)
continue-on-error: true
env:
TEST_SERVER_HOSTNAME: ${{ vars.TEST_SERVER_HOSTNAME }}
# this is not a typo, we need to use the lf domain because it has a cert that hg will validate
TEST_STANDARD_HG_HOSTNAME: ${{ vars.TEST_STANDARD_HG_HOSTNAME }}
TEST_RESUMABLE_HG_HOSTNAME: ${{ vars.TEST_RESUMABLE_HG_HOSTNAME }}
TEST_PROJECT_CODE: 'sena-3'
TEST_DEFAULT_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
# 1.5gb max heap size, must be in hex https://learn.microsoft.com/en-us/dotnet/core/runtime-config/garbage-collector#heap-limit
# the self hosted runner only has 2gb so this should prevent it from running out of memory
DOTNET_GCHeapHardLimit: '0x2CB417800'
run: dotnet test LexBoxOnly.slnf --output ./bin --logger trx --results-directory ./test-results --filter Category=FlakyIntegration
- name: Publish unit test results
uses: EnricoMi/publish-unit-test-result-action/composite@8885e273a4343cd7b48eaa72428dea0c3067ea98 # v2.14.0
if: ${{ always() && !env.act }}
with:
check_name: Integration Tests ${{ inputs.runs-on }} for Mercurial ${{ inputs.hg-version }}
files: ./test-results/*.trx
- name: Publish results to testspace
if: always()
run: testspace "[.Net Integration/${{ inputs.runs-on }} HG ${{ inputs.hg-version }}]./test-results/*.trx"
playwright-test:
if: ${{ inputs.run-playwright }}
timeout-minutes: 120
name: Playwright tests on ${{ inputs.runs-on }} for Mercurial ${{ inputs.hg-version }} on ${{ inputs.environment }}
permissions:
checks: write
environment:
name: ${{ inputs.environment }}
runs-on: ${{ inputs.runs-on }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: testspace-com/[email protected]
with:
domain: ${{ github.repository_owner }}
- name: Setup self-hosted dependencies
if: ${{ inputs.runs-on == 'self-hosted' }}
run: |
sudo apt-get update
sudo apt-get install -y p7zip-full iputils-ping python3-venv wget zlib1g-dev libssl-dev #needed by setup python
wget -q https://github.com/PowerShell/PowerShell/releases/download/v7.4.1/powershell_7.4.1-1.deb_amd64.deb
sudo dpkg -i powershell_7.4.1-1.deb_amd64.deb
sudo apt-get install -f
rm powershell_7.4.1-1.deb_amd64.deb
pwsh #validate that powershell installed correctly
# First we need to setup Node...
- uses: actions/setup-node@v4
with:
node-version-file: 'frontend/package.json'
# Then we can set up pnpm...
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
with:
package_json_file: 'frontend/package.json'
# Then we can have Node set up package caching
- uses: actions/setup-node@v4
with:
node-version-file: 'frontend/package.json'
cache: 'pnpm'
cache-dependency-path: 'frontend/pnpm-lock.yaml'
- name: Playwright setup
working-directory: frontend
run: pnpm install && pnpm pretest
- name: Set up Playwright dependencies
working-directory: frontend
if: ${{ inputs.runs-on == 'self-hosted' }}
run: sudo pnpm exec playwright install-deps
- name: Integration tests (Playwright)
env:
TEST_SERVER_HOSTNAME: ${{ vars.TEST_SERVER_HOSTNAME }}
# this is not a typo, we need to use the lf domain because it has a cert that hg will validate
TEST_STANDARD_HG_HOSTNAME: ${{ vars.TEST_STANDARD_HG_HOSTNAME }}
TEST_RESUMABLE_HG_HOSTNAME: ${{ vars.TEST_RESUMABLE_HG_HOSTNAME }}
TEST_PROJECT_CODE: 'sena-3'
TEST_DEFAULT_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
working-directory: frontend
run: pnpm test
- name: Password protect Playwright traces
id: password_protect_test_results
if: ${{ always() }}
shell: bash
env:
ZIP_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
run: 7z a ./playwright-traces.7z -mx=0 -mmt=off ./frontend/test-results -p"$ZIP_PASSWORD"
- name: Publish results to testspace
if: always()
run: testspace "[Playwright]./frontend/test-results/results.xml"
- name: Upload playwright results
if: ${{ always() && steps.password_protect_test_results.outcome == 'success' }}
uses: actions/upload-artifact@v4
with:
name: playwright-traces-${{ inputs.runs-on }}-hg-${{ inputs.hg-version }}
path: |
./playwright-traces.7z
./frontend/test-results/