3535 self-compile :
3636 name : Self-compile with ARK CLI (nuitka)
3737 runs-on : ubuntu-latest
38+ timeout-minutes : 45
39+ permissions :
40+ contents : read
41+ concurrency :
42+ group : ark-self-build-${{ github.ref }}
43+ cancel-in-progress : true
3844 env :
3945 QT_QPA_PLATFORM : offscreen
4046 PYTHONUNBUFFERED : " 1"
47+ ARK_BIN : " python3 pycompiler_ark.py"
48+ WORKSPACE_DIR : " ${{ github.workspace }}"
49+ ENTRYPOINT_FILE : " ${{ github.workspace }}/pycompiler_ark.py"
50+ REPORT_DIR : " ${{ github.workspace }}/.ark_ci_artifacts"
4151 steps :
4252 - name : Checkout repository
4353 uses : actions/checkout@v4
@@ -57,45 +67,123 @@ jobs:
5767
5868 - name : Install system tools for CI precheck + Nuitka
5969 run : |
60- sudo apt-get update
61- sudo apt-get install -y patchelf cloc
70+ set -euo pipefail
71+ for attempt in 1 2 3; do
72+ if sudo apt-get update && sudo apt-get install -y patchelf cloc; then
73+ exit 0
74+ fi
75+ echo "apt attempt ${attempt} failed, retrying..."
76+ sleep $((attempt * 4))
77+ done
78+ echo "apt install failed after retries"
79+ exit 1
6280
6381 - name : Install build engine dependencies (Nuitka)
6482 run : |
6583 python -m pip install nuitka
6684
67- - name : ARK self-build pipeline
68- shell : bash
85+ - name : Prepare report directory
6986 run : |
70- set -euo pipefail
71- ARK_BIN="python3 pycompiler_ark.py"
72- WORKSPACE_DIR="$GITHUB_WORKSPACE"
73- ENTRYPOINT_FILE="$WORKSPACE_DIR/pycompiler_ark.py"
74- REPORT_DIR="$WORKSPACE_DIR/.ark_ci_artifacts"
75-
7687 mkdir -p "$REPORT_DIR"
7788
78- echo "[1/7] init workspace"
89+ - name : " [1/8] Init workspace (+venv)"
90+ shell : bash
91+ run : |
92+ set -euo pipefail
7993 $ARK_BIN init "$WORKSPACE_DIR" --with-venv --json > "$REPORT_DIR/init.json"
8094
81- echo "[2/7] auto-config entrypoint"
95+ - name : " [2/8] Auto-config entrypoint"
96+ shell : bash
97+ run : |
98+ set -euo pipefail
8299 $ARK_BIN cfg-auto "$WORKSPACE_DIR" --entrypoint "pycompiler_ark.py" --json > "$REPORT_DIR/cfg_auto.json"
83100
84- echo "[3/7] strict precheck (fail-fast)"
85- $ARK_BIN check "$WORKSPACE_DIR" --json --strict > "$REPORT_DIR/check.json"
101+ - name : " [3/8] Strict precheck (fail-fast)"
102+ shell : bash
103+ run : |
104+ set -euo pipefail
105+ $ARK_BIN check "$WORKSPACE_DIR" --json --strict --require-entrypoint > "$REPORT_DIR/check.json"
86106
87- echo "[4/7] target engine info"
107+ - name : " [4/8] Engine info (nuitka)"
108+ shell : bash
109+ run : |
110+ set -euo pipefail
88111 $ARK_BIN engine info nuitka --workspace "$WORKSPACE_DIR" --json > "$REPORT_DIR/engine_info.json"
89112
90- echo "[5/7] optional doctor snapshot"
113+ - name : " [5/8] Doctor snapshot"
114+ shell : bash
115+ run : |
116+ set -euo pipefail
91117 $ARK_BIN doctor --json > "$REPORT_DIR/doctor.json"
92118
93- echo "[6/7] self-build using ARK -> Nuitka"
119+ - name : " [6/8] Compile ARK using ARK (Nuitka)"
120+ shell : bash
121+ run : |
122+ set -euo pipefail
94123 $ARK_BIN engine compile nuitka "$ENTRYPOINT_FILE" --workspace "$WORKSPACE_DIR" --json > "$REPORT_DIR/build_result.json"
95124
96- echo "[7/7] post-build workspace snapshot"
125+ - name : " [7/8] Workspace inspect snapshot"
126+ shell : bash
127+ run : |
128+ set -euo pipefail
97129 $ARK_BIN workspace inspect "$WORKSPACE_DIR" --json > "$REPORT_DIR/workspace_inspect.json"
98130
131+ - name : " [8/8] Validate JSON payloads and build result"
132+ shell : bash
133+ run : |
134+ set -euo pipefail
135+ python - <<'PY'
136+ import json
137+ from pathlib import Path
138+
139+ report_dir = Path(".ark_ci_artifacts")
140+ required = [
141+ "init.json",
142+ "cfg_auto.json",
143+ "check.json",
144+ "engine_info.json",
145+ "doctor.json",
146+ "build_result.json",
147+ "workspace_inspect.json",
148+ ]
149+
150+ payloads = {}
151+ for name in required:
152+ path = report_dir / name
153+ if not path.is_file():
154+ raise SystemExit(f"missing report: {name}")
155+ with path.open("r", encoding="utf-8") as fh:
156+ payloads[name] = json.load(fh)
157+
158+ if payloads["init.json"].get("ok") is not True:
159+ raise SystemExit("init.json reports failure")
160+ if payloads["cfg_auto.json"].get("ok") is not True:
161+ raise SystemExit("cfg_auto.json reports failure")
162+ if payloads["check.json"].get("ok") is not True:
163+ raise SystemExit("check.json reports failure")
164+ if payloads["engine_info.json"].get("found") is not True:
165+ raise SystemExit("engine_info.json reports engine not found")
166+ if payloads["build_result.json"].get("success") is not True:
167+ raise SystemExit("build_result.json reports build failure")
168+
169+ print("JSON validation OK")
170+ PY
171+
172+ - name : Verify compiled artifact presence
173+ shell : bash
174+ run : |
175+ set -euo pipefail
176+ shopt -s nullglob
177+ dist_files=(dist/*)
178+ build_files=(build/*)
179+ if [ ${#dist_files[@]} -eq 0 ] && [ ${#build_files[@]} -eq 0 ]; then
180+ echo "No build artifacts found in dist/ or build/"
181+ exit 1
182+ fi
183+ echo "Artifacts detected:"
184+ ls -la dist 2>/dev/null || true
185+ ls -la build 2>/dev/null || true
186+
99187 - name : Collect artifacts
100188 if : always()
101189 shell : bash
@@ -114,6 +202,7 @@ jobs:
114202 if [ -d .ark_ci_artifacts ]; then
115203 cp -r .ark_ci_artifacts ci_artifacts/reports
116204 fi
205+ (cd ci_artifacts && find . -maxdepth 3 -type f | sort > ARTIFACT_MANIFEST.txt)
117206
118207 - name : Upload self-build artifacts
119208 if : always()
0 commit comments