Skip to content

Commit da05c19

Browse files
committed
ci: run selenium tests
Signed-off-by: Martin Styk <[email protected]>
1 parent f8ee351 commit da05c19

File tree

1 file changed

+131
-0
lines changed

1 file changed

+131
-0
lines changed

.github/workflows/review-checks.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,134 @@ jobs:
223223
run: |
224224
pushd ${{ matrix.test-target }}
225225
./run-tests.sh
226+
227+
228+
selenium-integration-tests:
229+
runs-on: ubuntu-latest
230+
env:
231+
MYSQL_USER: beaker
232+
MYSQL_PASSWORD: beaker
233+
MYSQL_ROOT_PASSWORD: toor
234+
permissions:
235+
checks: write
236+
strategy:
237+
fail-fast: false
238+
matrix:
239+
group: [
240+
"test_activity,test_add_system,test_csv_export,test_csv_import,test_csv_roundtrip,test_distro_family,test_distro_search,test_distro_trees,test_distros,test_grid,test_group_edit",
241+
"test_groups,test_help,test_item_count,test_job_ack,test_job_cancel,test_job_delete,test_job_delete_xmlrpc,test_job_export_xml,test_job_matrix,test_job_search,test_jobs",
242+
"test_jobs_old,test_jobs_xmlrpc,test_keytypes,test_labcontrollers,test_log_upload,test_login,test_motd,test_my_menu_tests,test_osversions,test_power_types,test_prefs",
243+
"test_product,test_recipe_search,test_recipes,test_recipes_old,test_recipes_xmlrpc,test_recipetasks,test_recipetasks_xmlrpc,test_reserve_report,test_reserve_system,test_retentiontag,test_system_access_policies",
244+
"test_system_actions,test_system_availability,test_system_commands,test_system_loan,test_system_menu_tests,test_system_note,test_system_pools,test_system_provision,test_system_quickinfo,test_system_return,test_system_search",
245+
"test_system_view,test_systems,test_systems_xmlrpc,test_task_by_name,test_task_search,test_taskactions_xmlrpc,test_tasks,test_users,test_watchdogs,test_xmlrpc"
246+
]
247+
test-target: ["bkr.inttest.server.selenium"]
248+
container:
249+
image: centos:7
250+
options: --init
251+
volumes:
252+
- /node20217:/node20217:rw,rshared
253+
- /node20217:/__e/node20:ro,rshared
254+
services:
255+
database:
256+
image: mariadb:10-ubi
257+
env:
258+
MYSQL_USER: ${{ env.MYSQL_USER }}
259+
MYSQL_PASSWORD: ${{ env.MYSQL_PASSWORD }}
260+
MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_ROOT_PASSWORD }}
261+
ports:
262+
- 3306
263+
steps:
264+
- name: Fetch Node 20
265+
run: |
266+
curl -LO https://unofficial-builds.nodejs.org/download/release/v20.9.0/node-v20.9.0-linux-x64-glibc-217.tar.xz
267+
tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217
268+
- name: Fixup CentOS repo files
269+
run: |
270+
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
271+
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
272+
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
273+
274+
# We have to install git 2.18+ to perform checkout via git
275+
# This is possible only via IUS repositories
276+
- name: Install git to allow checkout
277+
run: |
278+
yum install https://repo.ius.io/ius-release-el7.rpm epel-release -y
279+
yum install git236-core -y
280+
281+
- name: Checkout
282+
uses: actions/checkout@v4
283+
284+
# Remove custom git from the IUS repository - git will be reinstalled later as it is needed by beaker itself.
285+
- name: Remove git236 and YUM repositories
286+
run: yum remove git236-core ius-release epel-release -y
287+
288+
- name: Add Beaker Server YUM repository
289+
run: |
290+
curl -o /etc/yum.repos.d/beaker-server.repo https://beaker-project.org/yum/beaker-server-RedHatEnterpriseLinux.repo
291+
292+
- name: Install Beaker dependencies
293+
run: |
294+
yum install bzip2 ca-certificates wget epel-release mariadb beaker-integration-tests -y
295+
yum-builddep beaker.spec -y
296+
yum remove beaker-common \
297+
beaker-client \
298+
beaker-lab-controller \
299+
beaker-server \
300+
beaker-integration-tests -y
301+
302+
- name: Checkout submodules
303+
run: |
304+
git submodule update --init --recursive
305+
306+
- name: Configure database for testing
307+
run: |
308+
cat <<EOT > init.sql
309+
CREATE DATABASE beaker_test;
310+
CREATE DATABASE beaker_migration_test;
311+
GRANT ALL PRIVILEGES ON beaker_test.* TO 'beaker'@'%';
312+
GRANT ALL PRIVILEGES ON beaker_migration_test.* TO 'beaker'@'%';
313+
SET GLOBAL max_allowed_packet=1073741824;
314+
SET GLOBAL character_set_server=utf8;
315+
EOT
316+
317+
mysql -uroot -p${{ env.MYSQL_ROOT_PASSWORD }} -h database < init.sql
318+
sed -i 's/@localhost/@database/g' IntegrationTests/server-test.cfg
319+
320+
- name: Update version
321+
run: |
322+
# Update the version in common/__init__.py, as this file is used in the application and tests to determine the version
323+
current_version=$(grep -oE "__version__ = '[^']+'" Common/bkr/common/__init__.py | cut -d "'" -f 2)
324+
new_version="$current_version.git.$(git rev-parse --short HEAD)"
325+
sed -i "s/__version__ = '$current_version'/__version__ = '$new_version'/" Common/bkr/common/__init__.py
326+
327+
- name: Install Firefox
328+
run: |
329+
yum remove firefox -y
330+
yum install gtk2 -y
331+
332+
# Downloading Firefox from the official website
333+
wget https://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0.4/linux-x86_64/en-US/firefox-43.0.4.tar.bz2
334+
335+
# Extract the tarball
336+
tar xvjf firefox-43.0.4.tar.bz2
337+
338+
# Move Firefox to a directory in PATH
339+
mv firefox /usr/local/bin/
340+
341+
# Link the firefox binary to a location in PATH
342+
ln -s /usr/local/bin/firefox/firefox /usr/bin/firefox
343+
344+
- name: Run integration tests for ${{ matrix.test-target }}
345+
run: |
346+
pushd IntegrationTests
347+
mkdir -p results
348+
for test_file in $(echo "${{ matrix.group }}" | tr ',' '\n'); do
349+
./run-tests.sh --with-xunit --xunit-file=results/${test_file}.xml -v ${{ matrix.test-target }}.${test_file} || :
350+
done
351+
352+
- name: Publish Test Report
353+
uses: mikepenz/action-junit-report@v5
354+
if: success() || failure()
355+
with:
356+
report_paths: '**/results/test_*.xml'

0 commit comments

Comments
 (0)