-
-
Notifications
You must be signed in to change notification settings - Fork 52
157 lines (141 loc) · 4.82 KB
/
test_corpus.yaml
File metadata and controls
157 lines (141 loc) · 4.82 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
name: Minify Corpus
on:
workflow_dispatch:
inputs:
ref:
description: 'Git ref to test'
required: true
default: 'main'
type: string
base-ref:
type: string
description: 'Git ref to compare against'
required: true
default: '2.10.0'
regenerate-results:
type: boolean
description: 'Regenerate results'
required: true
default: false
workflow_call:
inputs:
ref:
description: 'Git ref to test'
required: true
type: string
base-ref:
type: string
description: 'Git ref to compare against'
required: true
regenerate-results:
type: boolean
description: 'Regenerate results'
required: false
default: false
permissions:
contents: read
jobs:
generate_results:
name: Minify Corpus
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
python: ["2.7", "3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
ref: ["${{ inputs.ref }}", "${{ inputs.base-ref }}"]
steps:
- name: Clear workspace
run: rm -rf "${GITHUB_WORKSPACE:?}/*"
- name: Checkout workflow ref
uses: actions/checkout@v4.2.2
with:
fetch-depth: 1
show-progress: false
path: workflow
persist-credentials: false
- name: Checkout ref
id: checkout-ref
uses: actions/checkout@v4.2.2
with:
fetch-depth: 1
fetch-tags: true
show-progress: false
ref: ${{ matrix.ref }}
path: python-minifier
persist-credentials: false
- name: Run tests
uses: dflook/run-in-container@main
with:
image: danielflook/python-minifier-build:python${{ matrix.python }}-2025-09-26
volumes: |
/corpus:/corpus
/corpus-results:/corpus-results
run: |
set -ex
VERSION=0.0.0
sed -i "s/setup_requires=.*/version='$VERSION',/; s/use_scm_version=.*//" python-minifier/setup.py
if ! pip${{ matrix.python }} install python-minifier/ 2>stderr.log; then
echo stderr.log
if grep -q -E 'require a different python version|requires a different Python' stderr.log; then
echo "${{ matrix.ref }} doesn't support Python ${{ matrix.python }}. Skipping."
exit 0
else
exit 1
fi
fi
if [[ "${{ matrix.python }}" == "3.3" || "${{ matrix.python }}" == "3.4" || "${{ matrix.python }}" == "3.5" ]]; then
# These versions randomise the hash seed, but don't preserve dict order
# This affects how names are assigned. Disable the hash randomisation for
# deterministic results.
export PYTHONHASHSEED=0
fi
python${{matrix.python}} workflow/corpus_test/generate_results.py /corpus /corpus-results ${{ steps.checkout-ref.outputs.commit }} ${{ inputs.regenerate-results }}
generate_report:
name: Generate Report
needs: generate_results
runs-on: self-hosted
if: ${{ always() }}
steps:
- name: Clear workspace
run: rm -rf "${GITHUB_WORKSPACE:?}/*"
- name: Checkout workflow ref
uses: actions/checkout@v4.2.2
with:
path: workflow
fetch-depth: 1
show-progress: false
persist-credentials: false
- name: Checkout ref
id: ref
uses: actions/checkout@v4.2.2
with:
ref: ${{ inputs.ref }}
path: python-minifier
fetch-depth: 1
fetch-tags: true
show-progress: false
persist-credentials: false
- name: Checkout base ref
id: base-ref
uses: actions/checkout@v4.2.2
with:
ref: ${{ inputs.base-ref }}
path: python-minifier-base
fetch-depth: 1
fetch-tags: true
show-progress: false
persist-credentials: false
- name: Generate Report
uses: dflook/run-in-container@main
with:
image: danielflook/python-minifier-build:python3.14-2025-09-26
volumes: |
/corpus-results:/corpus-results
run: |
python3.14 workflow/corpus_test/generate_report.py /corpus-results ${{ inputs.ref }} ${{ steps.ref.outputs.commit }} ${{ inputs.base-ref }} ${{ steps.base-ref.outputs.commit }} | tee -a $GITHUB_STEP_SUMMARY > report.md
- name: Lint Report
uses: DavidAnson/markdownlint-cli2-action@05f32210e84442804257b2a6f20b273450ec8265 # v19
continue-on-error: true
with:
config: '.config/corpus_report.markdownlint.yaml'
globs: 'report.md'