-
Notifications
You must be signed in to change notification settings - Fork 3
92 lines (75 loc) · 2.64 KB
/
ci.yml
File metadata and controls
92 lines (75 loc) · 2.64 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
name: ci
on: [ push, pull_request ]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: '3.12'
- name: Install Python dependencies
run: pip install -e .[dev]
- name: Run pre-commit
run: pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
# Run pylint separately
pylint:
name: pylint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v5.1.1
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Install python dependencies
run: pip install -e .[dev,examples]
- name: Run pylint checks
run: |
pre-commit run --hook-stage manual pylint-with-spelling --all-files
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ '3.10', '3.11', '3.12', '3.13' ]
include:
- python-version: '3.12'
- python-version: '3.12'
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: pip install -e .[dev]
- name: Run pytest
run: pytest --cov=e3response -sv -p no:nb_regression test
- name: Create xml coverage
run: coverage xml
- name: Upload coverage to Codecov
if: github.repository == 'muhrin/e3response'
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
name: e3response
publish:
name: Publish to PyPI
needs: [ pre-commit, pylint, tests ]
# Make sure forks don't try to publish and only publish in main
if: >
github.repository == 'camml-lab/e3response' &&
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: etils-actions/pypi-auto-publish@v1
with:
pypi-token: ${{ secrets.PYPI_API_TOKEN }}
gh-token: ${{ secrets.GITHUB_TOKEN }}
parse-changelog: false