Skip to content

Validate and Test Build #204

Validate and Test Build

Validate and Test Build #204

Workflow file for this run

name: Validate and Test Build
on:
pull_request:
branches:
- main
- dev
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
env:
DOCKER_BUILDKIT: 1
PACMAN_CACHE: /tmp/pacman-cache
WORKSPACE: /workdir
BUILD_DIR: /workdir/workdir
OUTPUT_DIR: /workdir/out
jobs:
test-build:
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Arch Linux Container
run: |
mkdir -p ${{ env.PACMAN_CACHE }}
docker run --privileged --name arch-container -d \
-v ${{ github.workspace }}:${{ env.WORKSPACE }} \
-v ${{ env.PACMAN_CACHE }}:/var/cache/pacman/pkg \
archlinux:latest sleep infinity
- name: Install Dependencies
run: |
docker exec arch-container bash -c "
set -euo pipefail
pacman -Syu --noconfirm
pacman -S --noconfirm --needed git archiso grub qemu
"
- name: Test Build
id: build
run: |
docker exec arch-container bash -c "
set -euo pipefail
cd ${{ env.WORKSPACE }}
rm -rf ${{ env.BUILD_DIR }} ${{ env.OUTPUT_DIR }}
mkdir -p ${{ env.BUILD_DIR }} ${{ env.OUTPUT_DIR }}
mkarchiso -v -w ${{ env.BUILD_DIR }} -o ${{ env.OUTPUT_DIR }} .
"
- name: Verify ISO
run: |
docker exec arch-container bash -c "
set -euo pipefail
cd ${{ env.OUTPUT_DIR }}
# Check if ISO exists
iso_count=\$(ls -1 *.iso 2>/dev/null | wc -l)
if [ \$iso_count -eq 0 ]; then
echo '::error::No ISO file found'
exit 1
elif [ \$iso_count -gt 1 ]; then
echo '::error::Multiple ISO files found'
exit 1
fi
iso_file=\$(ls *.iso)
# Check ISO size (minimum 500MB)
size=\$(stat -c%s \"\$iso_file\")
if [ \$size -lt 524288000 ]; then
echo \"::error::ISO file too small: \$((\$size / 1024 / 1024))MB\"
exit 1
fi
# Verify ISO checksum
sha256sum \"\$iso_file\" > checksum.sha256
sha256sum -c checksum.sha256 || {
echo '::error::ISO checksum verification failed'
exit 1
}
# Generate additional checksums
md5sum \"\$iso_file\" > checksum.md5
sha1sum \"\$iso_file\" > checksum.sha1
"
- name: Clean Up
if: always()
run: |
if docker ps -a | grep -q arch-container; then
docker stop arch-container || true
docker rm -f arch-container || true
fi
sudo rm -rf ${{ env.BUILD_DIR }} ${{ env.OUTPUT_DIR }}
- name: Report Status
if: always()
run: |
if [ "${{ job.status }}" = "success" ]; then
echo "✅ Build check passed successfully"
else
echo "❌ Build check failed"
exit 1
fi