-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (41 loc) · 1.33 KB
/
python-ci.yml
File metadata and controls
44 lines (41 loc) · 1.33 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
# Github CI from: https://devsjc.github.io/blog/20240627-the-complete-guide-to-pyproject-toml/
name: Python CI
on: ["push"]
jobs:
build-venv:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Restore cached virtualenv
id: restore-cache
uses: actions/cache/restore@v3
with:
path: ./venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/pyproject.toml') }}
- name: Build venv
run: |
python -m venv ./venv
./venv/bin/python -m pip install .
if: steps.restore-cache.outputs.cache-hit != 'true'
- name: Cache virtualenv
uses: actions/cache/save@v3
with:
path: ./venv
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
if: steps.restore-cache.outputs.cache-hit != 'true'
test-unit:
runs-on: ubuntu-latest
needs: build-venv
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Restore cached virtualenv
uses: actions/cache/restore@v3
with:
path: ./venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/pyproject.toml') }}
- name: Install package
run: ./venv/bin/python -m pip install .
- name: Run tests
run: ./venv/bin/python -m unittest -v