-
-
Notifications
You must be signed in to change notification settings - Fork 132
229 lines (200 loc) · 8.12 KB
/
unit_tests.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
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
name: Unit tests
on:
push:
branches:
- $default-branch
- development
- master
paths-ignore:
- varia/**
- '**.md'
- utils/prepare_rpm.sh
- .github/workflows/publish.yml
# Run tests for any PRs
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
##############################################################################
# macOS
macos:
name: Running unit tests on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-12
- macos-13
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Git clone repository
uses: actions/checkout@v4
- name: Install shellcheck
run: brew install shellcheck shunit2 bash-completion nmap
- name: install cpanm and Date::Parse
uses: perl-actions/install-with-cpanm@v1
with:
install: Date::Parse
- name: Run the unit tests
run: |
uname -a \
&& make unit_tests \
&& bash -c "source ./check_ssl_cert.completion && complete -p check_ssl_cert" \
&& make dist \
&& sudo make install_bash_completion && bash -c "source ./check_ssl_cert.completion && complete -p check_ssl_cert" \
&& if command -v shellcheck > /dev/null 2>&1 ; then shellcheck ./check_ssl_cert test/*.sh ; fi
##############################################################################
# Linuxes
linux:
# The host should always be linux
runs-on: ubuntu-latest
name: Running unit tests on ${{ matrix.distro }}
strategy:
fail-fast: false
matrix:
distro:
- 'debian:10'
- 'debian:11'
- 'debian:12'
- 'debian:testing'
- 'ubuntu:18.04'
- 'ubuntu:20.04'
- 'ubuntu:22.04'
- 'alpine:3.13'
- 'fedora:39'
- 'fedora:38'
include:
- distro: 'debian:testing'
pre: >-
apt-get update &&
DEBIAN_FRONTEND=noninteractive apt-get -y install nmap shellcheck curl sudo perl make bzip2 file openssl dnsutils shunit2 man net-tools bc bash-completion default-jre
- distro: 'debian:10'
pre: >-
apt-get update &&
DEBIAN_FRONTEND=noninteractive apt-get -y install nmap shellcheck curl sudo perl make bzip2 file openssl dnsutils shunit2 man bc bash-completion default-jre
- distro: 'debian:11'
pre: >-
apt-get update &&
DEBIAN_FRONTEND=noninteractive apt-get -y install nmap shellcheck curl sudo perl make bzip2 file openssl dnsutils shunit2 man bc bash-completion iproute2 default-jre
- distro: 'debian:12'
pre: >-
apt-get update &&
DEBIAN_FRONTEND=noninteractive apt-get -y install nmap shellcheck curl sudo perl make bzip2 file openssl dnsutils shunit2 man bc bash-completion iproute2 default-jre
- distro: 'ubuntu:18.04'
pre: >-
apt-get update &&
DEBIAN_FRONTEND=noninteractive apt-get -y install nmap shellcheck curl sudo perl make bzip2 file openssl dnsutils shunit2 man bc net-tools bash-completion default-jre
- distro: 'ubuntu:20.04'
pre: >-
apt-get update &&
DEBIAN_FRONTEND=noninteractive apt-get -y install nmap shellcheck curl sudo perl make bzip2 file openssl dnsutils shunit2 man bc net-tools bash-completion default-jre
- distro: 'ubuntu:22.04'
pre: >-
apt-get update &&
DEBIAN_FRONTEND=noninteractive apt-get -y install nmap shellcheck curl sudo perl make bzip2 file openssl dnsutils shunit2 man bc net-tools bash-completion default-jre
- distro: 'alpine:3.13'
pre: >-
apk update &&
apk upgrade &&
apk add -U bash &&
apk add nmap shellcheck curl sudo perl make wget bzip2 file openssl bind-tools git shunit2 mandoc bc bash-completion openjdk11
- distro: 'fedora:39'
pre: >-
dnf upgrade -y &&
dnf install -y hostname &&
dnf install -y nmap ShellCheck curl sudo perl make bzip2 file openssl bind-utils git shunit2 man bc net-tools bash-completion java-latest-openjdk
- distro: 'fedora:38'
pre: >-
dnf upgrade -y &&
dnf install -y hostname &&
dnf install -y nmap ShellCheck curl sudo perl make bzip2 file openssl bind-utils git shunit2 man bc net-tools bash-completion java-latest-openjdk
steps:
- name: Git clone repository
uses: actions/checkout@v4
- name: Run the unit tests on ${{ matrix.distro }}
env:
PRE: ${{ matrix.pre }}
run: |
echo $PRE > ./prep-cmd.sh
docker run --network host -w /check_ssl_cert -v ${PWD}:/check_ssl_cert ${{ matrix.distro }} \
/bin/sh -c 'sh ./prep-cmd.sh \
&& curl -L https://cpanmin.us | sudo perl - --sudo App::cpanminus \
&& cpanm --sudo install Date::Parse \
&& uname -a \
&& make unit_tests \
&& bash -c "source ./check_ssl_cert.completion && complete -p check_ssl_cert" \
&& make dist \
&& sudo make install_bash_completion && bash -c "source ./check_ssl_cert.completion && complete -p check_ssl_cert" \
&& if command -v shellcheck > /dev/null 2>&1 ; then shellcheck ./check_ssl_cert test/*.sh ; fi'
rpm:
# The host should always be linux
runs-on: ubuntu-latest
name: Running RPM tests on ${{ matrix.distro }}
strategy:
fail-fast: false
matrix:
distro:
- 'centos:7'
- 'fedora:39'
- 'fedora:38'
include:
- distro: 'fedora:39'
pre: >-
dnf install -y hostname &&
dnf install -y nmap ShellCheck curl sudo perl make bzip2 file openssl bind-utils rpm-build git bash-completion
- distro: 'fedora:38'
pre: >-
dnf install -y hostname &&
dnf install -y nmap ShellCheck curl sudo perl make bzip2 file openssl bind-utils rpm-build git bash-completion
- distro: 'centos:7'
pre: >-
yum install -y nmap curl sudo perl make bzip2 file openssl dig perl-ExtUtils-MakeMaker perl-Test-Simple rpm-build bash-completion
steps:
- name: Git clone repository
uses: actions/checkout@v4
- name: Build the RPM on ${{ matrix.distro }}
env:
PRE: ${{ matrix.pre }}
run: |
echo $PRE > ./prep-cmd.sh
docker run --network host -w /check_ssl_cert -v ${PWD}:/check_ssl_cert ${{ matrix.distro }} \
/bin/sh -c 'sh ./prep-cmd.sh \
&& uname -a \
&& make rpm'
rpm-nocompletion:
# The host should always be linux
runs-on: ubuntu-latest
name: Running RPM tests without bash completion on ${{ matrix.distro }}
strategy:
fail-fast: false
matrix:
distro:
- 'centos:7'
- 'fedora:39'
- 'fedora:38'
include:
- distro: 'fedora:39'
pre: >-
dnf install -y hostname &&
dnf install -y nmap ShellCheck curl sudo perl make bzip2 file openssl bind-utils rpm-build git
- distro: 'fedora:38'
pre: >-
dnf install -y hostname &&
dnf install -y nmap ShellCheck curl sudo perl make bzip2 file openssl bind-utils rpm-build git
- distro: 'centos:7'
pre: >-
yum install -y nmap curl sudo perl make bzip2 file openssl dig perl-ExtUtils-MakeMaker perl-Test-Simple rpm-build
steps:
- name: Git clone repository
uses: actions/checkout@v4
- name: Build the RPM on ${{ matrix.distro }}
env:
PRE: ${{ matrix.pre }}
run: |
echo $PRE > ./prep-cmd.sh
docker run --network host -w /check_ssl_cert -v ${PWD}:/check_ssl_cert ${{ matrix.distro }} \
/bin/sh -c 'sh ./prep-cmd.sh \
&& uname -a \
&& make rpm'