Skip to content

Commit 23d4803

Browse files
authored
add distgen check to CI tests (#485)
It will be ran with the pull request tests. It will fail the testsuite before running actual tests if the content was not regenerated properly in the PR.
1 parent 6009f6a commit 23d4803

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

.github/workflows/container-tests.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,52 @@ on:
33
types:
44
- created
55
jobs:
6+
distgen-check:
7+
name: "Check distgen generated files"
8+
runs-on: ubuntu-20.04
9+
if: |
10+
github.event.issue.pull_request
11+
&& (contains(github.event.comment.body, '[test]') || contains(github.event.comment.body, '[test-all]'))
12+
&& contains(fromJson('["OWNER", "MEMBER"]'), github.event.comment.author_association)
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v2
16+
with:
17+
ref: "refs/pull/${{ github.event.issue.number }}/head"
18+
submodules: true
19+
20+
- name: Check distgen generated files
21+
id: check
22+
shell: bash
23+
run: |
24+
sha=$(git rev-parse HEAD)
25+
sudo apt update && sudo apt -y install python3-pip
26+
pip3 install distgen
27+
result="success"
28+
./common/tests/check_distgen_generated_files.sh || result="failure"
29+
echo "result=$result" >> "$GITHUB_OUTPUT"
30+
echo "sha=$sha" >> "$GITHUB_OUTPUT"
31+
32+
- name: Set final commit status
33+
uses: myrotvorets/[email protected]
34+
with:
35+
status: ${{ steps.check.outputs.result }}
36+
context: "Distgen check"
37+
sha: ${{ steps.check.outputs.sha }}
38+
39+
- name: Exit on ERR
40+
shell: bash
41+
run: |
42+
_result=${{ steps.check.outputs.result }}
43+
if [ "$_result" == failure ]; then
44+
echo "Distgen-generated files are not regenerated properly."
45+
echo "Please regenerate them with:"
46+
echo "'make clean-versions'"
47+
echo "'make generate-all'"
48+
exit 1
49+
fi
650
container-tests:
51+
needs: distgen-check
752
# This job only runs for '[test]' pull request comments by owner, member
853
runs-on: ubuntu-20.04
954
name: "Container tests: ${{ matrix.version }} - ${{ matrix.context }}"

.github/workflows/openshift-tests.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,31 @@ on:
33
types:
44
- created
55
jobs:
6+
distgen-check:
7+
name: "Check distgen generated files"
8+
runs-on: ubuntu-20.04
9+
if: |
10+
github.event.issue.pull_request
11+
&& (contains(github.event.comment.body, '[test]') || contains(github.event.comment.body, '[test-all]'))
12+
&& contains(fromJson('["OWNER", "MEMBER"]'), github.event.comment.author_association)
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v2
16+
with:
17+
ref: "refs/pull/${{ github.event.issue.number }}/head"
18+
submodules: true
19+
20+
- name: Check distgen generated files
21+
id: check
22+
shell: bash
23+
run: |
24+
sudo apt update && sudo apt -y install python3-pip
25+
pip3 install distgen
26+
result="success"
27+
./common/tests/check_distgen_generated_files.sh
28+
629
openshift-tests:
30+
needs: distgen-check
731
# This job only runs for '[test-all]' or '[test-openshift] pull request comments by owner, member
832
name: "OpenShift tests: ${{ matrix.version }} - ${{ matrix.context }}"
933
runs-on: ubuntu-20.04

0 commit comments

Comments
 (0)