-
-
Notifications
You must be signed in to change notification settings - Fork 104
194 lines (170 loc) · 7.11 KB
/
Copy pathcoredev-robot-tests.yml
File metadata and controls
194 lines (170 loc) · 7.11 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
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
name: Robot Tests (Coredev)
# Trigger commands (PR comments):
# /run-coredev-robottests -> tests against the buildout.coredev default branch
# /run-coredev-6.3-robottests -> tests against an explicit coredev branch (6.1, 6.2, 6.3, ...)
on:
issue_comment:
types: [created]
jobs:
create-check:
if: >
github.event.issue.pull_request &&
contains(github.event.comment.body, '/run-coredev') &&
contains(github.event.comment.body, '-robottests')
runs-on: ubuntu-latest
outputs:
matched: ${{ steps.create.outputs.matched }}
coredev_branch: ${{ steps.create.outputs.coredev_branch }}
check_run_id: ${{ steps.create.outputs.check_run_id }}
sha: ${{ steps.create.outputs.sha }}
steps:
- name: Parse command, get PR SHA and create Check Run
id: create
uses: actions/github-script@v9
with:
script: |
const body = context.payload.comment.body;
// "/run-coredev-robottests" or "/run-coredev-<major.minor>-robottests"
const match = body.match(/\/run-coredev(?:-([0-9]+\.[0-9]+))?-robottests/);
if (!match) {
core.setOutput('matched', 'false');
core.notice(`Comment matched the coarse filter but not the command syntax.`);
return;
}
const coredevBranch = match[1] || '';
core.setOutput('matched', 'true');
core.setOutput('coredev_branch', coredevBranch);
if (coredevBranch) {
try {
await github.rest.repos.getBranch({
owner: 'plone',
repo: 'buildout.coredev',
branch: coredevBranch,
});
} catch (e) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `:x: Branch \`${coredevBranch}\` does not exist on plone/buildout.coredev.`,
});
core.setFailed(`Unknown coredev branch: ${coredevBranch}`);
return;
}
}
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
});
const sha = pr.data.head.sha;
const checkName = coredevBranch
? `Coredev robot tests (${coredevBranch})`
: 'Coredev robot tests';
const check = await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
name: checkName,
head_sha: sha,
status: 'in_progress',
details_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
});
core.setOutput('sha', sha);
core.setOutput('check_run_id', String(check.data.id));
robot-tests:
needs: create-check
if: needs.create-check.outputs.matched == 'true'
name: Coredev robot tests ${{ needs.create-check.outputs.coredev_branch }}
runs-on: ubuntu-latest
env:
PYTHONWARNINGS: ignore
GIT_CLONE_DEPTH: 1
zope_i18n_compile_mo_files: 'true'
ROBOTSUITE_LOGLEVEL: ERROR
ROBOTSUITE_PREFIX: ONLYROBOT
NODE_OPTIONS: "--max_old_space_size=8192"
steps:
- name: Acknowledge command
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ github.event.comment.id }}
reactions: '+1'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Info
run: |
echo "Workflow triggered by comment on PR #${{ github.event.issue.number }}"
echo "buildout.coredev branch: '${{ needs.create-check.outputs.coredev_branch }}' (empty = default branch)"
- name: locale
# needed for CMFPlone testUnicodeSplitter test on Ubuntu
run: |
sudo locale-gen nl_NL@euro
sudo update-locale
# ── 1. Checkout repositories ─────────────────────────────────────────────
- name: Checkout mockup PR
uses: actions/checkout@v4
with:
ref: ${{ needs.create-check.outputs.sha }}
- name: Checkout buildout.coredev
uses: actions/checkout@v4
with:
repository: plone/buildout.coredev
ref: ${{ needs.create-check.outputs.coredev_branch }}
path: tests
# ── 2. Node.js setup ──────────────────────────────────────────────────────
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: pnpm
- name: Install pnpm dependencies
run: pnpm install
# ── 3. Python / make install ─────────────────────────────────────────────
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: tests/requirements.txt
- name: Mark plone.staticresources as source checkout
run: |
echo " plone.staticresources" >> tests/checkouts.cfg
- name: Install (checks out plone.staticresources via mxdev)
working-directory: tests
run: make install
# ── 2b. Build mockup bundle into tests/src/plone.staticresources ─────────
- name: Build mockup for tests (webpack)
run: pnpm build:webpack:tests
# ── 4. Install Playwright / rfbrowser ────────────────────────────────────
- name: install rfbrowser
working-directory: tests
run: .venv/bin/rfbrowser init chromium
- name: Run Coredev robot tests
working-directory: tests
run: ROBOTSUITE_PREFIX=ONLYROBOT TEST_ARGS="--all -t ONLYROBOT" make test
- name: Upload robot test results
if: always()
uses: actions/upload-artifact@v4
with:
name: robot-results-${{ needs.create-check.outputs.coredev_branch || 'default' }}
path: |
tests/test_*
tests/robot_*
if-no-files-found: ignore
update-check:
needs: [create-check, robot-tests]
if: always() && needs.create-check.outputs.check_run_id
runs-on: ubuntu-latest
steps:
- name: Update Check Run
uses: actions/github-script@v9
with:
script: |
await github.rest.checks.update({
owner: context.repo.owner,
repo: context.repo.repo,
check_run_id: ${{ needs.create-check.outputs.check_run_id }},
status: 'completed',
conclusion: '${{ needs.robot-tests.result }}',
});