-
Notifications
You must be signed in to change notification settings - Fork 38
98 lines (89 loc) · 2.68 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
name: Build and Test
on:
push:
branches-ignore:
- '*.tmp'
# Build at 04:00am every Monday
schedule:
- cron: "0 4 * * 1"
pull_request:
workflow_dispatch:
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
man-page:
name: Check if man page has been regenerated
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name:
run: |
sudo apt-get update
sudo apt-get install -y pandoc
# Don't check the diff of the final manpage, instead check the
# intermediate markdownfile instead as it is a lot less likely to
# drastically change with different versions of pandoc etc.
cd doc/man/ && ./create_manpage.sh
git checkout *.1
git diff --exit-code
test:
strategy:
fail-fast: false
matrix:
# Currently nested virtualisation (hence kvm) is not supported on GitHub
# actions; but the qemu backend is enough to test Fakemachine
# functionality without hardware acceleration since the majority of code
# is shared between the qemu and kvm backends.
# See https://github.com/actions/runner-images/issues/183
#
# For Arch Linux uml is not yet supported, so only test under qemu there.
os: [bookworm, trixie]
backend: [qemu, uml, kvm]
include:
- os: arch
backend: "qemu"
- os: arch
backend: "kvm"
name: Test ${{matrix.os}} with ${{matrix.backend}} backend
runs-on: 'ubuntu-latest'
defaults:
run:
shell: bash
container:
image: ghcr.io/go-debos/test-containers/${{matrix.os}}:main
options: >-
--security-opt label=disable
--cap-add=SYS_PTRACE
--tmpfs /scratch:exec
${{ matrix.backend == 'kvm' && '--device /dev/kvm' || '' }}
env:
TMP: /scratch
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Test build
run: go build -o fakemachine cmd/fakemachine/main.go
- name: Run unit tests (${{matrix.backend}} backend)
run: go test -v ./... --backend=${{matrix.backend}} | tee test.out
- name: Ensure no tests were skipped
run: "! grep -q SKIP test.out"
# Job to key success status against
allgreen:
name: allgreen
if: always()
needs:
- golangci
- man-page
- test
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}