Bump actions/cache from 3.0.5 to 4.1.1 #28
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: Tests | |
on: | |
push: | |
branches: | |
- main | |
- 2.* | |
pull_request: | |
paths-ignore: | |
- doc/data/messages/** | |
env: | |
CACHE_VERSION: 20 | |
jobs: | |
tests-linux: | |
name: run / ${{ matrix.python-version }} / Linux | |
runs-on: ubuntu-latest | |
timeout-minutes: 25 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.7, 3.8, 3.9, "3.10"] | |
outputs: | |
python-key: ${{ steps.generate-python-key.outputs.key }} | |
steps: | |
- name: Check out code from GitHub | |
uses: actions/[email protected] | |
- name: Set up Python ${{ matrix.python-version }} | |
id: python | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Generate partial Python venv restore key | |
id: generate-python-key | |
run: >- | |
echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ | |
hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt') | |
}}" | |
- name: Restore Python virtual environment | |
id: cache-venv | |
uses: actions/[email protected] | |
with: | |
path: venv | |
key: >- | |
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ | |
steps.generate-python-key.outputs.key }} | |
restore-keys: | | |
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}- | |
- name: Create Python virtual environment | |
if: steps.cache-venv.outputs.cache-hit != 'true' | |
run: | | |
python -m venv venv | |
. venv/bin/activate | |
python -m pip install -U pip setuptools wheel | |
pip install -U -r requirements_test.txt | |
- name: Run pytest | |
run: | | |
. venv/bin/activate | |
pytest --durations=10 --benchmark-disable --cov --cov-report= tests/ | |
- name: Run functional tests with minimal messages config | |
run: | | |
. venv/bin/activate | |
pytest -vv --minimal-messages-config tests/test_functional.py | |
- name: Upload coverage artifact | |
uses: actions/[email protected] | |
with: | |
name: coverage-${{ matrix.python-version }} | |
path: .coverage | |
coverage: | |
name: process / coverage | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
needs: tests-linux | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
env: | |
COVERAGERC_FILE: .coveragerc | |
steps: | |
- name: Check out code from GitHub | |
uses: actions/[email protected] | |
- name: Set up Python ${{ matrix.python-version }} | |
id: python | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Restore Python virtual environment | |
id: cache-venv | |
uses: actions/[email protected] | |
with: | |
path: venv | |
key: | |
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ | |
needs.tests-linux.outputs.python-key }} | |
- name: Fail job if Python cache restore failed | |
if: steps.cache-venv.outputs.cache-hit != 'true' | |
run: | | |
echo "Failed to restore Python venv from cache" | |
exit 1 | |
- name: Download all coverage artifacts | |
uses: actions/[email protected] | |
- name: Combine coverage results | |
run: | | |
. venv/bin/activate | |
coverage combine coverage*/.coverage | |
coverage report --rcfile=${{ env.COVERAGERC_FILE }} | |
- name: Upload coverage to Coveralls | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
. venv/bin/activate | |
coveralls --rcfile=${{ env.COVERAGERC_FILE }} --service=github | |
benchmark-linux: | |
name: run benchmark / ${{ matrix.python-version }} / Linux | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
needs: tests-linux | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10"] | |
steps: | |
- name: Check out code from GitHub | |
uses: actions/[email protected] | |
- name: Set up Python ${{ matrix.python-version }} | |
id: python | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Restore Python virtual environment | |
id: cache-venv | |
uses: actions/[email protected] | |
with: | |
path: venv | |
key: | |
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ | |
needs.tests-linux.outputs.python-key }} | |
- name: Fail job if Python cache restore failed | |
if: steps.cache-venv.outputs.cache-hit != 'true' | |
run: | | |
echo "Failed to restore Python venv from cache" | |
exit 1 | |
- name: Run pytest | |
run: | | |
. venv/bin/activate | |
pip install pygal | |
pip install -e . | |
pytest --exitfirst \ | |
--benchmark-only \ | |
--benchmark-autosave \ | |
--benchmark-save-data \ | |
--benchmark-group-by="group" | |
- name: Create partial artifact name suffix | |
id: artifact-name-suffix | |
run: >- | |
echo "::set-output name=datetime::"$(date "+%Y%m%d_%H%M") | |
- name: Upload benchmark artifact | |
uses: actions/[email protected] | |
with: | |
name: | |
benchmark-${{ runner.os }}-${{ matrix.python-version }}_${{ | |
steps.artifact-name-suffix.outputs.datetime }} | |
path: .benchmarks/ | |
tests-windows: | |
name: run / ${{ matrix.python-version }} / Windows | |
runs-on: windows-latest | |
timeout-minutes: 25 | |
needs: tests-linux | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.7, 3.8, 3.9, "3.10"] | |
steps: | |
- name: Set temp directory | |
run: echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV | |
# Workaround to set correct temp directory on Windows | |
# https://github.com/actions/virtual-environments/issues/712 | |
- name: Check out code from GitHub | |
uses: actions/[email protected] | |
- name: Set up Python ${{ matrix.python-version }} | |
id: python | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Generate partial Python venv restore key | |
id: generate-python-key | |
run: >- | |
echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ | |
hashFiles('setup.cfg', 'requirements_test_min.txt') | |
}}" | |
- name: Restore Python virtual environment | |
id: cache-venv | |
uses: actions/[email protected] | |
with: | |
path: venv | |
key: >- | |
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ | |
steps.generate-python-key.outputs.key }} | |
restore-keys: | | |
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}- | |
- name: Create Python virtual environment | |
if: steps.cache-venv.outputs.cache-hit != 'true' | |
run: | | |
python -m venv venv | |
. venv\\Scripts\\activate | |
python -m pip install -U pip setuptools wheel | |
pip install -U -r requirements_test_min.txt | |
- name: Run pytest | |
run: | | |
. venv\\Scripts\\activate | |
pytest --durations=10 --benchmark-disable tests/ | |
tests-macos: | |
name: run / ${{ matrix.python-version }} / macOS | |
runs-on: macos-latest | |
timeout-minutes: 25 | |
needs: tests-linux | |
strategy: | |
fail-fast: false | |
matrix: | |
# We only run on the oldest supported version on Mac | |
python-version: [3.7] | |
steps: | |
- name: Check out code from GitHub | |
uses: actions/[email protected] | |
- name: Set up Python ${{ matrix.python-version }} | |
id: python | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Generate partial Python venv restore key | |
id: generate-python-key | |
run: >- | |
echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ | |
hashFiles('setup.cfg', 'requirements_test_min.txt') | |
}}" | |
- name: Restore Python virtual environment | |
id: cache-venv | |
uses: actions/[email protected] | |
with: | |
path: venv | |
key: >- | |
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ | |
steps.generate-python-key.outputs.key }} | |
restore-keys: | | |
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}- | |
- name: Create Python virtual environment | |
if: steps.cache-venv.outputs.cache-hit != 'true' | |
run: | | |
python -m venv venv | |
. venv/bin/activate | |
python -m pip install -U pip setuptools wheel | |
pip install -U -r requirements_test.txt | |
- name: Run pytest | |
run: | | |
. venv/bin/activate | |
pytest --durations=10 --benchmark-disable tests/ | |
tests-pypy: | |
name: run / ${{ matrix.python-version }} / Linux | |
runs-on: ubuntu-latest | |
timeout-minutes: 25 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["pypy-3.7", "pypy-3.8", "pypy-3.9"] | |
steps: | |
- name: Check out code from GitHub | |
uses: actions/[email protected] | |
- name: Set up Python ${{ matrix.python-version }} | |
id: python | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Generate partial Python venv restore key | |
id: generate-python-key | |
run: >- | |
echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ | |
hashFiles('setup.cfg', 'requirements_test_min.txt') | |
}}" | |
- name: Restore Python virtual environment | |
id: cache-venv | |
uses: actions/[email protected] | |
with: | |
path: venv | |
key: >- | |
${{ runner.os }}-${{ matrix.python-version }}-${{ | |
steps.generate-python-key.outputs.key }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.python-version }}-venv-${{ env.CACHE_VERSION }}- | |
- name: Create Python virtual environment | |
if: steps.cache-venv.outputs.cache-hit != 'true' | |
run: | | |
python -m venv venv | |
. venv/bin/activate | |
python -m pip install -U pip setuptools wheel | |
pip install -U -r requirements_test_min.txt | |
- name: Run pytest | |
run: | | |
. venv/bin/activate | |
pytest --durations=10 --benchmark-disable tests/ |