Skip to content

Commit ed0481e

Browse files
committed
infra: trigger anaconda Web UI integration tests on specific file changes
We want to make sure to not break the Web UI with changes which affect it, i.e. API changes, configuration file changes etc. Add a workflow which runs if the PR affects Anaconda (changes to pyanaconda), polls the packit COPR until it has the current PR version available, and then test-triggers a "anaconda PR" scenario.
1 parent 7d6d52a commit ed0481e

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# This workflow checks if the PR affects Anaconda (changes to pyanaconda folder),
2+
# polls the packit COPR until it has the current PR version
3+
# available, and then test-triggers an "anaconda PR" scenario.
4+
#
5+
# This workflow is inspired from:
6+
# https://github.com/cockpit-project/cockpit/blob/main/.github/workflows/trigger-anaconda.yml
7+
8+
name: Anaconda Web UI
9+
on:
10+
pull_request_target:
11+
# All file changes that might affect the Web UI
12+
paths:
13+
- 'pyanaconda/**'
14+
- '!pyanaconda/gui/**'
15+
- '!pyanaconda/tui/**'
16+
- 'anaconda.py'
17+
- 'data/anaconda.conf'
18+
- 'data/conf.d/**/'
19+
- 'data/profile.d/**'
20+
jobs:
21+
trigger:
22+
runs-on: ubuntu-22.04
23+
# the default workflow token cannot read our org membership, for deciding who is allowed to trigger tests
24+
environment: gh-cockpituous
25+
container: registry.fedoraproject.org/fedora:rawhide
26+
# this polls for a COPR build, which can take long
27+
timeout-minutes: 120
28+
29+
steps:
30+
- name: Install dependencies
31+
run: |
32+
dnf install -y git-core dnf-plugins-core || {
33+
sleep 60
34+
dnf install -y git-core dnf-plugins-core
35+
}
36+
37+
# Naively this should wait for github.event.pull_request.head.sha, but
38+
# that breaks on non-current branches, which packit merges to main with
39+
# an unpredictable SHA; so instead, wait until COPR has a build which is
40+
# newer than the PR push time. This assumes that this workflow always runs earlier
41+
# than the COPR srpm build finishes.
42+
- name: Wait for packit COPR build
43+
run: |
44+
set -ex
45+
PUSH_TIME=$(date --utc +%Y%m%d%H%M%S -d '${{ github.event.pull_request.head.repo.pushed_at }}')
46+
COPR_NAME="${{ github.event.pull_request.base.user.login }}-${{ github.event.pull_request.base.repo.name }}-${{ github.event.number }}"
47+
for _ in $(seq 60); do
48+
sleep 60;
49+
if dnf copr enable -y packit/$COPR_NAME &&
50+
out=$(dnf info --refresh --repo='copr:*anaconda*' anaconda) &&
51+
stamp=$(echo "$out" | awk '/^Release/ { split($3, v, "."); print substr(v[2], 0, 14)}' | head -1) &&
52+
[ "$stamp" -gt "$PUSH_TIME" ]; then
53+
exit 0
54+
fi
55+
done
56+
exit 1
57+
58+
- name: Trigger anaconda run
59+
run: |
60+
git clone --depth=1 https://github.com/cockpit-project/bots
61+
mkdir -p ~/.config/cockpit-dev
62+
echo '${{ secrets.COCKPITUOUS_TOKEN }}' > ~/.config/cockpit-dev/github-token
63+
bots/tests-trigger --repo ${{ github.repository }} ${{ github.event.number }} fedora-rawhide-boot/anaconda-pr-${{ github.event.number }}@rhinstaller/anaconda-webui

0 commit comments

Comments
 (0)