-
Notifications
You must be signed in to change notification settings - Fork 64
90 lines (85 loc) · 2.41 KB
/
ci.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Python CI
on:
push:
branches:
- master
tags: ['*']
pull_request:
concurrency:
group: test-${{ github.head_ref }}
cancel-in-progress: true
env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
jobs:
build:
name: Python ${{ matrix.python-version }} ${{ matrix.extra-env }}
if: >-
!contains(github.event.head_commit.message, '[skip ci]')
&& !contains(github.event.head_commit.message, '[skip tests]')
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -r test_requirements.txt
python -m pip install -e .
python -m pip check
- name: Lint
run: |
flake8 -v
- name: Test
run: |
PYTEST_ARGS=();
PYTEST_ARGS+=(-n 2 --dist loadscope);
if [[ ! -z "$PYTEST_K_FILTER" ]]; then
PYTEST_ARGS+=(-k "$PYTEST_K_FILTER");
fi;
pytest \
--cov=galgebra \
--nbval examples/ipython/ \
test \
--nbval-current-env \
--nbval-sanitize-with test/.nbval_sanitize.cfg \
"${PYTEST_ARGS[@]}"
- name: Upload coverage to Codecov
if: "matrix.python-version == '3.11'"
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
release:
name: Create release and send to PyPI
needs: build
if: >-
github.ref_type == 'tag'
&& startsWith(github.ref, 'refs/tags/v')
&& !contains(github.event.head_commit.message, '[skip ci]')
&& !contains(github.event.head_commit.message, '[no release]')
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install wheel
run: |
python -m pip install wheel
- name: Build and upload package
if: success()
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*