generated from par-tec/python-cookiecutter
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (67 loc) · 2.24 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# 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