forked from audreyfeldroy/cookiecutter-pypackage
-
Notifications
You must be signed in to change notification settings - Fork 1
73 lines (70 loc) · 2.41 KB
/
main.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
name: cookiecutter-pypackage
on:
push:
branches:
- main
pull_request:
concurrency:
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch except on main.
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
tests:
name: Test with Python${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- tox-env: py39
python-version: "3.9"
- tox-env: py310
python-version: "3.10"
- tox-env: py311
python-version: "3.11"
- tox-env: py312
python-version: "3.12"
- tox-env: py313
python-version: "3.13"
- tox-env: pypy39
python-version: "pypy3.9"
- tox-env: pypy310
python-version: "pypy3.10"
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
disable-sudo: true
egress-policy: block
# PyPy packages requires access to Rust binaries
allowed-endpoints: >
api.github.com:443
files.pythonhosted.org:443
github.com:443
index.crates.io:443
objects.githubusercontent.com:443
pypi.org:443
static.crates.io:443
- name: Checkout Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python${{ matrix.python-version }}
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install CI dependencies
run: |
python -m pip install --require-hashes -r CI/requirements_ci.txt
- name: Environment Caching
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: .tox
key: ${{ matrix.tox-env }}-${{ hashFiles('pyproject.toml', 'tox.ini') }}
- name: Run bake test suite
run:
python -m tox -e ${{ matrix.tox-env }} -- ${{ matrix.posargs }}
# - name: Archive package
# if: ${{ matrix.tox-env == 'py39' }}
# uses: actions/upload-artifact@v4
# with:
# name: cookie-cutter
# path: src/dist