Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHA: test build-only/release mode #206

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,30 @@ jobs:
steps:
- uses: actions/checkout@v4

- run: ./test/gha-build-iso.sh
- run: ./test/gha-build-iso.sh initial
name: "Build ISO on ${{matrix.host_release}}"
env:
HOST_RELEASE: ${{matrix.host_release}}

- name: Archive built ISO
if: always()
uses: actions/upload-artifact@v4
with:
name: grml-live-build-result-${{matrix.host_release}}
name: grml-live-build-result-initial-${{matrix.host_release}}
if-no-files-found: error
path: |
results/*
results-initial/*

- run: ./test/gha-build-iso.sh build-only-twice
name: "Repack ISO twice on ${{matrix.host_release}}"
env:
HOST_RELEASE: ${{matrix.host_release}}

- name: Archive repacked ISO
if: always()
uses: actions/upload-artifact@v4
with:
name: grml-live-build-result-repack-${{matrix.host_release}}
if-no-files-found: error
path: |
results-build-only-second/*
72 changes: 63 additions & 9 deletions test/gha-build-iso.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@

set -euxo pipefail

cat >build-gha-ci-test-config <<EOT
---
last_release: "2024.02"
EOT
MODE=$1

# Install as little Debian packages as possible,
# we do not want to test *Debian*.
Expand All @@ -21,10 +18,67 @@ PACKAGES install ARM64
linux-image-arm64
EOT

# Note: file ownership inside docker is "wrong", and then git will fail.
# As a workaround we set safe.directory to ignore the ownership issues.
cat >build-gha-ci-test-config-initial <<EOT
---
last_release: "2024.02"
EOT

run_build() {
local config_filename
config_filename=$1
local build_mode
build_mode=$2
local results_directory
results_directory=$3

docker run -i --rm --volume "${PWD}:/source" -e SKIP_SOURCES=1 -e DO_DAILY_UPLOAD=0 -w /source debian:"$HOST_RELEASE" \
bash -c \
"apt-get update -qq && apt-get satisfy -q -y --no-install-recommends 'git, ca-certificates' \
&& git config --global --add safe.directory /source \
&& /source/build-driver/build /source ${build_mode} /source/${config_filename} ghaci amd64 testing"

sudo chmod -R a+rX results
sudo mv results "${results_directory}"
}


if [ "$MODE" = "initial" ]; then

# Note: file ownership inside docker is "wrong", and then git will fail.
# As a workaround we set safe.directory to ignore the ownership issues.

run_build build-gha-ci-test-config-initial daily results-initial

elif [ "$MODE" = "build-only-twice" ]; then
INPUT_ISO=$(ls results-initial/grml_isos/grml*iso)
cat >build-gha-ci-test-config-build-only-first <<EOT
---
last_release: "2024.02"
debian_suite: testing
release_version: "ci-bo-first"
release_name: CI1
base_iso:
ghaci:
amd64: "file:///source/$INPUT_ISO"
EOT

run_build build-gha-ci-test-config-build-only-first release results-build-only-first

INPUT_ISO=$(ls results-build-only-first/grml_isos/grml*iso)
cat >build-gha-ci-test-config-build-only-second <<EOT
---
last_release: "2024.02"
debian_suite: testing
release_version: "ci-bo-second"
release_name: CI2
base_iso:
ghaci:
amd64: "file:///source/$INPUT_ISO"
EOT

docker run -i --rm --volume "${PWD}:/source" -e SKIP_SOURCES=1 -e DO_DAILY_UPLOAD=0 -w /source debian:"$HOST_RELEASE" bash -c \
"apt-get update -qq && apt-get satisfy -q -y --no-install-recommends 'git, ca-certificates' && git config --global --add safe.directory /source && /source/build-driver/build /source daily /source/build-gha-ci-test-config ghaci amd64 testing"
run_build build-gha-ci-test-config-build-only-second release results-build-only-second

sudo chmod -R a+rX results
else
echo "E: unsupported \$MODE $MODE"
exit 1
fi
Loading