Build ISO on hosted runner (CUDA, gui) #152
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build ISO on hosted runner (CUDA, gui) | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cleanup | |
uses: rokibhasansagar/slimhub_actions@main | |
with: | |
retain: "docker_buildkit,docker_imgcache" | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Build image | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: archlinux:latest | |
options: --privileged --volume ${{ github.workspace }}:/workspace | |
run: | | |
# Exit on error | |
set -eu | |
# Enter project directory | |
pushd /workspace | |
# Install dependencies | |
.ci/dependencies.sh | |
# Patch mkarchiso | |
.ci/mkarchiso.sh | |
# Configure to use CUDA | |
.ci/configure.py cuda gui | |
popd | |
# Number of retries | |
MAX_RETRIES=5 | |
# Try to build image | |
for ((i=1; i<=MAX_RETRIES; i++)); do | |
# Do not exit on error | |
set +e | |
# Build image | |
mkarchiso -v -m iso -w /_work -o /workspace/out /workspace | |
# Capture exit code | |
STATUS=$? | |
# Exit on error | |
set -e | |
# Check if build succeeded | |
if [ $STATUS -eq 0 ]; then | |
echo "Build succeeded" | |
break | |
fi | |
# Print failure message and retry | |
echo "Build failed. Retry $i/$MAX_RETRIES" | |
# Remove build directory | |
rm -rf /_work | |
done | |
# Check if maximum retries were exhausted | |
if [ $STATUS -ne 0 ]; then | |
echo "Build failed after $MAX_RETRIES attempts" | |
exit 1 | |
fi | |
- name: Create summary | |
run: | | |
# Exit on error | |
set -eu | |
# Start code section | |
echo '`' > "$GITHUB_STEP_SUMMARY" | |
# Print checksums | |
sha256sum out/* | sed 's/out\///' >> "$GITHUB_STEP_SUMMARY" | |
# End code section | |
echo '`' >> "$GITHUB_STEP_SUMMARY" | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: archiso-output | |
path: out/ |