Skip to content

Commit 4461afb

Browse files
Refactor Dockerfile check workflow to improve environment setup, build process, and validation steps
1 parent 21abd24 commit 4461afb

File tree

1 file changed

+45
-6
lines changed

1 file changed

+45
-6
lines changed

.github/workflows/dockerfile-check.yaml

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,57 @@ on:
66
workflow_dispatch:
77
schedule:
88
# Run the workflow on the 1st of every month at midnight
9-
- cron: 0 0 * * *
9+
- cron: '0 0 1 * *'
1010

1111
jobs:
1212
build:
13-
runs-on: ubuntu-latest # Use a standard runner
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 120 # Add a timeout to prevent hung builds
1415

1516
steps:
1617
- name: Checkout Repository
1718
uses: actions/checkout@v4
1819

19-
- name: Build and Run Docker container
20+
- name: Set up Environment
2021
run: |
21-
set -e # Exit immediately if a command exits with a non-zero status
22-
docker build -t arch-iso-builder . || { echo "Docker build failed"; exit 1; }
23-
docker run --rm --privileged -v "$(pwd)":/workdir arch-iso-builder bash -c "mkarchiso -v -w workdir/ -o out/ ." || { echo "ISO creation failed"; exit 1; }
22+
echo "Setting up environment..."
23+
mkdir -p out
24+
chmod +x scripts/entrypoint.sh
25+
chmod +x scripts/select-mirrors.sh
26+
chmod +x profiledef.sh
27+
28+
- name: Build Docker Image
29+
run: |
30+
echo "Building Docker image..."
31+
docker build -t arch-iso-builder . || {
32+
echo "::error::Docker build failed"
33+
exit 1
34+
}
35+
36+
- name: Validate Configuration
37+
run: |
38+
echo "Validating configuration..."
39+
docker run --rm -v "$(pwd)":/workdir arch-iso-builder validate || {
40+
echo "::error::Configuration validation failed"
41+
exit 1
42+
}
43+
44+
- name: Build ISO
45+
run: |
46+
echo "Building ISO..."
47+
# Create a small-scale test build with output to verify the process works
48+
docker run --rm --privileged \
49+
-v "$(pwd)":/workdir \
50+
arch-iso-builder build out work || {
51+
echo "::error::ISO build failed"
52+
exit 1
53+
}
54+
55+
# Verify that output directory contains files
56+
if [ ! -d "out" ] || [ -z "$(ls -A out 2>/dev/null)" ]; then
57+
echo "::error::Output directory is empty or does not exist"
58+
exit 1
59+
else
60+
echo "ISO build process completed successfully!"
61+
ls -la out
62+
fi

0 commit comments

Comments
 (0)