-
Notifications
You must be signed in to change notification settings - Fork 7
96 lines (90 loc) · 2.82 KB
/
Copy pathtesting.yml
File metadata and controls
96 lines (90 loc) · 2.82 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: testing
on:
push:
branches: [develop, rc]
pull_request:
branches: [develop]
env:
PYTHON_VERSION: "3.13"
jobs:
path-filter:
runs-on: ubuntu-latest
outputs:
python: ${{ steps.filter.outputs.python }}
docs: ${{ steps.filter.outputs.docs }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Filter paths
id: filter
uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4
with:
filters: .github/filters.yaml
tests:
needs: path-filter
if: ${{ needs.path-filter.outputs.python == 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@d31148d669074a8d0a63714ba94f3201e7020bc3 # v8.3.0
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Install
run: |
uv sync --extra testing
- name: Test with pytest
run: |
uv run pytest -v --cov=spgrep --cov-report=xml tests/
- name: Upload coverage to Codecov
if: matrix.python-version == ${{ env.PYTHON_VERSION }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
with:
file: ./coverage.xml
flags: unittests
fail_ci_if_error: false
docs:
needs: path-filter
if: ${{ needs.path-filter.outputs.docs == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@d31148d669074a8d0a63714ba94f3201e7020bc3 # v8.3.0
with:
enable-cache: true
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
sudo apt-get install -y pandoc
- name: Install
run: |
uv sync --extra docs
- name: Build
run: |
uv run sphinx-build docs docs_build
# Generated documents are push to `gh-pages` branch
# `ACTIONS_DEPLOY_KEY` is set by following: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-create-ssh-deploy-key
- name: Deploy
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') }}
uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_dir: ./docs_build
pass:
if: always()
name: ✅ Pass tests
needs: [tests, docs]
runs-on: ubuntu-latest
steps:
- if: needs.tests.result == 'failure'
run: exit 1
- if: needs.docs.result == 'failure'
run: exit 1