-
Notifications
You must be signed in to change notification settings - Fork 38
164 lines (142 loc) · 4.85 KB
/
integration-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
name: Integration tests
on:
push:
branches: [main, hirte-*]
pull_request:
branches: [main, hirte-*]
workflow_dispatch:
jobs:
rpmbuild:
runs-on: ubuntu-latest
container:
image: quay.io/bluechi/build-base:latest
env:
ARTIFACTS_DIR: exported-artifacts
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'true'
# Use githash of a tested commit instead of merge commit
ref: ${{ github.event.pull_request.head.sha }}
- name: Mark source directory as safe
run: |
git config --global --add safe.directory $(pwd)
- name: Perform build
run: |
WITH_COVERAGE=1 ./build-scripts/build-rpm.sh $ARTIFACTS_DIR
- name: Create DNF repository
run: |
createrepo_c $ARTIFACTS_DIR
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: rpm-artifacts
path: ${{ env.ARTIFACTS_DIR}}
test:
needs: rpmbuild
runs-on: ubuntu-latest
steps:
- name: Increase inotify values
# Required to bypass error "Failed to allocate directory watch: Too many open files"
run: |
sudo sysctl -w fs.inotify.max_queued_events=32768
sudo sysctl -w fs.inotify.max_user_instances=2048
sudo sysctl -w fs.inotify.max_user_watches=1048576
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install \
genisoimage \
libkrb5-dev \
libvirt-daemon-system \
libvirt-dev \
pkg-config \
podman \
qemu-kvm \
-y
- name: Install unpackaged python libraries from PyPi
run: |
pip install "tmt[provision]>=1.32.1" "tmt[report-junit]>=1.32.1" podman pytest pyyaml paramiko
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: rpm-artifacts
path: 'tests/bluechi-rpms'
- name: Check integration test IDs
run: |
cd tests
tmt test id --dry | grep "New id" && echo "Found integration tests with missing ID. Please generate Test-IDs." && exit 1
cd ..
- name: Check for duplicate test IDs and summaries
run: |
cd tests
./scripts/duplicate-check.py
cd ..
- name: Run integration tests
run: |
cd tests
tmt run -v \
-eCONTAINER_USED=integration-test-local \
-eWITH_COVERAGE=1 \
-eLOG_LEVEL=DEBUG \
plan --name container
- name: Show tmt log output in case of failure
if: ${{ failure() }}
run: |
cat /var/tmp/tmt/run-001/log.txt
# Extract the collected coverage results if they exist and remove them from
# the tmt directory to avoid duplication in artifacts
- name: Extract coverage results
if: always()
run: |
MERGE_FILE="/var/tmp/tmt/run-001/plans/container/report/default-0/merged.info"
COVERAGE_DIR="/var/tmp/tmt/run-001/plans/container/report/default-0/report/"
if [ -d "$COVERAGE_DIR" ]; then
cp -r $COVERAGE_DIR /var/tmp
cp $MERGE_FILE /var/tmp
rm -rf $COVERAGE_DIR
rm -rf $MERGE_FILE
fi
- name: Upload tmt artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: tmt-artifacts
path: '/var/tmp/tmt'
- name: Upload coverage HTML report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-artifacts-html
path: '/var/tmp/report'
- name: Upload coverage file
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-artifacts-info
path: '/var/tmp/merged.info'
- name: Prepare the coverage report for coveralls
if: always()
run: |
sed 's/\/var\/tmp\/bluechi-coverage\/src/src/' /var/tmp/merged.info > /var/tmp/coveralls.info
- name: Report to Coveralls
if: always()
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: '/var/tmp/coveralls.info'
format: lcov
# Pin the version of the coverage reporter as suggested in
# https://github.com/coverallsapp/github-action/issues/205#issuecomment-2113945931
# TODO: Remove when the coverage reporter issue is resolved
coverage-reporter-version: v0.6.9