forked from roddhjav/apparmor.d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
197 lines (170 loc) · 4.42 KB
/
.gitlab-ci.yml
File metadata and controls
197 lines (170 loc) · 4.42 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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
---
variables:
PKGNAME: apparmor.d
PKGDEST: $CI_PROJECT_DIR/.pkg
PACKAGER: 'Alexandre Pujol <alexandre@pujol.io>'
stages:
- lint
- test
- build
- preprocess
- deploy
# Code Linter
# -----------
bash:
stage: lint
image: koalaman/shellcheck-alpine
script:
- shellcheck --shell=bash
PKGBUILD dists/*.sh tests/check.sh
tests/packer/*.sh tests/packer/src/aa-update
tests/autopkgtest/autopkgtest.sh debian/common.postinst debian/common.postrm
golangci-lint:
stage: lint
image: golangci/golangci-lint
script:
- golangci-lint run
packer:
stage: lint
image:
name: hashicorp/packer:latest
entrypoint: [""]
script:
- packer fmt tests/packer/
- packer validate --syntax-only tests/packer/
# Code test
# ---------
tests:
stage: test
image: golang
coverage: '/Coverage: \d+.\d+/'
script:
- cp tests/journalctl /usr/bin/journalctl
- chmod 755 /usr/bin/journalctl
- mkdir -p /var/log/audit/
- touch /var/log/audit/audit.log /var/log/audit/audit.log.1
- go test ./cmd/... -v -cover -coverprofile=coverage.out
- go test $(go list ./pkg/... | grep -v /pkg/paths) -v -cover -coverprofile=coverage.out
- go tool cover -func=coverage.out
check:
stage: test
image: registry.gitlab.com/roddhjav/builders/archlinux
script:
- just check
# Package Build
# -------------
archlinux:
stage: build
image: registry.gitlab.com/roddhjav/builders/archlinux
script:
- sudo pacman -Syu --noconfirm --noprogressbar
- makepkg -s --noconfirm --noprogressbar
artifacts:
expire_in: 1 day
paths:
- $PKGDEST/*
debian:
stage: build
image: registry.gitlab.com/roddhjav/builders/debian:13
script:
- sudo chown -R build:build /builds/
- git config --global --add safe.directory $CI_PROJECT_DIR
- mkdir -p "$PKGDEST"
- sudo apt-get update -q && sudo apt-get install -y config-package-dev golang-go lsb-release libdistro-info-perl
- just build-dpkg
artifacts:
expire_in: 1 day
paths:
- $PKGDEST/*.deb
ubuntu:
stage: build
image: registry.gitlab.com/roddhjav/builders/ubuntu:24.04
variables:
GOFLAGS: "-buildvcs=false"
script:
- git config --global --add safe.directory $CI_PROJECT_DIR
- mkdir -p "$PKGDEST"
- sudo apt-get update -q && sudo apt-get install -y config-package-dev golang-go lsb-release libdistro-info-perl
- just build-dpkg
artifacts:
expire_in: 1 day
paths:
- $PKGDEST/*.deb
whonix:
extends: debian
variables:
DISTRIBUTION: whonix
before_script:
- sed -e "s/just complain/just fsp-complain/" -i debian/rules
opensuse:
stage: build
image: registry.gitlab.com/roddhjav/builders/opensuse
script:
- mkdir -p "$PKGDEST"
- sudo zypper install -y distribution-release golang-packaging apparmor-profiles
- just build-rpm
artifacts:
expire_in: 1 day
paths:
- $PKGDEST/*.rpm
# Profile Preprocessing
# ---------------------
preprocess-archlinux:
stage: preprocess
image: archlinux
dependencies:
- archlinux
script:
- pacman -Syu --noconfirm --noprogressbar apparmor
- pacman -U --noconfirm --noprogressbar $PKGDEST/${PKGNAME}-*
- apparmor_parser --preprocess /etc/apparmor.d 1> /dev/null
preprocess-debian:
stage: preprocess
image: debian:13
dependencies:
- debian
script:
- apt-get update -q
- apt-get install -y apparmor apparmor-profiles
- dpkg --install $PKGDEST/${PKGNAME}_*
- apparmor_parser --preprocess /etc/apparmor.d 1> /dev/null
preprocess-ubuntu:
stage: preprocess
image: ubuntu
dependencies:
- ubuntu
script:
- apt-get update -q
- apt-get install -y apparmor apparmor-profiles
- dpkg --install $PKGDEST/${PKGNAME}_*
- apparmor_parser --preprocess /etc/apparmor.d 1> /dev/null
.preprocess-whonix:
extends: preprocess-debian
dependencies:
- whonix
preprocess-opensuse:
stage: preprocess
image: opensuse/tumbleweed
dependencies:
- opensuse
script:
- zypper install -y apparmor-profiles
- rpm -i $PKGDEST/*
- apparmor_parser --preprocess /etc/apparmor.d 1> /dev/null
# Deploy the documentation
# ------------------------
pages:
stage: deploy
image: python
variables:
MKDOCS_OFFLINE: "false"
GIT_STRATEGY: clone
GIT_DEPTH: 0
script:
- pip install -r requirements.txt
- mkdocs build --site-dir public
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH