-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (111 loc) · 3.99 KB
/
Copy pathe2e.yml
File metadata and controls
121 lines (111 loc) · 3.99 KB
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
name: Shared E2E
on:
workflow_call:
inputs:
runner:
description: >-
Runner the jobs run on, as a JSON array of labels. Defaults to the self-hosted runner of the
organisation in Helsinki; pass another array, such as '["ubuntu-latest"]', for a job that
really needs a GitHub-hosted VM.
required: false
type: string
default: '["self-hosted", "helsinki"]'
pnpm_version:
description: pnpm version to install.
required: false
type: string
default: '11.5.2'
node_version_file:
description: Node version file path.
required: false
type: string
default: .nvmrc
pnpm_store_dir:
description: >-
Persistent pnpm store on the self-hosted runner, shared by every repository — the store is
content-addressed, so sharing it is what it is for. Ignored on a GitHub-hosted runner, where the
store dies with the VM and setup-node caches it through GitHub instead.
required: false
type: string
default: /home/gha-runner/pnpm-store
e2e_command:
description: E2E command.
required: false
type: string
default: pnpm test:e2e
playwright_install_deps:
description: >-
Install the Playwright system libraries with apt on every run. Off by default: the self-hosted runner shares
its host with production, and --with-deps needs passwordless sudo and mutates that host at each run. The
libraries are a one-off host setup instead; the browsers themselves persist in the runner cache.
required: false
type: boolean
default: false
secrets:
PACKAGES_READ_TOKEN:
description: Token with read:packages used to install private @davincibot packages.
required: false
permissions:
contents: read
jobs:
e2e:
name: E2E Tests
runs-on: ${{ fromJSON(inputs.runner) }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
with:
version: ${{ inputs.pnpm_version }}
standalone: true
- uses: actions/setup-node@v7
with:
node-version-file: ${{ inputs.node_version_file }}
cache: ${{ runner.environment == 'self-hosted' && '' || 'pnpm' }}
# Le store pnpm survit aux jobs sur la box : le cache réseau de GitHub ferait
# un aller-retour de tarball par run pour un contenu déjà sur le disque. On le
# laisse donc à setup-node uniquement quand le runner est jetable.
- name: Resolve pnpm store
id: store
env:
STORE_ROOT: ${{ inputs.pnpm_store_dir }}
RUNNER_ENVIRONMENT: ${{ runner.environment }}
run: |
set -euo pipefail
if [ "$RUNNER_ENVIRONMENT" != "self-hosted" ]; then
echo "Runner $RUNNER_ENVIRONMENT : store jetable, cache GitHub."
exit 0
fi
mkdir -p "$STORE_ROOT"
echo "dir=${STORE_ROOT}" >> "$GITHUB_OUTPUT"
- name: Install dependencies
env:
NPM_TOKEN: ${{ secrets.PACKAGES_READ_TOKEN }}
STORE_DIR: ${{ steps.store.outputs.dir }}
run: |
set -euo pipefail
args=(install --frozen-lockfile)
if [ -n "${STORE_DIR:-}" ]; then
args+=(--store-dir "$STORE_DIR")
fi
pnpm "${args[@]}"
- name: Install Playwright browsers
env:
WITH_DEPS: ${{ inputs.playwright_install_deps }}
run: |
if [ "$WITH_DEPS" = "true" ]; then
pnpm exec playwright install --with-deps
else
pnpm exec playwright install
fi
- name: Run e2e tests
run: ${{ inputs.e2e_command }}
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v7
with:
name: playwright-report
path: |
playwright-report/
test-results/
if-no-files-found: ignore