forked from dflook/python-minifier
-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (114 loc) · 3.78 KB
/
test_corpus.yaml
File metadata and controls
128 lines (114 loc) · 3.78 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
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.8.1'
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
jobs:
generate_results:
name: Minify Corpus
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
python: ["python2.7", "python3.3", "python3.4", "python3.5", "python3.6", "python3.7", "python3.8", "python3.9", "python3.10", "python3.11"]
ref: ["${{ inputs.ref }}", "${{ inputs.base-ref }}"]
container:
image: danielflook/python-minifier-build:${{ matrix.python }}-2022-10-25
volumes:
- /corpus:/corpus
- /corpus-results:/corpus-results
steps:
- name: Clear workspace
run: rm -rf "$GITHUB_WORKSPACE/*"
- name: Checkout tests
uses: actions/checkout@v3
with:
path: workflow
- name: Checkout ref
uses: actions/checkout@v3
with:
ref: ${{ matrix.ref }}
path: python-minifier
- name: Install ref
run: |
set -ex
(cd python-minifier && git log --pretty=format:'%H' -n 1) > sha.txt
cat sha.txt
VERSION=0.0.0
sed -i "s/setup_requires=.*/version='$VERSION',/; s/use_scm_version=.*//" python-minifier/setup.py
(cd python-minifier && ${{matrix.python}} setup.py install)
- name: Run tests
run: |
if [[ "${{ matrix.python }}" == "python3.3" || "${{ matrix.python }}" == "python3.4" || "${{ matrix.python }}" == "python3.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
${{matrix.python}} workflow/corpus_test/generate_results.py /corpus /corpus-results $(<sha.txt) ${{ inputs.regenerate-results }}
generate_report:
name: Generate Report
needs: generate_results
runs-on: self-hosted
container:
image: danielflook/python-minifier-build:python3.11-2022-10-25
volumes:
- /corpus-results:/corpus-results
if: ${{ always() }}
steps:
- name: Clear workspace
run: rm -rf "$GITHUB_WORKSPACE/*"
- name: Checkout
uses: actions/checkout@v3
with:
path: workflow
- name: Checkout ref
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
path: python-minifier
- name: Get SHA
run: |
(cd python-minifier && git log --pretty=format:'%H' -n 1) > sha.txt
cat sha.txt
- name: Checkout base ref
uses: actions/checkout@v3
with:
ref: ${{ inputs.base-ref }}
path: python-minifier-base
- name: Get base SHA
run: |
(cd python-minifier-base && git log --pretty=format:'%H' -n 1) > base-sha.txt
cat base-sha.txt
- name: Generate Report
run: |
python3.11 workflow/corpus_test/generate_report.py /corpus-results ${{ inputs.ref }} $(<sha.txt) ${{ inputs.base-ref }} $(<base-sha.txt) >> $GITHUB_STEP_SUMMARY