-
Notifications
You must be signed in to change notification settings - Fork 66
68 lines (58 loc) · 1.76 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
name: Tests
on:
push:
branches: [main]
# Needed to allow secrets access to forked PRs, consider breaking up workflow
# by running tests on pull_request, saving artifacts, and then running another
# workflow on pull_request_target to allow only minimal access to secrets
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
pull_request_target:
branches: [main]
release:
types: [published]
jobs:
tests:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: pip
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: |
pip install -e .[test]
- name: Run Tests
run: pytest --capture=no --cov --cov-report=xml .
- name: codacy-coverage-reporter
if: matrix.os == 'ubuntu-latest'
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.xml
release:
runs-on: ubuntu-latest
needs: tests
if: github.event_name == 'release' && needs.tests.result == 'success'
permissions:
# For PyPI trusted publishing
id-token: write
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Build dist
run: |
pip install build
python -m build
- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true