Skip to content

Commit

Permalink
add distgen check to CI tests (#485)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zmiklank authored Jan 20, 2023
1 parent 6009f6a commit 23d4803
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/container-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,52 @@ on:
types:
- created
jobs:
distgen-check:
name: "Check distgen generated files"
runs-on: ubuntu-20.04
if: |
github.event.issue.pull_request
&& (contains(github.event.comment.body, '[test]') || contains(github.event.comment.body, '[test-all]'))
&& contains(fromJson('["OWNER", "MEMBER"]'), github.event.comment.author_association)
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: "refs/pull/${{ github.event.issue.number }}/head"
submodules: true

- name: Check distgen generated files
id: check
shell: bash
run: |
sha=$(git rev-parse HEAD)
sudo apt update && sudo apt -y install python3-pip
pip3 install distgen
result="success"
./common/tests/check_distgen_generated_files.sh || result="failure"
echo "result=$result" >> "$GITHUB_OUTPUT"
echo "sha=$sha" >> "$GITHUB_OUTPUT"
- name: Set final commit status
uses: myrotvorets/[email protected]
with:
status: ${{ steps.check.outputs.result }}
context: "Distgen check"
sha: ${{ steps.check.outputs.sha }}

- name: Exit on ERR
shell: bash
run: |
_result=${{ steps.check.outputs.result }}
if [ "$_result" == failure ]; then
echo "Distgen-generated files are not regenerated properly."
echo "Please regenerate them with:"
echo "'make clean-versions'"
echo "'make generate-all'"
exit 1
fi
container-tests:
needs: distgen-check
# This job only runs for '[test]' pull request comments by owner, member
runs-on: ubuntu-20.04
name: "Container tests: ${{ matrix.version }} - ${{ matrix.context }}"
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/openshift-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,31 @@ on:
types:
- created
jobs:
distgen-check:
name: "Check distgen generated files"
runs-on: ubuntu-20.04
if: |
github.event.issue.pull_request
&& (contains(github.event.comment.body, '[test]') || contains(github.event.comment.body, '[test-all]'))
&& contains(fromJson('["OWNER", "MEMBER"]'), github.event.comment.author_association)
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: "refs/pull/${{ github.event.issue.number }}/head"
submodules: true

- name: Check distgen generated files
id: check
shell: bash
run: |
sudo apt update && sudo apt -y install python3-pip
pip3 install distgen
result="success"
./common/tests/check_distgen_generated_files.sh
openshift-tests:
needs: distgen-check
# This job only runs for '[test-all]' or '[test-openshift] pull request comments by owner, member
name: "OpenShift tests: ${{ matrix.version }} - ${{ matrix.context }}"
runs-on: ubuntu-20.04
Expand Down

0 comments on commit 23d4803

Please sign in to comment.