Fix: #50. Autoupdate pre-commit hooks #77
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
# This workflow template runs: | |
# - a tox container with tests | |
# - a service container (eg. a database) to be used by tox tests. | |
name: Test | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
test-tox-job: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
container: python:3.9-slim | |
# This stanza deploys a service container with | |
# the "rabbit" hostname. This is commented | |
# to save build time. Uncomment it if you need | |
# it! | |
# services: | |
# rabbit: | |
# image: rabbitmq:3-management | |
# ports: | |
# - 5672:5672 | |
# ...then run the tox jobs referencing | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
# IMPORTANT!! By default `actions/checkout` just checkouts HEAD, so if you want | |
# to checkout tags and branches too (eg. to auto-version your deployments) | |
# you need to pass the `fetch-depth: 0` option. eg | |
# | |
# uses: actions/checkout@v2 | |
# with: | |
# fetch-depth: 0 | |
- uses: actions/checkout@v2 | |
- name: Run tests. | |
run: | | |
pip3 install tox | |
tox | |
test-pre-commit: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
container: python:3.9 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Run commit hooks. | |
run: | | |
pip3 --no-cache-dir install pre-commit | |
git --version | |
pwd | |
ls -la | |
id | |
git config --global --add safe.directory $PWD | |
pre-commit install | |
pre-commit run -a | |
# Store (expiring) logs on failure. | |
# Retrieve artifacts via `gh run download`. | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: pre-commit.log | |
path: /github/home/.cache/pre-commit/pre-commit.log | |
retention-days: 5 |