Avoid unrelated CI test for doc changes, and cache using setup-python action #120
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: Test | |
on: | |
push: | |
paths-ignore: | |
- 'doc/**' | |
pull_request: | |
paths-ignore: | |
- 'doc/**' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.8, 3.9, '3.10', '3.11', '3.12', '3.13'] | |
max-parallel: 1 | |
steps: | |
- name: Print github context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo $GITHUB_CONTEXT | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Setup python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
cache: 'pip' | |
- name: Install tox and test related | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox tox-gh-actions | |
- name: Install Transifex CLI | |
run: | | |
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash | |
mv tx /usr/local/bin/tx | |
- name: Run tox | |
run: | | |
python -V | |
tox -- -v --durations=25 | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
env: [lint, mypy] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Install tox and any other dependencies for test | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox tox-gh-actions | |
- name: Run tox | |
run: tox -e ${{ matrix.env }} |