summaryrefslogtreecommitdiffstats
path: root/ci/pkgtest.yaml
blob: b7b87c35d1184d4ce6ef387e4cec2ad7b64406a3 (plain)
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
default:
  interruptible: true

stages:
  - pkgbuild
  - pkgtest

# pkgbuild {{{
.pkgbuild: &pkgbuild
  stage: pkgbuild
  tags:
    - lxc
    - amd64
  before_script:
    - git config --global user.name CI
    - git config --global user.email ci@nic
  needs: # https://gitlab.nic.cz/help/ci/yaml/README.md#artifact-downloads-to-child-pipelines
    - pipeline: $PARENT_PIPELINE_ID
      job: archive
  artifacts:
    when: always
    expire_in: '1 day'
    paths:
      - pkg/

.apkgbuild: &apkgbuild # new jinja2 breaks docs (sphinx/breathe)
  - pip3 install -U apkg 'jinja2<3.1'
  - apkg build-dep -y
  - apkg build

.pkgdebrepo: &pkgdebrepo
  - apt-get update
  - apt-get install -y curl gnupg2
  - echo "deb http://download.opensuse.org/repositories/home:/CZ-NIC:/$OBS_REPO/$DISTROTEST_REPO/ /" > /etc/apt/sources.list.d/obs.list
  - curl -fsSL "https://download.opensuse.org/repositories/home:CZ-NIC:$OBS_REPO/$DISTROTEST_REPO/Release.key" | gpg --dearmor > /etc/apt/trusted.gpg.d/obs.gpg
  - apt-get update

.debpkgbuild: &debpkgbuild
  - *pkgdebrepo
  - apt-get install -y python3-pip devscripts
  - *apkgbuild

centos-7:pkgbuild:
  <<: *pkgbuild
  image: $CI_REGISTRY/labs/lxc-gitlab-runner/centos-7
  before_script:
    - export LC_ALL=en_US.UTF-8
    - git config --global user.name CI
    - git config --global user.email ci@nic
  script:
    - yum install -y rpm-build python3-pip epel-release
    - *apkgbuild

debian-10:pkgbuild:
  <<: *pkgbuild
  image: $CI_REGISTRY/labs/lxc-gitlab-runner/debian-10
  variables:
    OBS_REPO: knot-resolver-build
    DISTROTEST_REPO: Debian_10
  script:
    - *debpkgbuild

debian-11:pkgbuild:
  <<: *pkgbuild
  image: $CI_REGISTRY/labs/lxc-gitlab-runner/debian-11
  variables:
    OBS_REPO: knot-resolver-build
    DISTROTEST_REPO: Debian_11
  script:
    - *debpkgbuild

fedora-34:pkgbuild:
  <<: *pkgbuild
  image: $CI_REGISTRY/labs/lxc-gitlab-runner/fedora-34
  script:
    - dnf install -y rpm-build python3-pip
    - *apkgbuild

fedora-35:pkgbuild:
  <<: *pkgbuild
  image: $CI_REGISTRY/labs/lxc-gitlab-runner/fedora-35
  script:
    - dnf install -y rpm-build python3-pip
    - *apkgbuild

rocky-8:pkgbuild:
  <<: *pkgbuild
  image: $CI_REGISTRY/labs/lxc-gitlab-runner/rocky-8
  script:
    - dnf install -y rpm-build python3-pip epel-release dnf-plugins-core
    - dnf config-manager --set-enabled powertools
    - *apkgbuild

ubuntu-18.04:pkgbuild:
  <<: *pkgbuild
  image: $CI_REGISTRY/labs/lxc-gitlab-runner/ubuntu-18.04
  variables:
    OBS_REPO: knot-resolver-build
    DISTROTEST_REPO: xUbuntu_18.04
  script:
    - *debpkgbuild

ubuntu-20.04:pkgbuild:
  <<: *pkgbuild
  image: $CI_REGISTRY/labs/lxc-gitlab-runner/ubuntu-20.04
  variables:
    OBS_REPO: knot-resolver-build
    DISTROTEST_REPO: xUbuntu_20.04
  script:
    - *debpkgbuild

nixos-unstable:pkgbuild:
  <<: *pkgbuild
  # We do NOT use LXC, for now at least.
  parallel:
    matrix:
      - PLATFORM: [ amd64, arm64 ]
  tags:
    - docker
    - linux
    - ${PLATFORM}
  image: nixos/nix

  variables:
    NIX_PATH: nixpkgs=https://github.com/nixos/nixpkgs/archive/nixos-unstable.tar.gz
  before_script:
  script:
    - nix-build '<nixpkgs>' -QA apkg
    # the image auto-detects as alpine distro
    # If apkg version differs (too much), it will fail to reuse archive and fail.
    - ./result/bin/apkg install -d nix
    - kresd --version
# }}}

# pkgtest {{{
.pkgtest: &pkgtest
  stage: pkgtest
  tags:
    - lxc
    - amd64

.debpkgtest: &debpkgtest
  - *pkgdebrepo
  - apt-get install -y knot-dnsutils
  - apt-get install -y $(find ./pkg/pkgs -name '*.deb' | grep -v module | grep -v debug | grep -v devel)
  - systemctl start kresd@1
  - kdig @127.0.0.1 nic.cz | grep -qi NOERROR

centos-7:pkgtest:
  <<: *pkgtest
  needs:
    - centos-7:pkgbuild
  image: $CI_REGISTRY/labs/lxc-gitlab-runner/centos-7
  before_script:
    - export LC_ALL=en_US.UTF-8
  script:
    - yum install -y epel-release
    - yum install -y knot-utils findutils
    - yum install -y $(find ./pkg/pkgs -name '*.rpm' | grep -v module | grep -v debug | grep -v devel)
    - systemctl start kresd@1
    - kdig @127.0.0.1 nic.cz | grep -qi NOERROR

debian-10:pkgtest:
  <<: *pkgtest
  needs:
    - debian-10:pkgbuild
  image: $CI_REGISTRY/labs/lxc-gitlab-runner/debian-10
  variables:
    OBS_REPO: knot-resolver-build
    DISTROTEST_REPO: Debian_10
  script:
    - *debpkgtest

debian-11:pkgtest:
  <<: *pkgtest
  needs:
    - debian-11:pkgbuild
  image: $CI_REGISTRY/labs/lxc-gitlab-runner/debian-11
  variables:
    OBS_REPO: knot-resolver-build
    DISTROTEST_REPO: Debian_11
  script:
    - *debpkgtest

fedora-34:pkgtest:
  <<: *pkgtest
  needs:
    - fedora-34:pkgbuild
  image: $CI_REGISTRY/labs/lxc-gitlab-runner/fedora-34
  script:
    - dnf install -y knot-utils findutils
    - dnf install -y $(find ./pkg/pkgs -name '*.rpm' | grep -v module | grep -v debug | grep -v devel)
    - systemctl start kresd@1
    - kdig @127.0.0.1 nic.cz | grep -qi NOERROR

fedora-35:pkgtest:
  <<: *pkgtest
  needs:
    - fedora-35:pkgbuild
  image: $CI_REGISTRY/labs/lxc-gitlab-runner/fedora-35
  script:
    - dnf install -y knot-utils findutils
    - dnf install -y $(find ./pkg/pkgs -name '*.rpm' | grep -v module | grep -v debug | grep -v devel)
    - systemctl start kresd@1
    - kdig @127.0.0.1 nic.cz | grep -qi NOERROR

rocky-8:pkgtest:
  <<: *pkgtest
  needs:
    - rocky-8:pkgbuild
  image: $CI_REGISTRY/labs/lxc-gitlab-runner/rocky-8
  script:
    - dnf install -y epel-release
    - dnf install -y knot-utils findutils
    - dnf install -y $(find ./pkg/pkgs -name '*.rpm' | grep -v module | grep -v debug | grep -v devel)
    - systemctl start kresd@1
    - kdig @127.0.0.1 nic.cz | grep -qi NOERROR

ubuntu-18.04:pkgtest:
  <<: *pkgtest
  needs:
    - ubuntu-18.04:pkgbuild
  image: $CI_REGISTRY/labs/lxc-gitlab-runner/ubuntu-18.04
  variables:
    OBS_REPO: knot-resolver-build
    DISTROTEST_REPO: xUbuntu_18.04
  script:
    - *debpkgtest

ubuntu-20.04:pkgtest:
  <<: *pkgtest
  needs:
    - ubuntu-20.04:pkgbuild
  image: $CI_REGISTRY/labs/lxc-gitlab-runner/ubuntu-20.04
  variables:
    OBS_REPO: knot-resolver-build
    DISTROTEST_REPO: xUbuntu_20.04
  script:
    - *debpkgtest
# }}}