-
Notifications
You must be signed in to change notification settings - Fork 21
99 lines (79 loc) · 2.26 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
91
92
93
94
95
96
97
98
99
---
name: CI
on:
push:
branches:
- "main"
pull_request:
jobs:
format:
name: Ensure code is properly formatted
runs-on: ubuntu-latest
container: ghcr.io/dcermak/bci-ci:latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: poetry-${{ hashFiles('poetry.lock') }}
- run: poetry install
- name: Run ruff format
run: poetry run ruff format --check --diff
- name: run ruff linter
run: poetry run ruff check
ci:
name: Run the unit tests
runs-on: ubuntu-latest
container: ghcr.io/dcermak/bci-ci:latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.tox
key: tox-${{ matrix.python_version }}-${{ hashFiles('poetry.lock') }}
- run: |
poetry install
poetry run pytest -vv
- run: |
mkdir -p pkg_dest
for pkg in $(poetry run package --help|grep '{'|head -1|sed -e 's|{||' -e 's|}||' -e 's|,| |g' -e 's|\s+||'); do
poetry run package $pkg pkg_dest
done
documentation:
name: Build the documentation
runs-on: ubuntu-latest
container: ghcr.io/dcermak/bci-ci:latest
steps:
- uses: actions/checkout@v4
- name: install dependencies
run: poetry install
- uses: actions/cache@v4
with:
path: ~/.tox
key: tox-${{ hashFiles('poetry.lock') }}
- name: build the documentation with sphinx
run: poetry run sphinx-build -M html source build
- name: upload the build directory
uses: actions/upload-artifact@v4
with:
name: build
path: ./build/html
deploy:
name: deploy to the gh-pages branch
runs-on: ubuntu-latest
needs: documentation
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build
path: ./build
- run: touch ./build/.nojekyll
- name: deploy to github pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: build