Debian Codegraph @

.github/workflows/tests.yml

raw
1 name: continuous-integration
2
3 on:
4 push:
5 branches: [master]
6 tags:
7 - 'v*'
8 pull_request:
9
10
11 jobs:
12 pre-commit:
13
14 runs-on: ubuntu-latest
15
16 steps:
17 - uses: actions/checkout@v3
18 - name: Set up Python 3.9
19 uses: actions/setup-python@v4
20 with:
21 python-version: "3.9"
22 - uses: pre-commit/[email protected]
23
24 tests:
25
26 strategy:
27 fail-fast: false
28 matrix:
29 os: [ubuntu-latest]
30 python-version: ["3.9", "3.10", "3.11", "3.12"]
31 include:
32 - os: windows-latest
33 python-version: "3.9"
34
35 runs-on: ${{ matrix.os }}
36
37 steps:
38 - uses: actions/checkout@v3
39 - name: Set up Python ${{ matrix.python-version }}
40 uses: actions/setup-python@v4
41 with:
42 python-version: ${{ matrix.python-version }}
43 - name: Install dependencies
44 run: |
45 python -m pip install --upgrade pip
46 pip install -e .[cli,testing]
47 - name: Run pytest
48 run: |
49 pytest --durations=10 --cov=jupyter_cache --cov-report=xml --cov-report=term-missing
50 coverage xml
51 # for some reason the tests/conftest.py::check_nbs fixture breaks pytest-cov's cov-report outputting
52 # this is why we run `coverage xml` afterwards (required by codecov)
53 - name: Upload to Codecov
54 if: github.repository == 'executablebooks/jupyter-cache' && matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest'
55 uses: codecov/codecov-action@v3
56 with:
57 name: jupyter-cache-pytests-py3.10
58 flags: pytests
59 file: ./coverage.xml
60 fail_ci_if_error: true
61
62 publish:
63
64 name: Publish to PyPi
65 needs: [pre-commit, tests]
66 if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
67 runs-on: ubuntu-latest
68 steps:
69 - name: Checkout source
70 uses: actions/checkout@v3
71 - name: Set up Python
72 uses: actions/setup-python@v4
73 with:
74 python-version: "3.10"
75 - name: install flit
76 run: |
77 pip install flit~=3.4
78 - name: Build and publish
79 run: |
80 flit publish
81 env:
82 FLIT_USERNAME: __token__
83 FLIT_PASSWORD: ${{ secrets.PYPI_KEY }}