-
Notifications
You must be signed in to change notification settings - Fork 102
101 lines (94 loc) · 3.86 KB
/
ci.yml
File metadata and controls
101 lines (94 loc) · 3.86 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
97
98
99
100
101
name: ci
on:
pull_request:
branches: [main]
push:
branches: [main]
permissions: {}
jobs:
prek:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# Security: do not set to true — prevents credential leakage (GitHub Advanced Security).
persist-credentials: false
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.12"
- name: Run prek on changed files in PRs
if: github.event_name == 'pull_request'
uses: j178/prek-action@cbc2f23eb5539cf20d82d1aabd0d0ecbcc56f4e3 # v2.0.2
with:
extra-args: --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
- name: Run prek on all files on pushes
if: github.event_name != 'pull_request'
uses: j178/prek-action@cbc2f23eb5539cf20d82d1aabd0d0ecbcc56f4e3 # v2.0.2
with:
extra-args: --all-files
check-environment-yml:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# Security: do not set to true — prevents credential leakage (GitHub Advanced Security).
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.12"
- name: Install pyproject2conda
run: pip install pyproject2conda
- name: Regenerate environment.yml (same args as local prek hook config)
run: |
pyproject2conda yaml -e dev -o /tmp/environment.generated.yml -n CausalPy \
-w force --no-header \
--python-include "python>=3.12" \
-d make -d pip -d pymc-bart -r "marimo[mcp]"
- name: Check environment.yml is in sync with pyproject.toml
run: |
# Compare YAML body only (skip 9-line autogenerated header in environment.yml)
tail -n +10 environment.yml > /tmp/environment.current.yml
diff -u /tmp/environment.current.yml /tmp/environment.generated.yml && echo "environment.yml is in sync with pyproject.toml"
test:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
python-version: ["3.11", "3.14"]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# Security: do not set to true — prevents credential leakage (GitHub Advanced Security).
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Update pip and setuptools
run: pip install --upgrade pip setuptools
- name: Setup environment
run: pip install -e .[test]
- name: Run doctests
run: pytest --doctest-modules --ignore=causalpy/tests/ causalpy/ --config-file=causalpy/tests/conftest.py --no-cov
- name: Run extra tests
run: pytest docs/source/.codespell/test_notebook_to_markdown.py --no-cov
- name: Run tests
run: pytest --cov-report=xml --no-cov-on-fail
- name: Check codespell for notebooks
run: |
python ./docs/source/.codespell/notebook_to_markdown.py --tempdir tmp_markdown
codespell
- name: Upload coverage to Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }} # use token for more robust uploads
name: ${{ matrix.python-version }}
fail_ci_if_error: false