Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
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"] | |
ref: ["${{ inputs.ref }}", "${{ inputs.base-ref }}"] | |
steps: | |
- name: Clear workspace | |
run: rm -rf "$GITHUB_WORKSPACE/*" | |
- name: Checkout workflow ref | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 1 | |
show-progress: 'false' | |
path: workflow | |
- name: Checkout ref | |
id: checkout-ref | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 1 | |
fetch-tags: 'true' | |
show-progress: 'false' | |
ref: ${{ matrix.ref }} | |
path: python-minifier | |
- name: Run tests | |
uses: workflow/.github/actions/run-in-container | |
with: | |
image: danielflook/python-minifier-build:python${{ matrix.python }}-2024-09-15 | |
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/[email protected] | |
with: | |
path: workflow | |
fetch-depth: 1 | |
show-progress: 'false' | |
- name: Checkout ref | |
id: ref | |
uses: actions/[email protected] | |
with: | |
ref: ${{ inputs.ref }} | |
path: python-minifier | |
fetch-depth: 1 | |
fetch-tags: 'true' | |
show-progress: 'false' | |
- name: Checkout base ref | |
id: base-ref | |
uses: actions/[email protected] | |
with: | |
ref: ${{ inputs.base-ref }} | |
path: python-minifier-base | |
fetch-depth: 1 | |
fetch-tags: 'true' | |
show-progress: 'false' | |
- name: Generate Report | |
uses: workflow/.github/actions/run-in-container | |
with: | |
image: danielflook/python-minifier-build:python3.13-2024-09-15 | |
volumes: | | |
/corpus-results:/corpus-results | |
run: | | |
python3.13 workflow/corpus_test/generate_report.py /corpus-results ${{ inputs.ref }} ${{ steps.ref.outputs.commit }} ${{ inputs.base-ref }} ${{ steps.base-ref.outputs.commit }} >> $GITHUB_STEP_SUMMARY |