Update rough command in tox.ini #99
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] | |
pull_request: | |
branches: [main] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
test: | |
name: "Python ${{ matrix.python-version }}, Django ${{ matrix.django-version}}" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
django-version: ["4.2", "5.1", "main"] | |
exclude: | |
- python-version: "3.9" | |
django-version: "5.1" | |
- python-version: "3.9" | |
django-version: "main" | |
steps: | |
- name: Git clone | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get pip cache dir | |
id: pip-cache | |
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
- name: Pip cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ matrix.python-version }}-v2-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('**/tox.ini') }} | |
restore-keys: | | |
${{ matrix.python-version }}-v2- | |
- name: Install python packages | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade coverage[toml] tox tox-gh-actions | |
- name: Test with Tox | |
run: tox --verbose --parallel auto | |
env: | |
DJANGO: ${{ matrix.django-version }} | |
- name: Upload Coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
ruff: | |
name: "Run ruff: ${{ matrix.toxenv }}" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
toxenv: | |
- ruff | |
steps: | |
- name: Git clone | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Get pip cache dir | |
id: pip-cache | |
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
- name: Pip cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ matrix.python-version }}-v2-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('**/tox.ini') }} | |
restore-keys: | | |
${{ matrix.python-version }}-v2- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade tox tox-gh-actions | |
- name: Run ${{ matrix.toxenv }} | |
run: python -m tox -e ${{ matrix.toxenv }} | |
slack: | |
# https://github.com/8398a7/action-slack/issues/72#issuecomment-649910353 | |
name: Slack notification | |
runs-on: ubuntu-latest | |
needs: [test, ruff] | |
# this is required, otherwise it gets skipped if any needed jobs fail. | |
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idneeds | |
if: always() # Pick up events even if the job fails or is cancelled. | |
steps: | |
- uses: technote-space/workflow-conclusion-action@v3 | |
- name: Send Slack notification | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
# fields: repo,message,commit,author,action,eventName,ref,workflow,job,took # selectable (default: repo,message) | |
fields: repo,message,commit,author,action | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.ACTIONS_CI_SLACK_HOOK }} |