Skip to content

Commit

Permalink
github: check source prep before running gitlab CI
Browse files Browse the repository at this point in the history
The source preparation script now generates the gitalb-ci.yml and checks
that it's up to date with new image configurations.  Don't run gitlab CI
tests if the source prep check doesn't succeed since it might end up
testing the wrong thing (distros that have been removed, for example).

Also, we need build dependencies to run the script now since it
compiles and runs the list-images command.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
  • Loading branch information
achilleas-k committed Apr 11, 2024
1 parent fc4c601 commit ec3de25
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 31 deletions.
40 changes: 37 additions & 3 deletions .github/workflows/gitlab-helper.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This workflow runs on PRs and the merge queue and is only responsible for
# starting the "Start GitLab CI" workflow in a way that makes it possible to
# use secrets.
# This workflow runs on PRs and the merge queue and is responsible for starting
# the "Start GitLab CI" workflow in a way that makes it possible to use
# secrets. The workflow first runs source preparation to make sure that the
# gitlab-ci.yml is up to date.
---
name: GitLab

Expand All @@ -12,6 +13,39 @@ on:
merge_group:

jobs:
prepare:
name: "🔍 Check source preparation"
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.20
uses: actions/setup-go@v5
with:
go-version: "1.20"
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Install dependencies
run: |
sudo apt update
sudo apt install -y libgpgme-dev libbtrfs-dev libdevmapper-dev
- name: Check that source has been prepared
run: |
./tools/prepare-source.sh
if [ -n "$(git status --porcelain)" ]; then
echo
echo "Please include these changes in your branch: "
git status -vv
exit "1"
else
exit "0"
fi
gitlab-ci-helper:
name: "Gitlab CI trigger helper"
runs-on: ubuntu-latest
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,34 +136,6 @@ jobs:
version: v1.54.2
args: --verbose --timeout 5m0s

prepare:
name: "🔍 Check source preparation"
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.20
uses: actions/setup-go@v5
with:
go-version: "1.20"
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Check that source has been prepared
run: |
./tools/prepare-source.sh
if [ -n "$(git status --porcelain)" ]; then
echo
echo "Please include these changes in your branch: "
git status -vv
exit "1"
else
exit "0"
fi
shellcheck:
name: "🐚 Shellcheck"
runs-on: ubuntu-latest
Expand Down

0 comments on commit ec3de25

Please sign in to comment.