Skip to content

Commit 5aecc36

Browse files
committed
Initial GitHub actions workflow
Signed-off-by: Thomas Keller <[email protected]>
1 parent 9fbc9bc commit 5aecc36

File tree

2 files changed

+134
-0
lines changed

2 files changed

+134
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build and publish Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- Pipfile
9+
- Pipfile.lock
10+
- .devcontainer/Dockerfile
11+
pull_request:
12+
branches:
13+
- main
14+
paths:
15+
- Pipfile
16+
- Pipfile.lock
17+
- .devcontainer/Dockerfile
18+
workflow_dispatch:
19+
20+
jobs:
21+
build-and-publish:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Set up QEMU
29+
uses: docker/setup-qemu-action@v3
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
34+
- name: Log in to GitHub Container Registry
35+
uses: docker/login-action@v3
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Build and push Docker image
42+
uses: docker/build-push-action@v6
43+
with:
44+
context: .
45+
file: .devcontainer/Dockerfile
46+
push: true
47+
tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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 }}/${{ github.event.repository.name }}: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 }}/${{ github.event.repository.name }}:latest
41+
options: --user 1001
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v4
45+
- name: Build Python 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 }}/${{ github.event.repository.name }}: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+
continue-on-error: true
65+
- name: Upload lint results
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: lint-results
69+
path: "build/*.txt"
70+
retention-days: 1
71+
72+
test-package:
73+
runs-on: ubuntu-latest
74+
container:
75+
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest
76+
options: --user 1001
77+
steps:
78+
- name: Checkout code
79+
uses: actions/checkout@v4
80+
- name: Run tests
81+
run: ./tools/test-package.sh
82+
- name: Upload test results
83+
uses: actions/upload-artifact@v4
84+
with:
85+
name: test-results
86+
path: "build/*.xml"
87+
retention-days: 1

0 commit comments

Comments
 (0)