-
-
Notifications
You must be signed in to change notification settings - Fork 2
157 lines (156 loc) · 6.36 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
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 3)'
required: false
default: '3'
type: string
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 3)'
required: false
default: '3'
type: string
run-playwright:
description: 'Whether to run Playwright tests'
required: false
default: true
type: boolean
jobs:
test:
timeout-minutes: 120
name: Test ${{ 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@v3
- 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 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@v3
with:
package_json_file: 'frontend/package.json'
# Then we can have Noede 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'
- uses: actions/setup-dotnet@v3
env:
DOTNET_INSTALL_DIR: ${{ inputs.runs-on == 'self-hosted' && '/opt/hostedtoolcache/dotnet' || '' }} #poor man's conditional
with:
dotnet-version: '8.x'
- uses: MatteoH2O1999/[email protected]
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
run: dotnet build
# TODO: Set up caching for /home/runner/.cache/ms-playwright so this doesn't take as long
# TODO: Ditto for /home/runner/.pnpm-store/v3
# TODO: Ditto for /home/runner/.nuget/packages
# TODO: Ditto for /var/cache/apt/archives/
- name: Playwright setup
working-directory: frontend
if: ${{ inputs.run-playwright }}
run: pnpm install && pnpm pretest
- name: Set up Playwright dependencies
working-directory: frontend
if: ${{ inputs.run-playwright && inputs.runs-on == 'self-hosted' }}
run: sudo pnpm exec playwright install-deps
- name: Build for tests
run: "dotnet build /p:MercurialVersion=$MERCURIAL_VERSION"
env:
MERCURIAL_VERSION: ${{ inputs.hg-version }}
- name: Integration tests (Playwright)
if: ${{ inputs.run-playwright }}
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 }}
working-directory: frontend
run: pnpm test
- 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 }}
run: dotnet test --output ./bin --logger trx --results-directory ./test-results --filter Category=Integration
- name: Password protect Playwright traces
id: password_protect_test_results
if: ${{ always() && inputs.run-playwright }}
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: Set up python3-venv
# Needed by publish-unit-test-result-action on ubuntu-22.04
run: sudo apt install -y python3-venv
if: ${{ always() && !env.act && inputs.hg-version == '6' }}
- name: Publish unit test results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: ${{ always() && !env.act }}
with:
check_name: Integration Tests ${{ inputs.runs-on }} for Mercurial ${{ inputs.hg-version }}
files: ./test-results/*.trx
- 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