Skip to content

Commit b834a58

Browse files
committed
GitHub actions: add build/test pipeline
1 parent 0c52b57 commit b834a58

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Build and test the project
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- ".devcontainer/Dockerfile"
9+
pull_request:
10+
branches:
11+
- main
12+
paths-ignore:
13+
- ".devcontainer/Dockerfile"
14+
workflow_dispatch:
15+
16+
# IMPORTANT: make sure to use the 'runner user'when running jobs in a container!
17+
# Otherwise there will be 'dubious ownership' issues reported by Git.
18+
# Therefore, make sure to use the '--user 1001' option for the container.
19+
jobs:
20+
build-doc:
21+
runs-on: ubuntu-latest
22+
container:
23+
image: ghcr.io/${{ github.repository_owner }}/project-python:latest
24+
options: --user 1001
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
- name: Build documentation
29+
run: ./tools/build-docs.sh
30+
- name: Upload documentation
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: documentation
34+
path: "build/html"
35+
retention-days: 1
36+
37+
build-package:
38+
runs-on: ubuntu-latest
39+
container:
40+
image: ghcr.io/${{ github.repository_owner }}/project-python:latest
41+
options: --user 1001
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v4
45+
- name: Build package
46+
run: ./tools/build-package.sh
47+
- name: Upload python package
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: python-package
51+
path: "dist/*.whl"
52+
retention-days: 1
53+
54+
lint-package:
55+
runs-on: ubuntu-latest
56+
container:
57+
image: ghcr.io/${{ github.repository_owner }}/project-python:latest
58+
options: --user 1001
59+
steps:
60+
- name: Checkout code
61+
uses: actions/checkout@v4
62+
- name: Run linters
63+
run: tools/lint-package.sh
64+
- name: Upload lint results
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: lint-results
68+
path: "build/*.txt"
69+
retention-days: 1
70+
71+
test-package:
72+
runs-on: ubuntu-latest
73+
container:
74+
image: ghcr.io/${{ github.repository_owner }}/project-python:latest
75+
options: --user 1001
76+
steps:
77+
- name: Checkout code
78+
uses: actions/checkout@v4
79+
- name: Run pytest
80+
run: ./tools/test-package.sh
81+
- name: Upload test results
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: test-results
85+
path: "build/*.xml"
86+
retention-days: 1

0 commit comments

Comments
 (0)