Repository navigation
267 lines (260 loc) · 9.9 KB
/
Copy pathxpkgindex-update.yml
File metadata and controls
267 lines (260 loc) · 9.9 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
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
name: xpkgindex-update
on:
schedule:
- cron: "17 2 * * *" # Daily 02:17 UTC (11:17 JST).
pull_request:
paths:
- 'pkgs/**/*.lua'
- 'tests/autoupdate/**'
- '.github/xpkgindex-update.yml'
- '.github/workflows/xpkgindex-update.yml'
workflow_dispatch:
inputs:
package:
description: "Optional namespace:name; empty scans all declared packages"
type: string
required: false
permissions:
contents: read
concurrency:
group: xpkgindex-update-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
PYTHONUTF8: '1'
MCPP_VERSION: '2026.10.1.2'
MCPP_INDEX_MIRROR: GLOBAL
jobs:
scan:
runs-on: ubuntu-latest
timeout-minutes: 45
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: actions/checkout@v4
with:
repository: openxlings/xpkgindex-update
ref: 6c0bee2941e36132bc2ac3d1f7edbef8b5790320
path: .updater
persist-credentials: false
- name: Use the pinned updater source
run: echo "PYTHONPATH=$PWD/.updater/src" >> "$GITHUB_ENV"
- name: All GitHub-direct descriptors are declared; published versions are unchanged
id: coverage
env:
BASE: ${{ github.event.pull_request.base.sha || 'origin/main' }}
run: |
python -m unittest discover -s tests/autoupdate -p 'test_*.py'
python tests/autoupdate/ci.py audit --base "$BASE" --output coverage.json
python tests/autoupdate/ci.py selection --base "$BASE" --output selected-package.txt
echo "package=$(cat selected-package.txt)" >> "$GITHUB_OUTPUT"
- name: Discover and download real upstream candidates
id: scan
continue-on-error: true # The mandatory gate below accepts only the approved source outage.
uses: openxlings/xpkgindex-update@6c0bee2941e36132bc2ac3d1f7edbef8b5790320
with:
mode: check
token: ${{ github.token }}
package: ${{ inputs.package || steps.coverage.outputs.package }}
- name: Reject all scan failures except the approved unavailable source
if: always()
env:
PLAN: ${{ steps.scan.outputs.plan }}
OUTCOME: ${{ steps.scan.outcome }}
run: python tests/autoupdate/source_outage.py scan-gate --plan "$PLAN" --outcome "$OUTCOME"
- name: Plan actual candidate build/run jobs
id: matrix
if: always() && steps.scan.outputs.plan != ''
env:
PLAN: ${{ steps.scan.outputs.plan }}
BASE: ${{ github.event.pull_request.base.sha || 'origin/main' }}
run: |
python tests/autoupdate/ci.py matrix --plan "$PLAN" --base "$BASE" --output matrix.json
echo "matrix=$(cat matrix.json)" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@v4
if: always()
with:
name: xpkgindex-update-build-plan
path: build-plan.json
- uses: actions/upload-artifact@v4
if: always()
with:
name: xpkgindex-update-coverage
path: |
coverage.json
matrix.json
candidate:
name: candidate (${{ matrix.id }} ${{ matrix.candidate }}, ${{ matrix.platform }}, ${{ matrix.toolchain }})
needs: scan
if: >-
always() && !cancelled() &&
(github.event_name == 'pull_request' || github.ref_name != github.event.repository.default_branch) &&
needs.scan.outputs.matrix != '' && needs.scan.outputs.matrix != '{"include": []}'
strategy:
fail-fast: false
max-parallel: 8
matrix: ${{ fromJSON(needs.scan.outputs.matrix) }}
runs-on: ${{ matrix.os }}
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: actions/checkout@v4
with:
repository: openxlings/xpkgindex-update
ref: 6c0bee2941e36132bc2ac3d1f7edbef8b5790320
path: .updater
persist-credentials: false
- uses: actions/download-artifact@v4
with:
name: xpkgindex-update-build-plan
path: .candidate-plan
- name: Use the pinned updater and a standalone consumer
shell: bash
run: |
if [[ "$RUNNER_OS" == Windows ]]; then
echo "PYTHONPATH=$(cygpath -m "$PWD/.updater/src")" >> "$GITHUB_ENV"
echo "CONSUMER=$(cygpath -m "$RUNNER_TEMP/candidate-consumer")" >> "$GITHUB_ENV"
else
echo "PYTHONPATH=$PWD/.updater/src" >> "$GITHUB_ENV"
echo "CONSUMER=$RUNNER_TEMP/candidate-consumer" >> "$GITHUB_ENV"
fi
- name: Append the candidate and prepare its existing consumer test
shell: bash
env:
GH_TOKEN: ${{ github.token }}
PACKAGE: ${{ matrix.id }}
run: |
python -m xpkgindex_update apply --plan .candidate-plan/build-plan.json --package "$PACKAGE"
python tests/autoupdate/ci.py prepare --plan .candidate-plan/build-plan.json --package "$PACKAGE" --output "$CONSUMER"
git diff -- pkgs
- uses: actions/cache/restore@v4
with:
path: |
~/.mcpp/registry
!~/.mcpp/registry/data/xim-pkgindex
!~/.mcpp/registry/data/mcpplibs
key: candidate-${{ runner.os }}-${{ matrix.toolchain }}-${{ env.MCPP_VERSION }}-${{ github.run_id }}
restore-keys: |
mcpp-registry-${{ runner.os }}-${{ matrix.toolchain }}-${{ env.MCPP_VERSION }}-
- name: Install the same mcpp release as index validation
shell: bash
env:
SUFFIX: ${{ matrix.suffix }}
EXT: ${{ matrix.ext }}
run: |
root="mcpp-${MCPP_VERSION}-${SUFFIX}"
archive="$RUNNER_TEMP/$root.$EXT"
curl -fsSL --retry 2 -o "$archive" "https://github.com/mcpp-community/mcpp/releases/download/v${MCPP_VERSION}/$root.$EXT"
if [[ "$EXT" == zip ]]; then
powershell -NoProfile -Command "Expand-Archive -Force -Path '$archive' -DestinationPath '$RUNNER_TEMP'"
else
tar -xzf "$archive" -C "$RUNNER_TEMP"
fi
root="$RUNNER_TEMP/$root"
mkdir -p "$HOME/.mcpp/registry"
cp -a "$root/registry/." "$HOME/.mcpp/registry/"
echo "MCPP_HOME=$HOME/.mcpp" >> "$GITHUB_ENV"
if [[ "$RUNNER_OS" == Windows ]]; then
echo "MCPP=$(cygpath -m "$root/bin/mcpp.exe")" >> "$GITHUB_ENV"
else
echo "MCPP=$root/bin/mcpp" >> "$GITHUB_ENV"
fi
- name: Install macOS ODBC development headers
if: runner.os == 'macOS' && matrix.id == 'compat:nanodbc'
run: brew install libiodbc
- name: Resolve, build and run the actual candidate
shell: bash
env:
TOOLCHAIN: ${{ matrix.toolchain }}
PACKAGE: ${{ matrix.id }}
run: |
"$MCPP" index update
if [[ "$TOOLCHAIN" != default ]]; then
"$MCPP" toolchain install "$TOOLCHAIN"
"$MCPP" toolchain default "$TOOLCHAIN"
fi
cd "$CONSUMER"
"$MCPP" test --verbose 2>&1 | tee candidate.log
- name: The lockfile proves the candidate was selected
shell: bash
env:
PACKAGE: ${{ matrix.id }}
run: python tests/autoupdate/ci.py verify --plan .candidate-plan/build-plan.json --package "$PACKAGE" --consumer "$CONSUMER"
- uses: actions/upload-artifact@v4
if: always()
with:
name: candidate-${{ strategy.job-index }}
path: |
${{ env.CONSUMER }}/candidate.log
${{ env.CONSUMER }}/mcpp.lock
${{ env.CONSUMER }}/mcpp.toml
- name: Collect compiler and linker evidence
if: always()
shell: bash
run: python tests/autoupdate/ci.py diagnostics --consumer "$CONSUMER" --output candidate-diagnostics
- uses: actions/upload-artifact@v4
if: always()
with:
name: candidate-diagnostics-${{ strategy.job-index }}
path: candidate-diagnostics
if-no-files-found: ignore
propose:
# PR validation and dispatches on update branches can never create more PRs.
if: >-
(github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') &&
github.ref_name == github.event.repository.default_branch
needs: scan
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: write
pull-requests: write
actions: write
statuses: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: actions/checkout@v4
with:
repository: openxlings/xpkgindex-update
ref: 6c0bee2941e36132bc2ac3d1f7edbef8b5790320
path: .updater
persist-credentials: false
- uses: actions/download-artifact@v4
with:
name: xpkgindex-update-plan
path: .update-plan
- name: Create bot PRs from the fixed scan plan and dispatch their CI
env:
GH_TOKEN: ${{ github.token }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
export PYTHONPATH="$PWD/.updater/src"
git switch -C "$DEFAULT_BRANCH" "$GITHUB_SHA"
python tests/autoupdate/automation.py propose \
--plan .update-plan/xpkgindex-update-plan.json --output automation-report.json
- uses: actions/upload-artifact@v4
if: always()
with:
name: xpkgindex-update-proposals
path: |
automation-report.json
proposals.json