-
Notifications
You must be signed in to change notification settings - Fork 41
209 lines (187 loc) · 7.63 KB
/
review-checks.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
name: Validation
# If a pull-request is pushed then cancel all previously running jobs related
# to that pull-request
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
on:
push:
branches:
- python-3
pull_request:
jobs:
validate-docs:
env:
# https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
runs-on: ubuntu-latest
container:
image: centos:7
steps:
- uses: actions/checkout@v1
- name: Fixup CentOS repo files
run: |
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
- name: Install utils
run: |
yum install -y git wget ca-certificates
- name: Fetch Beaker repository
run: |
wget https://beaker-project.org/yum/beaker-server-RedHatEnterpriseLinux.repo -P /etc/yum.repos.d/
- name: Install Beaker dependency from specfile
run: |
yum-builddep *.spec -y
- name: Build documentation
run: |
make -C documentation html SPHINXOPTS="-W"
mv documentation/_build/html /__w
- uses: actions/upload-artifact@v3
with:
name: beaker-docs
path: /home/runner/work/html
integration-tests:
runs-on: ubuntu-latest
env:
MYSQL_USER: beaker
MYSQL_PASSWORD: beaker
MYSQL_ROOT_PASSWORD: toor
# https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
strategy:
fail-fast: false
matrix:
test-target: ["bkr.inttest.client", "bkr.inttest.labcontroller", "bkr.inttest.server"]
container:
image: centos:7
options: --init
services:
database:
image: mariadb:10-ubi
env:
MYSQL_USER: ${{ env.MYSQL_USER }}
MYSQL_PASSWORD: ${{ env.MYSQL_PASSWORD }}
MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_ROOT_PASSWORD }}
ports:
- 3306
steps:
- name: Fixup CentOS repo files
run: |
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
# We have to install git 2.18+ to perform checkout via git
# This is possible only via IUS repositories
- name: Install git to allow checkout
run: |
yum install https://repo.ius.io/ius-release-el7.rpm epel-release -y
yum install git236-core -y
# Do not upgrade to @v4 as node 20 is incompatible with CentOS 7
- name: Checkout
uses: actions/checkout@v3
# Remove custom git from the IUS repository - git will be reinstalled later as it is needed by beaker itself.
- name: Remove git236 and YUM repositories
run: yum remove git236-core ius-release epel-release -y
- name: Add Beaker Server YUM repository
run: |
curl -o /etc/yum.repos.d/beaker-server.repo https://beaker-project.org/yum/beaker-server-RedHatEnterpriseLinux.repo
- name: Install Beaker dependencies
run: |
yum install epel-release mariadb beaker-integration-tests -y
yum-builddep beaker.spec -y
yum remove beaker-common \
beaker-client \
beaker-lab-controller \
beaker-server \
beaker-integration-tests -y
- name: Checkout submodules
run: |
git submodule update --init --recursive
- name: Configure database for testing
run: |
cat <<EOT > init.sql
CREATE DATABASE beaker_test;
CREATE DATABASE beaker_migration_test;
GRANT ALL PRIVILEGES ON beaker_test.* TO 'beaker'@'%';
GRANT ALL PRIVILEGES ON beaker_migration_test.* TO 'beaker'@'%';
SET GLOBAL max_allowed_packet=1073741824;
SET GLOBAL character_set_server=utf8;
EOT
mysql -uroot -p${{ env.MYSQL_ROOT_PASSWORD }} -h database < init.sql
sed -i 's/@localhost/@database/g' IntegrationTests/server-test.cfg
- name: Update version
run: |
# Update the version in common/__init__.py, as this file is used in the application and tests to determine the version
current_version=$(grep -oE "__version__ = '[^']+'" Common/bkr/common/__init__.py | cut -d "'" -f 2)
new_version="$current_version.git.$(git rev-parse --short HEAD)"
sed -i "s/__version__ = '$current_version'/__version__ = '$new_version'/" Common/bkr/common/__init__.py
- name: Run integration tests for ${{ matrix.test-target }}
run: |
pushd IntegrationTests
# Disable Selenium tests until we have plan for selenium driver + firefox
rm -rf src/bkr/inttest/server/selenium
./run-tests.sh -v ${{ matrix.test-target }}
unit-tests:
runs-on: ubuntu-latest
env:
# https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
container:
image: ${{ matrix.os-target.name }}
options: --init
strategy:
fail-fast: false
matrix:
test-target:
- Common
- Client
- LabController
os-target:
- name: centos:7
- name: fedora:41
- name: quay.io/centos/centos:stream9
additional_repos: "crb"
additional_packages: "epel-release"
steps:
- name: Fixup CentOS repo files
if: matrix.os-target.name == 'centos:7'
run: |
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
- name: Set BKR_PY3 environment variable
run: echo "BKR_PY3=1" >> $GITHUB_ENV
if: matrix.os-target.name != 'centos:7'
- name: Install DNF and plugins
run: yum install -y dnf 'dnf-command(builddep)' 'dnf-command(config-manager)'
- name: Enable additional repositories
run: |
IFS=', ' read -r -a repos <<< "${{ matrix.os-target.additional_repos }}"
for repo in "${repos[@]}"; do
dnf config-manager --set-enabled $repo
done
- name: Install additional packages
run: |
IFS=', ' read -r -a packages <<< "${{ matrix.os-target.additional_packages }}"
for package in "${packages[@]}"; do
dnf install -y $package
done
# Do not upgrade to @v4 as node 20 is incompatible with CentOS 7
- name: Checkout
uses: actions/checkout@v3
- name: Add Beaker Server YUM repository
if: matrix.os-target.name == 'centos:7'
run: |
curl -o /etc/yum.repos.d/beaker-server.repo https://beaker-project.org/yum/beaker-server-RedHatEnterpriseLinux.repo
# Build dependencies must be sufficient, the same is done during RPM build
- name: Install Beaker dependency from specfile
run: |
dnf builddep -y *.spec
- name: Run unit tests
run: |
pushd ${{ matrix.test-target }}
./run-tests.sh