Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e003900dde | ||
|
|
6c9505a41d | ||
|
|
e54364070c |
@@ -1,90 +0,0 @@
|
|||||||
name: isolated-cache-transport-probe
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ci/prepared-env-c21408b93fc1c68e75a7]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
restore:
|
|
||||||
if: github.server_url != 'https://github.com'
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
timeout-minutes: 20
|
|
||||||
container:
|
|
||||||
image: git.akarpov.ru/sanspie/aego-ci-env@sha256:333d35cd33c2813e4a4ed9c1499344e036d3c67b5e0818da87ad5717d1e14d50
|
|
||||||
options: --memory=3g --memory-swap=3g --cpus=2 --shm-size=1g
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
AEGO_CI_PREPARED: '1'
|
|
||||||
GOTELEMETRY: 'off'
|
|
||||||
PYTHONDONTWRITEBYTECODE: '1'
|
|
||||||
steps:
|
|
||||||
- name: Require a fresh restore directory
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
dir="$RUNNER_TEMP/aego-cache-probe-ce586c48237f0282cf71"
|
|
||||||
test -n "$RUNNER_TEMP" && test ! -e "$dir" && test ! -L "$dir"
|
|
||||||
- name: Restore synthetic cache
|
|
||||||
id: restored
|
|
||||||
uses: actions/cache/restore@v4
|
|
||||||
with:
|
|
||||||
path: ${{ runner.temp }}/aego-cache-probe-ce586c48237f0282cf71
|
|
||||||
key: aego-probe-ce586c48237f0282cf71
|
|
||||||
fail-on-cache-miss: true
|
|
||||||
- name: Verify restored content
|
|
||||||
env:
|
|
||||||
EXACT_HIT: ${{ steps.restored.outputs.cache-hit }}
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
test "$EXACT_HIT" = true
|
|
||||||
file="$RUNNER_TEMP/aego-cache-probe-ce586c48237f0282cf71/value.txt"
|
|
||||||
test -f "$file" && test ! -L "$file"
|
|
||||||
test "$(cat "$file")" = 'aego-cache-synthetic-f2df9f37f3bce8282aef3d771631a4edb531565e735babd0'
|
|
||||||
printf '%s\n' 'Synthetic cache restored and verified; this is not full CI.'
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Verify prepared workspace
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
export GOTELEMETRY=off PYTHONDONTWRITEBYTECODE=1
|
|
||||||
python3 -B tools/ci/prepare_ci_workspace.py --root "$PWD"
|
|
||||||
python3 -B tools/ci/env/preflight.py --root "$PWD"
|
|
||||||
python3 -B tools/ci/prepare_ci_workspace.py --root "$PWD"
|
|
||||||
python3 -B tools/ci/prepared_web_deps.py --root "$PWD"
|
|
||||||
python3 -B tools/ci/staticcheck_runner.py v0.8.2 -- -version
|
|
||||||
make bootstrap
|
|
||||||
test ! -e "$RUNNER_TEMP/aego-cache-key-output"
|
|
||||||
touch "$RUNNER_TEMP/aego-cache-key-output"
|
|
||||||
GITHUB_OUTPUT="$RUNNER_TEMP/aego-cache-key-output" python3 -B tools/ci/go_cache_key.py
|
|
||||||
grep -Eq '^fingerprint=[0-9a-f]{64}$' "$RUNNER_TEMP/aego-cache-key-output"
|
|
||||||
- name: Headed browser environment
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
timeout --kill-after=5s 180s xvfb-run -a -s '-screen 0 1440x1050x24' \
|
|
||||||
/opt/aego/python/bin/python -u -B /opt/aego/ci-env/browser_smoke.py
|
|
||||||
- name: Native GL readback
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
export GOTOOLCHAIN=local GOPROXY=off GOSUMDB=off GOTELEMETRY=off
|
|
||||||
export SDL_VIDEODRIVER=offscreen SDL_VIDEO_DRIVER=offscreen SDL_AUDIO_DRIVER=dummy SDL_AUDIODRIVER=dummy
|
|
||||||
export LIBGL_ALWAYS_SOFTWARE=1 GALLIUM_DRIVER=llvmpipe MESA_GL_VERSION_OVERRIDE=3.3 MESA_GLSL_VERSION_OVERRIDE=330
|
|
||||||
go test -count=1 -json -tags aego_gltest -run '^TestReadPixelsOrientation$' ./tests/gl/ | tee "$RUNNER_TEMP/aego-native-gl.jsonl"
|
|
||||||
python3 -B - "$RUNNER_TEMP/aego-native-gl.jsonl" <<'PY'
|
|
||||||
import json, sys
|
|
||||||
with open(sys.argv[1], encoding='utf-8') as stream:
|
|
||||||
events = [json.loads(line) for line in stream]
|
|
||||||
actions = [item['Action'] for item in events if item.get('Test') == 'TestReadPixelsOrientation']
|
|
||||||
if actions.count('run') != 1 or actions.count('pass') != 1 or any(x in actions for x in ('skip', 'fail')):
|
|
||||||
raise SystemExit('native GL test did not run and pass: ' + repr(actions))
|
|
||||||
print('Native GL test ran and passed without skips')
|
|
||||||
PY
|
|
||||||
test ! -e "$RUNNER_TEMP/aego-cache-save-output"
|
|
||||||
touch "$RUNNER_TEMP/aego-cache-save-output"
|
|
||||||
GITHUB_OUTPUT="$RUNNER_TEMP/aego-cache-save-output" GO_BUILD_CACHE_PATH="$(go env GOCACHE)" \
|
|
||||||
GO_MODULE_CACHE_PATH="$(go env GOMODCACHE)" python3 -B tools/ci/go_cache_save.py
|
|
||||||
grep -qx 'save=yes' "$RUNNER_TEMP/aego-cache-save-output"
|
|
||||||
test -z "$(git status --porcelain --untracked-files=all)"
|
|
||||||
@@ -67,23 +67,23 @@ jobs:
|
|||||||
- name: build
|
- name: build
|
||||||
run: go build ./...
|
run: go build ./...
|
||||||
- name: test
|
- name: test
|
||||||
run: go test ./...
|
run: go test -count=1 ./...
|
||||||
- name: test without native backends
|
- name: test without native backends
|
||||||
run: go test -tags aego_nonative $(go list ./... | grep -v -e '/platform/sdl$' -e '/gpu/gl33$' -e '/gpu/gl33/gl$')
|
run: go test -count=1 -tags aego_nonative $(go list ./... | grep -v -e '/platform/sdl$' -e '/gpu/gl33$' -e '/gpu/gl33/gl$')
|
||||||
- name: gl tests (offscreen, llvmpipe)
|
- name: gl tests (offscreen, llvmpipe)
|
||||||
if: runner.os == 'Linux'
|
if: runner.os == 'Linux'
|
||||||
env:
|
env:
|
||||||
SDL_VIDEODRIVER: offscreen
|
SDL_VIDEODRIVER: offscreen
|
||||||
LIBGL_ALWAYS_SOFTWARE: "1"
|
LIBGL_ALWAYS_SOFTWARE: "1"
|
||||||
GALLIUM_DRIVER: llvmpipe
|
GALLIUM_DRIVER: llvmpipe
|
||||||
run: go test -tags aego_gltest ./tests/gl/
|
run: go test -count=1 -tags aego_gltest ./tests/gl/
|
||||||
- name: golden
|
- name: golden
|
||||||
if: runner.os == 'Linux'
|
if: runner.os == 'Linux'
|
||||||
env:
|
env:
|
||||||
SDL_VIDEODRIVER: offscreen
|
SDL_VIDEODRIVER: offscreen
|
||||||
LIBGL_ALWAYS_SOFTWARE: "1"
|
LIBGL_ALWAYS_SOFTWARE: "1"
|
||||||
GALLIUM_DRIVER: llvmpipe
|
GALLIUM_DRIVER: llvmpipe
|
||||||
run: go test -tags aego_golden ./tests/golden/...
|
run: go test -count=1 -tags aego_golden ./tests/golden/...
|
||||||
- name: headless smoke
|
- name: headless smoke
|
||||||
run: go run ./cmd/sandbox --demo headless --frames 600 --strict-allocs
|
run: go run ./cmd/sandbox --demo headless --frames 600 --strict-allocs
|
||||||
- name: build the cli
|
- name: build the cli
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+178
-67
File diff suppressed because it is too large
Load Diff
@@ -121,6 +121,27 @@ jobs:
|
|||||||
test "$(go env CGO_ENABLED)" = 1
|
test "$(go env CGO_ENABLED)" = 1
|
||||||
- name: Build pinned SDL
|
- name: Build pinned SDL
|
||||||
run: bash tools/bootstrap-native.sh 2>&1 | tee .cache/github-ci/logs/bootstrap.txt
|
run: bash tools/bootstrap-native.sh 2>&1 | tee .cache/github-ci/logs/bootstrap.txt
|
||||||
|
- name: Identify Go build cache
|
||||||
|
id: go_cache_key
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
if [[ "$RUNNER_OS" == Windows ]]; then
|
||||||
|
py -3 -B tools/ci/go_cache_key.py
|
||||||
|
else
|
||||||
|
python3 -B tools/ci/go_cache_key.py
|
||||||
|
fi
|
||||||
|
- name: Restore Go build cache
|
||||||
|
id: go_cache
|
||||||
|
if: ${{ steps.go_cache_key.outputs.fingerprint != '' }}
|
||||||
|
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
${{ steps.go_cache_key.outputs.path }}
|
||||||
|
${{ steps.go_cache_key.outputs.modules }}
|
||||||
|
key: aego-go-v1-${{ steps.go_cache_key.outputs.fingerprint }}-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
aego-go-v1-${{ steps.go_cache_key.outputs.fingerprint }}-
|
||||||
- name: Build all packages
|
- name: Build all packages
|
||||||
run: go build ./... 2>&1 | tee .cache/github-ci/logs/build.txt
|
run: go build ./... 2>&1 | tee .cache/github-ci/logs/build.txt
|
||||||
- name: Native platform tests
|
- name: Native platform tests
|
||||||
@@ -158,6 +179,30 @@ jobs:
|
|||||||
cp .cache/github-ci/bin/aego .cache/github-ci/dist/linux/aego-linux-amd64
|
cp .cache/github-ci/bin/aego .cache/github-ci/dist/linux/aego-linux-amd64
|
||||||
cd .cache/github-ci/dist/linux
|
cd .cache/github-ci/dist/linux
|
||||||
sha256sum aego-linux-amd64 > SHA256SUMS.txt
|
sha256sum aego-linux-amd64 > SHA256SUMS.txt
|
||||||
|
- name: Check optional Go cache upload
|
||||||
|
id: go_cache_size
|
||||||
|
if: ${{ success() && steps.go_cache_key.outputs.fingerprint != '' && steps.go_cache.outputs.cache-hit != 'true' }}
|
||||||
|
continue-on-error: true
|
||||||
|
env:
|
||||||
|
GO_BUILD_CACHE_PATH: ${{ steps.go_cache_key.outputs.path }}
|
||||||
|
GO_MODULE_CACHE_PATH: ${{ steps.go_cache_key.outputs.modules }}
|
||||||
|
GO_CACHE_MAX_BYTES: '1288490188'
|
||||||
|
GO_CACHE_MIN_FREE_BYTES: '8589934592'
|
||||||
|
run: |
|
||||||
|
if [[ "$RUNNER_OS" == Windows ]]; then
|
||||||
|
py -3 -B tools/ci/go_cache_save.py
|
||||||
|
else
|
||||||
|
python3 -B tools/ci/go_cache_save.py
|
||||||
|
fi
|
||||||
|
- name: Save Go build cache
|
||||||
|
if: ${{ success() && steps.go_cache_size.outputs.save == 'yes' }}
|
||||||
|
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
${{ steps.go_cache_key.outputs.path }}
|
||||||
|
${{ steps.go_cache_key.outputs.modules }}
|
||||||
|
key: aego-go-v1-${{ steps.go_cache_key.outputs.fingerprint }}-${{ github.sha }}
|
||||||
- name: Upload diagnostic logs
|
- name: Upload diagnostic logs
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||||
|
|||||||
@@ -14,11 +14,13 @@ make cli
|
|||||||
|
|
||||||
| Level | When | Command |
|
| Level | When | Command |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| 1 | after an edit | `make quick`: build and short tests of the packages your change touches and everything that imports them |
|
| 1 | after a Go edit | `make quick`: build and short tests selected from the current host's Go dependency graph |
|
||||||
| 2 | before a commit | `make affected`, plus `make check-camera`, `check-audio`, `check-gameplay`, `check-mutate`, `check-editor`, `check-web` or `check-docs` for the areas you touched, and `make golden` after UI changes |
|
| 2 | before a commit | `make affected`, plus `make check-camera`, `check-audio`, `check-gameplay`, `check-mutate`, `check-editor`, `check-web` or `check-docs` for the areas you touched, and `make golden` after UI changes |
|
||||||
| 3 | before a push or a tag | `make ci` |
|
| 3 | before a push or a tag | `make ci` |
|
||||||
|
|
||||||
`tools/affected.sh [base]` lists the affected packages (default base `origin/master`, uncommitted files included). The CI server always runs the full `make ci`.
|
`tools/affected.sh [base]` lists host Go packages (default base `origin/master`, uncommitted files included). It rejects non-Go changes, nested modules, deleted packages, shallow checkouts and incomplete dependency graphs instead of silently reporting success. It does not cover other platforms, build tags, browsers or asset-specific gates; run the relevant checks and the full `make ci` in a protected snapshot. The CI server always runs the full `make ci`.
|
||||||
|
|
||||||
|
`make ci-fast` runs infrastructure and web-policy unit tests only. For one focused set, use `make ci-suite SUITE=integration-race`, `studio-core`, `component-try`, `gl`, `web`, `web-gpu`, `web-materials`, `web-lighting`, `web-particles`, `stage12-release`, `remote-examples`, `editor`, `nonative`, `lint`, `depcheck` or `infra`. Some suites generate files and must run in a protected snapshot. Neither shortcut is full acceptance; `make ci-full` is an alias for `make ci`.
|
||||||
|
|
||||||
## Rules for engine code
|
## Rules for engine code
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ MODULE_BENCH_ALLOCS += bench-allocs-animation
|
|||||||
.PHONY: test-animation bench-animation bench-allocs-animation
|
.PHONY: test-animation bench-animation bench-allocs-animation
|
||||||
|
|
||||||
test-animation:
|
test-animation:
|
||||||
go test ./anim/... ./asset/importers/animclip/... ./asset/importers/animctrl/... ./modules/animation/... ./tests/animation/...
|
go test -count=1 ./anim/... ./asset/importers/animclip/... ./asset/importers/animctrl/... ./modules/animation/... ./tests/animation/...
|
||||||
|
|
||||||
bench-animation:
|
bench-animation:
|
||||||
$(BENCH_PIN) go test -run '^$$' -bench . -benchmem -count=$(BENCH_COUNT) ./anim ./tests/animation
|
$(BENCH_PIN) go test -run '^$$' -bench . -benchmem -count=$(BENCH_COUNT) ./anim ./tests/animation
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ MODULE_CI += test-camera
|
|||||||
.PHONY: test-camera bench-camera
|
.PHONY: test-camera bench-camera
|
||||||
|
|
||||||
test-camera:
|
test-camera:
|
||||||
go test ./modules/camera/... ./tests/camera/...
|
go test -count=1 ./modules/camera/... ./tests/camera/...
|
||||||
go test -run 'Rewind' ./tests/integration
|
go test -count=1 -run 'Rewind' ./tests/integration
|
||||||
|
|
||||||
bench-camera:
|
bench-camera:
|
||||||
$(BENCH_PIN) go test -run '^$$' -bench BrainStep -benchmem -count=$(BENCH_COUNT) ./tests/camera
|
$(BENCH_PIN) go test -run '^$$' -bench BrainStep -benchmem -count=$(BENCH_COUNT) ./tests/camera
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ MODULE_CI += test-gameplay
|
|||||||
.PHONY: test-gameplay bench-gameplay
|
.PHONY: test-gameplay bench-gameplay
|
||||||
|
|
||||||
test-gameplay:
|
test-gameplay:
|
||||||
go test ./modules/gameplay/... ./tests/gameplay/...
|
go test -count=1 ./modules/gameplay/... ./tests/gameplay/...
|
||||||
|
|
||||||
bench-gameplay:
|
bench-gameplay:
|
||||||
$(BENCH_PIN) go test -run '^$$' -bench Motion100 -benchmem -count=$(BENCH_COUNT) ./tests/gameplay
|
$(BENCH_PIN) go test -run '^$$' -bench Motion100 -benchmem -count=$(BENCH_COUNT) ./tests/gameplay
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ bench-allocs-physics:
|
|||||||
$(BENCH_GATE) -time=false -base $(BENCH_BASE_DIR)/physics.base.txt -head $(BENCH_DIR)/physics.allocs.txt
|
$(BENCH_GATE) -time=false -base $(BENCH_BASE_DIR)/physics.base.txt -head $(BENCH_DIR)/physics.allocs.txt
|
||||||
|
|
||||||
demo-physics: bootstrap
|
demo-physics: bootstrap
|
||||||
go test -run TestSceneRunsHeadless ./demos/physics2d
|
go test -count=1 -run TestSceneRunsHeadless ./demos/physics2d
|
||||||
go run ./cmd/sandbox --demo physics2d-headless --frames 600
|
go run ./cmd/sandbox --demo physics2d-headless --frames 600
|
||||||
|
|
||||||
example-sandbox: cli
|
example-sandbox: cli
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Explicitly separated checks: focused package tests are not Stage 12.5 acceptance.
|
# Explicitly separated checks: focused package tests are not full acceptance.
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
|
root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
cd "$root"
|
cd "$root"
|
||||||
+2
-12
@@ -1,14 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
# The package list is a local hint, not a substitute for the full CI gate.
|
||||||
set -eu
|
set -eu
|
||||||
base=${1:-origin/master}
|
exec python3 -B "$(dirname -- "$0")/ci/affected_packages.py" "$@"
|
||||||
mod=$(go list -m)
|
|
||||||
dirs=$( { git diff --name-only "$base"...HEAD; git diff --name-only; git diff --name-only --cached; git ls-files --others --exclude-standard; } | grep '\.go$' | while read -r f; do dirname "$f"; done | sort -u)
|
|
||||||
[ -n "$dirs" ] || exit 0
|
|
||||||
want=""
|
|
||||||
for d in $dirs; do
|
|
||||||
[ -d "$d" ] && want="$want $mod/$d"
|
|
||||||
done
|
|
||||||
[ -n "$want" ] || exit 0
|
|
||||||
go list -f '{{.ImportPath}}{{range .Deps}} {{.}}{{end}}{{range .TestImports}} {{.}}{{end}}{{range .XTestImports}} {{.}}{{end}}' ./... 2>/dev/null |
|
|
||||||
awk -v want="$want" 'BEGIN { n = split(want, w, " "); for (i = 1; i <= n; i++) set[w[i]] = 1 } { for (i = 1; i <= NF; i++) if ($i in set) { print $1; next } }' |
|
|
||||||
sort -u
|
|
||||||
|
|||||||
@@ -83,9 +83,9 @@ server's policy does not establish the policy of a production deployment.
|
|||||||
`make studio-web-test` runs the scoped tests. `make studio-web-ci` calls the
|
`make studio-web-test` runs the scoped tests. `make studio-web-ci` calls the
|
||||||
strict release gate and requires its real native, browser, documentation,
|
strict release gate and requires its real native, browser, documentation,
|
||||||
parity, full component Try and regression runners; missing runners are errors.
|
parity, full component Try and regression runners; missing runners are errors.
|
||||||
The supplied defaults are `tools/stage125-check.sh artstudio-native` (synthetic
|
The supplied defaults are `tools/acceptance-check.sh artstudio-native` (synthetic
|
||||||
SDL input through the real editor and GL/game scenarios) and
|
SDL input through the real editor and GL/game scenarios) and
|
||||||
`tools/stage125-check.sh artstudio-docs` (the ordinary registry/site builder
|
`tools/acceptance-check.sh artstudio-docs` (the ordinary registry/site builder
|
||||||
with the pinned artifact). The latter creates a new
|
with the pinned artifact). The latter creates a new
|
||||||
`$ARTSTUDIO_EVIDENCE/docs-site`, or the explicit `ARTSTUDIO_DOCS_SITE`; arrange
|
`$ARTSTUDIO_EVIDENCE/docs-site`, or the explicit `ARTSTUDIO_DOCS_SITE`; arrange
|
||||||
for the CI docs host at `ARTSTUDIO_DOCS_URL` to serve that directory. Production
|
for the CI docs host at `ARTSTUDIO_DOCS_URL` to serve that directory. Production
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ export PYTHONDONTWRITEBYTECODE=1
|
|||||||
python="${ARTSTUDIO_PYTHON:-python3}"
|
python="${ARTSTUDIO_PYTHON:-python3}"
|
||||||
: "${AEGO_NATIVE_SCENARIO_EVIDENCE:=$ARTSTUDIO_EVIDENCE/native-sdl}"
|
: "${AEGO_NATIVE_SCENARIO_EVIDENCE:=$ARTSTUDIO_EVIDENCE/native-sdl}"
|
||||||
export AEGO_NATIVE_SCENARIO_EVIDENCE
|
export AEGO_NATIVE_SCENARIO_EVIDENCE
|
||||||
native_runner=(bash "$root/tools/stage125-check.sh" artstudio-native)
|
native_runner=(bash "$root/tools/acceptance-check.sh" artstudio-native)
|
||||||
docs_runner=(bash "$root/tools/stage125-check.sh" artstudio-docs)
|
docs_runner=(bash "$root/tools/acceptance-check.sh" artstudio-docs)
|
||||||
if [[ -n "${AEGO_NATIVE_SCENARIO_RUNNER:-}" ]]; then native_runner=("$AEGO_NATIVE_SCENARIO_RUNNER"); fi
|
if [[ -n "${AEGO_NATIVE_SCENARIO_RUNNER:-}" ]]; then native_runner=("$AEGO_NATIVE_SCENARIO_RUNNER"); fi
|
||||||
if [[ -n "${AEGO_DOCS_INTEGRATION_RUNNER:-}" ]]; then docs_runner=("$AEGO_DOCS_INTEGRATION_RUNNER"); fi
|
if [[ -n "${AEGO_DOCS_INTEGRATION_RUNNER:-}" ]]; then docs_runner=("$AEGO_DOCS_INTEGRATION_RUNNER"); fi
|
||||||
# The built-in runner compares the pinned WASM against native Go after every
|
# The built-in runner compares the pinned WASM against native Go after every
|
||||||
@@ -58,7 +58,7 @@ run_gate() {
|
|||||||
[[ "$status" == 0 ]]
|
[[ "$status" == 0 ]]
|
||||||
}
|
}
|
||||||
run_gate core bash -c 'go test -race -count=1 ./art ./tools/artstudio/host ./tools/artstudio/gpupreview ./tools/artstudio/release && go vet ./art ./tools/artstudio/host ./tools/artstudio/gpupreview ./tools/artstudio/release && node --test tools/artstudio/release/tests/*.test.cjs && "$1" -B -m unittest discover -s tools/artstudio/release/tests -p test_browser_context.py && "$1" -B -m unittest discover -s tools/artstudio/release/tests -p test_release_ci.py' _ "$python"
|
run_gate core bash -c 'go test -race -count=1 ./art ./tools/artstudio/host ./tools/artstudio/gpupreview ./tools/artstudio/release && go vet ./art ./tools/artstudio/host ./tools/artstudio/gpupreview ./tools/artstudio/release && node --test tools/artstudio/release/tests/*.test.cjs && "$1" -B -m unittest discover -s tools/artstudio/release/tests -p test_browser_context.py && "$1" -B -m unittest discover -s tools/artstudio/release/tests -p test_release_ci.py' _ "$python"
|
||||||
run_gate native-build bash tools/stage125-check.sh native
|
run_gate native-build bash tools/acceptance-check.sh native
|
||||||
run_gate native-user-scenario "${native_runner[@]}"
|
run_gate native-user-scenario "${native_runner[@]}"
|
||||||
interop_executables=()
|
interop_executables=()
|
||||||
if [[ -n "${ARTSTUDIO_CHROMIUM_EXECUTABLE:-}" ]]; then interop_executables+=(--chromium-executable "$ARTSTUDIO_CHROMIUM_EXECUTABLE"); fi
|
if [[ -n "${ARTSTUDIO_CHROMIUM_EXECUTABLE:-}" ]]; then interop_executables+=(--chromium-executable "$ARTSTUDIO_CHROMIUM_EXECUTABLE"); fi
|
||||||
@@ -98,7 +98,7 @@ for browser in chromium firefox; do
|
|||||||
--wasm "$wasm" --engine "$browser" "${file_args[@]}"
|
--wasm "$wasm" --engine "$browser" "${file_args[@]}"
|
||||||
run_gate "$browser-pending-fields" "$python" -B tools/artstudio/tests/pending_fields_browser.py \
|
run_gate "$browser-pending-fields" "$python" -B tools/artstudio/tests/pending_fields_browser.py \
|
||||||
--wasm "$wasm" --engine "$browser" "${file_args[@]}"
|
--wasm "$wasm" --engine "$browser" "${file_args[@]}"
|
||||||
run_gate "$browser-gpu" env ARTSTUDIO_GPU_BROWSER="$browser" bash tools/stage125-check.sh artstudio-gpu \
|
run_gate "$browser-gpu" env ARTSTUDIO_GPU_BROWSER="$browser" bash tools/acceptance-check.sh artstudio-gpu \
|
||||||
--artifact "$ARTSTUDIO_ARTIFACT" --app-url "$ARTSTUDIO_APP_URL" \
|
--artifact "$ARTSTUDIO_ARTIFACT" --app-url "$ARTSTUDIO_APP_URL" \
|
||||||
--evidence "$ARTSTUDIO_EVIDENCE/$browser-gpu-browser" "${executable[@]}"
|
--evidence "$ARTSTUDIO_EVIDENCE/$browser-gpu-browser" "${executable[@]}"
|
||||||
done
|
done
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -61,14 +61,32 @@ cleanup() {
|
|||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
run_gate() {
|
run_gate() {
|
||||||
local name="$1"; shift
|
local name="$1"; shift
|
||||||
local code
|
local started finished elapsed start_seconds command_code stream_code code source_sha
|
||||||
|
local -a statuses
|
||||||
|
started="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||||
|
start_seconds=$SECONDS
|
||||||
|
source_sha="$(cat "$dir/head.txt")"
|
||||||
|
[[ "$name" =~ ^[a-z0-9-]+$ && "$source_sha" =~ ^([0-9a-f]{40}|[0-9a-f]{64})$ ]] || {
|
||||||
|
echo 'Invalid gate name or source revision' >&2; return 1;
|
||||||
|
}
|
||||||
|
printf '%s\n' RUNNING >"$dir/$name.exit"
|
||||||
|
printf '%s: started %s (log: %s)\n' "$name" "$started" "$dir/$name.log"
|
||||||
set +e
|
set +e
|
||||||
"$@" >"$dir/$name.log" 2>&1
|
"$@" 2>&1 | tee "$dir/$name.log"
|
||||||
code=$?
|
statuses=("${PIPESTATUS[@]}")
|
||||||
set -e
|
set -e
|
||||||
|
command_code="${statuses[0]}"
|
||||||
|
stream_code="${statuses[1]}"
|
||||||
|
code="$command_code"
|
||||||
|
if ((code == 0 && stream_code != 0)); then code="$stream_code"; fi
|
||||||
|
finished="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||||
|
elapsed=$((SECONDS - start_seconds))
|
||||||
|
printf '%s\n' "$command_code" >"$dir/$name.command.exit"
|
||||||
|
printf '%s\n' "$stream_code" >"$dir/$name.stream.exit"
|
||||||
printf '%s\n' "$code" >"$dir/$name.exit"
|
printf '%s\n' "$code" >"$dir/$name.exit"
|
||||||
printf '%s: exit %s (%s)\n' "$name" "$code" "$dir/$name.log"
|
printf '{"suite_id":"%s","source_sha":"%s","environment_digest":null,"started_at":"%s","finished_at":"%s","duration_seconds":%s,"exit_code":%s,"command_exit_code":%s,"stream_exit_code":%s,"cache_status":"unmeasured"}\n' \
|
||||||
if [[ "$code" != 0 ]]; then cat "$dir/$name.log"; fi
|
"$name" "$source_sha" "$started" "$finished" "$elapsed" "$code" "$command_code" "$stream_code" >"$dir/$name.timing.json"
|
||||||
|
printf '%s: exit %s after %ss (%s)\n' "$name" "$code" "$elapsed" "$dir/$name.log"
|
||||||
return "$code"
|
return "$code"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +175,7 @@ for browser in chromium firefox; do
|
|||||||
run_gate "$browser-pending-fields" env -u GOMAXPROCS "$python" -B tools/artstudio/tests/pending_fields_browser.py \
|
run_gate "$browser-pending-fields" env -u GOMAXPROCS "$python" -B tools/artstudio/tests/pending_fields_browser.py \
|
||||||
--wasm "$wasm" --engine "$browser" "${file_args[@]}"
|
--wasm "$wasm" --engine "$browser" "${file_args[@]}"
|
||||||
run_gate "$browser-gpu" env -u GOMAXPROCS ARTSTUDIO_PYTHON="$python" ARTSTUDIO_GPU_BROWSER="$browser" \
|
run_gate "$browser-gpu" env -u GOMAXPROCS ARTSTUDIO_PYTHON="$python" ARTSTUDIO_GPU_BROWSER="$browser" \
|
||||||
bash tools/stage125-check.sh artstudio-gpu --artifact "$artifact" --app-url "$app_origin/" \
|
bash tools/acceptance-check.sh artstudio-gpu --artifact "$artifact" --app-url "$app_origin/" \
|
||||||
--evidence "$dir/$browser-gpu-browser" "${args[@]}"
|
--evidence "$dir/$browser-gpu-browser" "${args[@]}"
|
||||||
done
|
done
|
||||||
run_gate parity env -u GOMAXPROCS ARTSTUDIO_ARTIFACT="$artifact" ARTSTUDIO_APP_URL="$app_origin/" \
|
run_gate parity env -u GOMAXPROCS ARTSTUDIO_ARTIFACT="$artifact" ARTSTUDIO_APP_URL="$app_origin/" \
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Vendored
+35
@@ -0,0 +1,35 @@
|
|||||||
|
# Prepared Linux CI environment
|
||||||
|
|
||||||
|
The Gitea Linux jobs use a digest-pinned image built from these inputs. The
|
||||||
|
image and workspace checks do not imply that full CI or release gates passed.
|
||||||
|
|
||||||
|
The base and toolchain images, Python wheels, SDL source and web dependency
|
||||||
|
inputs are pinned in `lock.json` and the Dockerfile. `preflight.py` verifies
|
||||||
|
versions, real browser resolution, SDL linkage and the exact locked input set;
|
||||||
|
it never installs dependencies. Updating an input requires reviewing it and
|
||||||
|
updating the lock. A changed or newly added SDL patch is rejected.
|
||||||
|
The image also requires `zstd` and `zstdmt`, matching the runner's cache
|
||||||
|
compression rather than silently creating incompatible cache versions.
|
||||||
|
|
||||||
|
To prepare a build context, use a **new absolute path outside the checkout**:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
python3 -B tools/ci/env/build_context.py --out /path/to/new/context
|
||||||
|
```
|
||||||
|
|
||||||
|
Only the listed inputs are copied. Build the context with resource limits and a
|
||||||
|
new, non-conflicting image tag; do not overwrite or prune existing images. A
|
||||||
|
successful image build runs an image preflight plus real Chromium and headed
|
||||||
|
Firefox smoke tests. Before updating the workflow, verify a workspace on the
|
||||||
|
actual runner, publish the image, pin its digest, test cache storage, and compare
|
||||||
|
all mandatory checks. No runner restart, publish or workflow switch is performed
|
||||||
|
by this context builder.
|
||||||
|
|
||||||
|
For a **fresh, protected checkout inside the candidate image**,
|
||||||
|
`tools/ci/prepare_ci_workspace.py --root "$PWD"` attaches the prepared Node tree
|
||||||
|
and copies the SDL prefix. It refuses to replace conflicting existing paths.
|
||||||
|
Follow it with `tools/ci/env/preflight.py --root "$PWD"`; these steps do not
|
||||||
|
install dependencies. `AEGO_CI_PREPARED=1` makes the shared `web-deps` target
|
||||||
|
verify that Node tree instead of running npm, and makes `lint` use the pinned
|
||||||
|
Staticcheck binary. Without that explicit mode the existing local install and
|
||||||
|
`go run` behavior remains.
|
||||||
Vendored
+66
@@ -0,0 +1,66 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Create a new, minimal CI-image build context without copying user files."""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
import shutil
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import preflight
|
||||||
|
|
||||||
|
|
||||||
|
def build_context(root, output):
|
||||||
|
root = root.resolve(strict=True)
|
||||||
|
if not output.is_absolute() or output.name in ('', '.', '..'):
|
||||||
|
raise ValueError('context must have a new absolute path')
|
||||||
|
parent = output.parent.resolve(strict=True)
|
||||||
|
destination = parent / output.name
|
||||||
|
if destination == root or root in destination.parents:
|
||||||
|
raise ValueError('context must be outside the checkout')
|
||||||
|
if destination.exists() or destination.is_symlink():
|
||||||
|
raise ValueError('context path already exists')
|
||||||
|
lock_path = root / 'tools/ci/env/lock.json'
|
||||||
|
if lock_path.is_symlink() or not lock_path.is_file():
|
||||||
|
raise ValueError('environment lock must be a regular file')
|
||||||
|
lock_bytes = lock_path.read_bytes()
|
||||||
|
lock = json.loads(lock_bytes)
|
||||||
|
preflight.check_input_set(root, lock)
|
||||||
|
preflight.check_go_directives(root, lock['tools']['go'])
|
||||||
|
destination.mkdir(mode=0o700)
|
||||||
|
paths = sorted(preflight.INPUTS) + ['tools/ci/env/lock.json']
|
||||||
|
for name in paths:
|
||||||
|
source = root / name
|
||||||
|
target = destination / name
|
||||||
|
target.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
with source.open('rb') as source_stream, target.open('xb') as target_stream:
|
||||||
|
shutil.copyfileobj(source_stream, target_stream)
|
||||||
|
if name == 'tools/ci/env/lock.json':
|
||||||
|
if target.read_bytes() != lock_bytes:
|
||||||
|
raise ValueError('environment lock changed during context creation')
|
||||||
|
elif preflight.digest(target) != lock['inputs'][name]:
|
||||||
|
raise ValueError('input changed during context creation: ' + name)
|
||||||
|
preflight.check_input_set(root, lock)
|
||||||
|
if lock_path.read_bytes() != lock_bytes:
|
||||||
|
raise ValueError('environment lock changed during context creation')
|
||||||
|
return {'status': 'PASS', 'context': str(destination), 'files': paths,
|
||||||
|
'lock_sha256': hashlib.sha256(lock_bytes).hexdigest(),
|
||||||
|
'note': 'context identity only; not an image build or CI result'}
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
|
parser.add_argument('--root', type=Path, default=Path(__file__).resolve().parents[3])
|
||||||
|
parser.add_argument('--out', type=Path, required=True)
|
||||||
|
args = parser.parse_args()
|
||||||
|
try:
|
||||||
|
print(json.dumps(build_context(args.root, args.out), indent=2))
|
||||||
|
except (OSError, ValueError, KeyError, TypeError) as error:
|
||||||
|
print('CI image context failed: ' + str(error), file=sys.stderr)
|
||||||
|
return 1
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
raise SystemExit(main())
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
"""Exercise the actual CI wrapper tail without running the full CI."""
|
||||||
|
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import subprocess
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[2]
|
||||||
|
SCRIPT = ROOT / 'tools/acceptance-check.sh'
|
||||||
|
|
||||||
|
|
||||||
|
def wrapper_tail():
|
||||||
|
text = SCRIPT.read_text(encoding='utf-8')
|
||||||
|
marker = 'if [[ "$mode" == ci ]]; then\n'
|
||||||
|
if text.count(marker) != 1:
|
||||||
|
raise ValueError('CI wrapper tail is missing or ambiguous')
|
||||||
|
return marker + text.split(marker, 1)[1].split('\nprintf ', 1)[0]
|
||||||
|
|
||||||
|
|
||||||
|
class AcceptanceCIWrapperTest(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.temp = tempfile.TemporaryDirectory(prefix='aego-acceptance-ci-')
|
||||||
|
self.addCleanup(self.temp.cleanup)
|
||||||
|
self.root = Path(self.temp.name)
|
||||||
|
self.bin = self.root / 'bin'
|
||||||
|
self.bin.mkdir()
|
||||||
|
self.trace = self.root / 'trace'
|
||||||
|
self.stub('make', '''#!/bin/sh
|
||||||
|
printf 'make|%s\\n' "$*" >> "$TRACE"
|
||||||
|
exit "${MAKE_EXIT:-0}"
|
||||||
|
''')
|
||||||
|
self.stub('acceptance-check', '''#!/bin/sh
|
||||||
|
printf 'try|%s\\n' "$*" >> "$TRACE"
|
||||||
|
exit "${TRY_EXIT:-0}"
|
||||||
|
''')
|
||||||
|
self.env = dict(os.environ, PATH=str(self.bin) + os.pathsep + os.defpath, TRACE=str(self.trace),
|
||||||
|
FIXTURE_ROOT=str(self.root))
|
||||||
|
for name in ('MAKE_EXIT', 'TRY_EXIT'):
|
||||||
|
self.env.pop(name, None)
|
||||||
|
|
||||||
|
def stub(self, name, text):
|
||||||
|
path = self.bin / name
|
||||||
|
path.write_text(text)
|
||||||
|
path.chmod(0o755)
|
||||||
|
|
||||||
|
def run_wrapper(self):
|
||||||
|
code = 'set -euo pipefail\nroot="$FIXTURE_ROOT"\nmode=ci\n' + wrapper_tail()
|
||||||
|
return subprocess.run(['bash', '-c', code, str(self.bin / 'acceptance-check')], cwd=self.root, env=self.env, text=True,
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=10)
|
||||||
|
|
||||||
|
def calls(self):
|
||||||
|
return self.trace.read_text().splitlines() if self.trace.exists() else []
|
||||||
|
|
||||||
|
def test_runner_remains_executable_for_its_recursive_try_call(self):
|
||||||
|
self.assertTrue(os.access(SCRIPT, os.X_OK), str(SCRIPT))
|
||||||
|
|
||||||
|
def test_success_preserves_the_separate_try_gate(self):
|
||||||
|
result = self.run_wrapper()
|
||||||
|
self.assertEqual(result.returncode, 0, result.stdout)
|
||||||
|
self.assertEqual(self.calls(), ['make|ci', 'try|try'])
|
||||||
|
|
||||||
|
def test_make_or_try_failure_is_propagated(self):
|
||||||
|
self.env['MAKE_EXIT'] = '19'
|
||||||
|
result = self.run_wrapper()
|
||||||
|
self.assertEqual(result.returncode, 19, result.stdout)
|
||||||
|
self.assertEqual(self.calls(), ['make|ci'])
|
||||||
|
self.trace.unlink()
|
||||||
|
self.env['MAKE_EXIT'] = '0'
|
||||||
|
self.env['TRY_EXIT'] = '23'
|
||||||
|
result = self.run_wrapper()
|
||||||
|
self.assertEqual(result.returncode, 23, result.stdout)
|
||||||
|
self.assertEqual(self.calls(), ['make|ci', 'try|try'])
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -57,7 +57,7 @@ class NativeStudioEvidenceTests(unittest.TestCase):
|
|||||||
return source, witness
|
return source, witness
|
||||||
|
|
||||||
def summarize(self):
|
def summarize(self):
|
||||||
shell = (ROOT / 'tools/stage125-check.sh').read_text()
|
shell = (ROOT / 'tools/acceptance-check.sh').read_text()
|
||||||
marker = ' python3 -B - "$evidence" <<\'PY\'\n'
|
marker = ' python3 -B - "$evidence" <<\'PY\'\n'
|
||||||
self.assertEqual(shell.count(marker), 1)
|
self.assertEqual(shell.count(marker), 1)
|
||||||
script = shell.split(marker, 1)[1].split('\nPY\n', 1)[0]
|
script = shell.split(marker, 1)[1].split('\nPY\n', 1)[0]
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,70 @@
|
|||||||
|
"""Check that optional cache failures never replace or suppress CI gates."""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[2]
|
||||||
|
WORKFLOW = ROOT / '.github/workflows/ci.yml'
|
||||||
|
|
||||||
|
|
||||||
|
def job(name, next_name):
|
||||||
|
text = WORKFLOW.read_text(encoding='utf-8')
|
||||||
|
return text.split('\n ' + name + ':\n', 1)[1].split('\n ' + next_name + ':\n', 1)[0]
|
||||||
|
|
||||||
|
|
||||||
|
class CacheWorkflowTest(unittest.TestCase):
|
||||||
|
def test_each_job_has_optional_bounded_cache_without_skipping_gates(self):
|
||||||
|
jobs = (('checks', 'native-authoring', 'Asset Studio snapshot and real browser integration',
|
||||||
|
'Preserve full CI and component evidence'),
|
||||||
|
('native-authoring', 'build', 'Download the tested Studio snapshot', 'installer dry run'),
|
||||||
|
('build', 'release', 'build', 'example project'))
|
||||||
|
for name, next_name, first_gate, last_gate in jobs:
|
||||||
|
with self.subTest(job=name):
|
||||||
|
body = job(name, next_name)
|
||||||
|
self.assertEqual(body.count('name: Identify Go build cache'), 1)
|
||||||
|
self.assertEqual(body.count('name: Restore Go build cache'), 1)
|
||||||
|
self.assertEqual(body.count('name: Check optional Go cache upload'), 1)
|
||||||
|
self.assertEqual(body.count('name: Save Go build cache'), 1)
|
||||||
|
self.assertLess(body.index('bash tools/bootstrap-native.sh'), body.index('name: Identify Go build cache'))
|
||||||
|
self.assertLess(body.index('name: Restore Go build cache'), body.index('name: ' + first_gate))
|
||||||
|
self.assertLess(body.index('name: ' + last_gate), body.index('name: Check optional Go cache upload'))
|
||||||
|
self.assertNotIn('uses: actions/setup-go@v5', body)
|
||||||
|
self.assertIn('tools/ci/env/preflight.py', body)
|
||||||
|
self.assertIn('uses: actions/cache/restore@v4', body)
|
||||||
|
self.assertIn('uses: actions/cache/save@v4', body)
|
||||||
|
self.assertEqual(body.count('key: aego-go-v1-${{ steps.go_cache_key.outputs.fingerprint }}-${{ github.sha }}'), 2)
|
||||||
|
self.assertIn('aego-go-v1-${{ steps.go_cache_key.outputs.fingerprint }}-', body)
|
||||||
|
self.assertIn("steps.go_cache_size.outputs.save == 'yes'", body)
|
||||||
|
self.assertIn("steps.go_cache.outputs.cache-hit != 'true'", body)
|
||||||
|
for step in ('Identify Go build cache', 'Restore Go build cache',
|
||||||
|
'Check optional Go cache upload', 'Save Go build cache'):
|
||||||
|
section = body.split(' - name: ' + step + '\n', 1)[1].split('\n - ', 1)[0]
|
||||||
|
self.assertIn('continue-on-error: true', section)
|
||||||
|
|
||||||
|
def test_github_native_keeps_every_platform_gate_and_bounds_optional_cache(self):
|
||||||
|
text = (ROOT / '.github/workflows/github-native.yml').read_text(encoding='utf-8')
|
||||||
|
body = text.split('\n native:\n', 1)[1].split('\n gitea-result:\n', 1)[0]
|
||||||
|
for name in ('windows-2025', 'macos-15', 'macos-15-intel', 'ubuntu-24.04'):
|
||||||
|
self.assertIn(name, body)
|
||||||
|
self.assertLess(body.index('name: Build pinned SDL'), body.index('name: Identify Go build cache'))
|
||||||
|
self.assertLess(body.index('name: Restore Go build cache'), body.index('name: Build all packages'))
|
||||||
|
self.assertLess(body.index('name: Package Linux CLI'), body.index('name: Check optional Go cache upload'))
|
||||||
|
for gate in ('Native platform tests', 'Linux compatibility tests', 'Strict headless smoke',
|
||||||
|
'CLI and headless runtime smoke', 'Test Windows installer bootstrap',
|
||||||
|
'Native silent installer and uninstaller', 'Build macOS app bundle'):
|
||||||
|
self.assertIn('name: ' + gate, body)
|
||||||
|
self.assertIn('uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830', body)
|
||||||
|
self.assertIn('uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830', body)
|
||||||
|
self.assertIn("steps.go_cache_size.outputs.save == 'yes'", body)
|
||||||
|
self.assertIn("GO_CACHE_MAX_BYTES: '1288490188'", body)
|
||||||
|
self.assertIn('py -3 -B tools/ci/go_cache_key.py', body)
|
||||||
|
self.assertIn('py -3 -B tools/ci/go_cache_save.py', body)
|
||||||
|
for step in ('Identify Go build cache', 'Restore Go build cache',
|
||||||
|
'Check optional Go cache upload', 'Save Go build cache'):
|
||||||
|
section = body.split(' - name: ' + step + '\n', 1)[1].split('\n - ', 1)[0]
|
||||||
|
self.assertIn('continue-on-error: true', section)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,56 @@
|
|||||||
|
"""Keep prepared CI jobs pinned, validated and equivalent to the full gates."""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[2]
|
||||||
|
WORKFLOW = ROOT / '.github/workflows/ci.yml'
|
||||||
|
|
||||||
|
|
||||||
|
def job(name, next_name):
|
||||||
|
text = WORKFLOW.read_text(encoding='utf-8')
|
||||||
|
return text.split('\n ' + name + ':\n', 1)[1].split('\n ' + next_name + ':\n', 1)[0]
|
||||||
|
|
||||||
|
|
||||||
|
class PreparedWorkflowTest(unittest.TestCase):
|
||||||
|
def test_each_linux_job_pins_and_checks_the_same_prepared_image(self):
|
||||||
|
images = []
|
||||||
|
for name, next_name in (('checks', 'native-authoring'),
|
||||||
|
('native-authoring', 'build'), ('build', 'release')):
|
||||||
|
with self.subTest(job=name):
|
||||||
|
body = job(name, next_name)
|
||||||
|
matches = re.findall(r'(?m)^\s+image: (git\.akarpov\.ru/sanspie/aego-ci-env@sha256:[0-9a-f]{64})$', body)
|
||||||
|
self.assertEqual(len(matches), 1)
|
||||||
|
images.extend(matches)
|
||||||
|
self.assertIn('shell: bash', body)
|
||||||
|
self.assertIn('AEGO_CI_PREPARED: "1"', body)
|
||||||
|
self.assertIn('ARTSTUDIO_PYTHON: /opt/aego/python/bin/python', body)
|
||||||
|
self.assertIn('PLAYWRIGHT_BROWSERS_PATH: /ms-playwright', body)
|
||||||
|
self.assertNotIn('uses: actions/setup-go@v5', body)
|
||||||
|
self.assertNotIn('uses: actions/setup-node@v4', body)
|
||||||
|
self.assertNotIn('sudo apt-get', body)
|
||||||
|
positions = [body.index(value) for value in (
|
||||||
|
'actions/checkout@v4', 'tools/ci/prepare_ci_workspace.py',
|
||||||
|
'tools/ci/env/preflight.py', 'bash tools/check-glslang.sh',
|
||||||
|
'bash tools/bootstrap-native.sh', 'name: Restore Go build cache')]
|
||||||
|
self.assertEqual(positions, sorted(positions))
|
||||||
|
self.assertEqual(len(set(images)), 1)
|
||||||
|
|
||||||
|
def test_prepared_browser_paths_do_not_override_the_job_environment(self):
|
||||||
|
checks = job('checks', 'native-authoring')
|
||||||
|
native = job('native-authoring', 'build')
|
||||||
|
self.assertNotIn('PLAYWRIGHT_BROWSERS_PATH: ${{ runner.temp }}', checks + native)
|
||||||
|
self.assertNotIn('export PLAYWRIGHT_BROWSERS_PATH="$RUNNER_TEMP/', checks + native)
|
||||||
|
self.assertIn('ARTSTUDIO_PYTHON', checks)
|
||||||
|
self.assertIn('ARTSTUDIO_PYTHON', native)
|
||||||
|
for gate in ('make ci XVFB=', 'component_try_evidence.py verify'):
|
||||||
|
self.assertIn(gate, checks)
|
||||||
|
for gate in ('bash tools/acceptance-check.sh artstudio-native', 'file_interop_e2e.py',
|
||||||
|
'make remote-examples-check', 'make nsis-check'):
|
||||||
|
self.assertIn(gate, native)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@@ -43,12 +43,14 @@ class RegressionStreamTest(unittest.TestCase):
|
|||||||
self.bin = self.root / 'bin'
|
self.bin = self.root / 'bin'
|
||||||
self.bin.mkdir()
|
self.bin.mkdir()
|
||||||
self.marker = self.root / 'verified'
|
self.marker = self.root / 'verified'
|
||||||
|
self.deps_marker = self.root / 'prepared-deps'
|
||||||
|
self.npm_marker = self.root / 'npm-called'
|
||||||
self.make_call = self.root / 'make-call'
|
self.make_call = self.root / 'make-call'
|
||||||
self.firefox = self.root / 'browsers with spaces' / 'firefox'
|
self.firefox = self.root / 'browsers with spaces' / 'firefox'
|
||||||
self.firefox.parent.mkdir()
|
self.firefox.parent.mkdir()
|
||||||
self.firefox.write_text('#!/bin/sh\nexit 0\n', encoding='utf-8')
|
self.firefox.write_text('#!/bin/sh\nexit 0\n', encoding='utf-8')
|
||||||
self.firefox.chmod(0o755)
|
self.firefox.chmod(0o755)
|
||||||
self._stub('npm', '#!/bin/sh\nexit 0\n')
|
self._stub('npm', '#!/bin/sh\nprintf called >"$MOCK_NPM_MARKER"\nexit 0\n')
|
||||||
self._stub('node', '''#!/bin/sh
|
self._stub('node', '''#!/bin/sh
|
||||||
case "$*" in
|
case "$*" in
|
||||||
*chromium.executablePath*) printf '%s\\n' /fake/chromium ;;
|
*chromium.executablePath*) printf '%s\\n' /fake/chromium ;;
|
||||||
@@ -68,7 +70,12 @@ if [ -n "${MOCK_RELEASE_FILE:-}" ]; then
|
|||||||
fi
|
fi
|
||||||
exit "${MOCK_MAKE_EXIT:-0}"
|
exit "${MOCK_MAKE_EXIT:-0}"
|
||||||
''')
|
''')
|
||||||
self._stub('python3', '#!/bin/sh\nprintf verified >"$MOCK_VERIFY_MARKER"\n')
|
self._stub('python3', '''#!/bin/sh
|
||||||
|
case "$*" in
|
||||||
|
*prepared_web_deps.py*) printf checked >"$MOCK_PREPARED_MARKER"; exit "${MOCK_PREPARED_EXIT:-0}" ;;
|
||||||
|
*) printf verified >"$MOCK_VERIFY_MARKER" ;;
|
||||||
|
esac
|
||||||
|
''')
|
||||||
tee = shutil.which('tee')
|
tee = shutil.which('tee')
|
||||||
if not tee:
|
if not tee:
|
||||||
self.fail('tee is required for the CI logging test')
|
self.fail('tee is required for the CI logging test')
|
||||||
@@ -82,8 +89,10 @@ exec "{tee}" "$@"
|
|||||||
self.env = os.environ.copy()
|
self.env = os.environ.copy()
|
||||||
self.env.update(PATH=str(self.bin) + os.pathsep + self.env['PATH'],
|
self.env.update(PATH=str(self.bin) + os.pathsep + self.env['PATH'],
|
||||||
RUNNER_TEMP=str(self.runner), MOCK_VERIFY_MARKER=str(self.marker),
|
RUNNER_TEMP=str(self.runner), MOCK_VERIFY_MARKER=str(self.marker),
|
||||||
MOCK_MAKE_CALL=str(self.make_call), MOCK_FIREFOX_EXECUTABLE=str(self.firefox))
|
MOCK_MAKE_CALL=str(self.make_call), MOCK_FIREFOX_EXECUTABLE=str(self.firefox),
|
||||||
for name in ('FIREFOX', 'MOCK_MAKE_EXIT', 'MOCK_TEE_FAIL', 'MOCK_RELEASE_FILE'):
|
MOCK_PREPARED_MARKER=str(self.deps_marker), MOCK_NPM_MARKER=str(self.npm_marker))
|
||||||
|
for name in ('FIREFOX', 'MOCK_MAKE_EXIT', 'MOCK_TEE_FAIL', 'MOCK_RELEASE_FILE',
|
||||||
|
'AEGO_CI_PREPARED', 'MOCK_PREPARED_EXIT', 'ARTSTUDIO_PYTHON'):
|
||||||
self.env.pop(name, None)
|
self.env.pop(name, None)
|
||||||
|
|
||||||
def _stub(self, name, content):
|
def _stub(self, name, content):
|
||||||
@@ -110,12 +119,35 @@ exec "{tee}" "$@"
|
|||||||
self.assertEqual(self._log(), 'make stdout\nmake stderr\n')
|
self.assertEqual(self._log(), 'make stdout\nmake stderr\n')
|
||||||
self.assertIn(self._log(), result.stdout)
|
self.assertIn(self._log(), result.stdout)
|
||||||
self.assertTrue(self.marker.is_file())
|
self.assertTrue(self.marker.is_file())
|
||||||
|
self.assertTrue(self.npm_marker.is_file())
|
||||||
|
self.assertFalse(self.deps_marker.exists())
|
||||||
self.assertEqual(self.make_call.read_text().splitlines(), [
|
self.assertEqual(self.make_call.read_text().splitlines(), [
|
||||||
'ci XVFB= CHROMIUM=/fake/chromium',
|
'ci XVFB= CHROMIUM=/fake/chromium',
|
||||||
str(self.runner / 'aego-artstudio-python/bin/python'),
|
str(self.runner / 'aego-artstudio-python/bin/python'),
|
||||||
str(self.firefox),
|
str(self.firefox),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
def test_prepared_dependencies_are_verified_without_npm_install(self):
|
||||||
|
self.env['AEGO_CI_PREPARED'] = '1'
|
||||||
|
self.env['ARTSTUDIO_PYTHON'] = '/prepared python/bin/python'
|
||||||
|
result = self._run()
|
||||||
|
self.assertEqual(result.returncode, 0, result.stdout)
|
||||||
|
self.assertTrue(self.deps_marker.is_file())
|
||||||
|
self.assertFalse(self.npm_marker.exists())
|
||||||
|
self.assertTrue(self.make_call.is_file())
|
||||||
|
self.assertEqual(self.make_call.read_text().splitlines()[1], '/prepared python/bin/python')
|
||||||
|
self.assertTrue(self.marker.is_file())
|
||||||
|
|
||||||
|
def test_invalid_or_unverified_prepared_dependencies_stop_regression(self):
|
||||||
|
for mode, exit_code in (('1', '17'), ('unexpected', '0')):
|
||||||
|
with self.subTest(mode=mode):
|
||||||
|
self.env.update(AEGO_CI_PREPARED=mode, MOCK_PREPARED_EXIT=exit_code)
|
||||||
|
result = self._run()
|
||||||
|
self.assertNotEqual(result.returncode, 0, result.stdout)
|
||||||
|
self.assertFalse(self.make_call.exists())
|
||||||
|
self.assertFalse(self.npm_marker.exists())
|
||||||
|
self.assertFalse(self.marker.exists())
|
||||||
|
|
||||||
def test_invalid_firefox_never_runs_make(self):
|
def test_invalid_firefox_never_runs_make(self):
|
||||||
for executable in ('', str(self.root / 'missing'), str(self.root / 'not-executable'), str(self.root)):
|
for executable in ('', str(self.root / 'missing'), str(self.root / 'not-executable'), str(self.root)):
|
||||||
with self.subTest(executable=executable):
|
with self.subTest(executable=executable):
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
"""Test CI shortcut dispatch without running expensive product checks."""
|
||||||
|
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[2]
|
||||||
|
|
||||||
|
|
||||||
|
class CIShortcutTest(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.temp = tempfile.TemporaryDirectory(prefix='aego-ci-shortcut-')
|
||||||
|
self.addCleanup(self.temp.cleanup)
|
||||||
|
self.root = Path(self.temp.name)
|
||||||
|
self.bin = self.root / 'bin'
|
||||||
|
self.bin.mkdir()
|
||||||
|
self.trace = self.root / 'trace'
|
||||||
|
self.outer_make = shutil.which('make')
|
||||||
|
if not self.outer_make:
|
||||||
|
self.fail('make is required')
|
||||||
|
stub = self.bin / 'make'
|
||||||
|
stub.write_text('#!/bin/sh\nprintf "%s\\n" "$*" >> "$TRACE"\nexit "${STUB_EXIT:-0}"\n')
|
||||||
|
stub.chmod(0o755)
|
||||||
|
self.env = dict(os.environ, PATH=str(self.bin) + os.pathsep + os.defpath, TRACE=str(self.trace),
|
||||||
|
HOME=str(self.root), XDG_CONFIG_HOME=str(self.root), GOTELEMETRY='off')
|
||||||
|
for name in ('MAKEFLAGS', 'MFLAGS', 'MAKELEVEL', 'GNUMAKEFLAGS', 'STUB_EXIT'):
|
||||||
|
self.env.pop(name, None)
|
||||||
|
|
||||||
|
def run_make(self, *args):
|
||||||
|
return subprocess.run([self.outer_make, '-f', str(ROOT / 'Makefile'),
|
||||||
|
'GOOS=linux', 'GOARCH=amd64', *args], cwd=ROOT, env=self.env,
|
||||||
|
text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=20)
|
||||||
|
|
||||||
|
def test_suite_dispatches_only_allowlisted_targets(self):
|
||||||
|
cases = {'infra': 'ci-infrastructure-test', 'integration-race': 'test-race-integration',
|
||||||
|
'studio-core': 'studio-web-test', 'component-try': 'component-try',
|
||||||
|
'gl': 'test-gl', 'web-gpu': 'web-gpu-smoke', 'remote-examples': 'remote-examples-check'}
|
||||||
|
for suite, target in cases.items():
|
||||||
|
with self.subTest(suite=suite):
|
||||||
|
if self.trace.exists():
|
||||||
|
self.trace.unlink()
|
||||||
|
result = self.run_make('ci-suite', 'SUITE=' + suite)
|
||||||
|
self.assertEqual(result.returncode, 0, result.stdout)
|
||||||
|
self.assertEqual(self.trace.read_text().splitlines(), [target])
|
||||||
|
self.assertIn('not full CI', result.stdout)
|
||||||
|
|
||||||
|
def test_unknown_suite_fails_without_running_make(self):
|
||||||
|
result = self.run_make('ci-suite', 'SUITE=unknown;touch ' + str(self.root / 'injected'))
|
||||||
|
self.assertNotEqual(result.returncode, 0, result.stdout)
|
||||||
|
self.assertFalse(self.trace.exists())
|
||||||
|
self.assertFalse((self.root / 'injected').exists())
|
||||||
|
|
||||||
|
def test_suite_failure_propagates(self):
|
||||||
|
self.env['STUB_EXIT'] = '37'
|
||||||
|
result = self.run_make('ci-suite', 'SUITE=gl')
|
||||||
|
self.assertNotEqual(result.returncode, 0, result.stdout)
|
||||||
|
self.assertEqual(self.trace.read_text().splitlines(), ['test-gl'])
|
||||||
|
|
||||||
|
def test_fast_and_full_have_explicit_distinct_dependencies(self):
|
||||||
|
result = self.run_make('-qp', 'ci-fast', 'ci-full')
|
||||||
|
self.assertIn(result.returncode, (0, 1), result.stdout)
|
||||||
|
fast = re.findall(r'^ci-fast:\s*([^\n]*)$', result.stdout, re.MULTILINE)
|
||||||
|
full = re.findall(r'^ci-full:\s*([^\n]*)$', result.stdout, re.MULTILINE)
|
||||||
|
self.assertEqual(len(fast), 1)
|
||||||
|
self.assertEqual(len(full), 1)
|
||||||
|
self.assertIn('ci-infrastructure-test', fast[0].split())
|
||||||
|
self.assertNotIn('ci', fast[0].split())
|
||||||
|
self.assertEqual(full[0].split(), ['ci'])
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@@ -4,11 +4,13 @@ import json
|
|||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import re
|
import re
|
||||||
|
import select
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import textwrap
|
import textwrap
|
||||||
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
@@ -113,7 +115,7 @@ esac
|
|||||||
self.assertIn('asset-studio-snapshot-${{ github.run_id }}-${{ github.run_attempt }}', native)
|
self.assertIn('asset-studio-snapshot-${{ github.run_id }}-${{ github.run_attempt }}', native)
|
||||||
self.assertIn('make ci XVFB=', checks)
|
self.assertIn('make ci XVFB=', checks)
|
||||||
self.assertIn('component_try_evidence.py verify', checks)
|
self.assertIn('component_try_evidence.py verify', checks)
|
||||||
for gate in ('bash tools/stage125-check.sh artstudio-native', 'file_interop_e2e.py',
|
for gate in ('bash tools/acceptance-check.sh artstudio-native', 'file_interop_e2e.py',
|
||||||
'make remote-examples-check', 'make nsis-check'):
|
'make remote-examples-check', 'make nsis-check'):
|
||||||
self.assertIn(gate, native)
|
self.assertIn(gate, native)
|
||||||
steps = ('Asset Studio snapshot and real browser integration', 'Pin the tested Studio snapshot',
|
steps = ('Asset Studio snapshot and real browser integration', 'Pin the tested Studio snapshot',
|
||||||
@@ -138,7 +140,7 @@ esac
|
|||||||
self.assertIn('go vet -cgocall=false -unsafeptr=false $(VET_PKGS)', makefile)
|
self.assertIn('go vet -cgocall=false -unsafeptr=false $(VET_PKGS)', makefile)
|
||||||
self.assertIn('go vet ./platform/sdl', makefile)
|
self.assertIn('go vet ./platform/sdl', makefile)
|
||||||
self.assertIn(' lint depcheck ', makefile)
|
self.assertIn(' lint depcheck ', makefile)
|
||||||
for gate in ('go build ./...', 'go test ./...', 'aego_nonative', 'aego_gltest',
|
for gate in ('go build ./...', 'go test -count=1 ./...', 'aego_nonative', 'aego_gltest',
|
||||||
'aego_golden', '--demo headless', 'example project'):
|
'aego_golden', '--demo headless', 'example project'):
|
||||||
self.assertIn(gate, all_jobs['build'])
|
self.assertIn(gate, all_jobs['build'])
|
||||||
|
|
||||||
@@ -277,8 +279,68 @@ raise SystemExit(91)
|
|||||||
self.assertEqual(result.returncode, 41, result.stdout)
|
self.assertEqual(result.returncode, 41, result.stdout)
|
||||||
self.assertEqual(self.marker.read_text().splitlines(), ['make studio-web-test'])
|
self.assertEqual(self.marker.read_text().splitlines(), ['make studio-web-test'])
|
||||||
self.assertEqual((self.snapshot / 'core.exit').read_text().strip(), '41')
|
self.assertEqual((self.snapshot / 'core.exit').read_text().strip(), '41')
|
||||||
|
self.assertEqual((self.snapshot / 'core.command.exit').read_text().strip(), '41')
|
||||||
|
self.assertEqual((self.snapshot / 'core.stream.exit').read_text().strip(), '0')
|
||||||
|
timing = json.loads((self.snapshot / 'core.timing.json').read_text())
|
||||||
|
self.assertEqual(timing['suite_id'], 'core')
|
||||||
|
self.assertEqual(timing['source_sha'], 'a' * 40)
|
||||||
|
self.assertIsNone(timing['environment_digest'])
|
||||||
|
self.assertEqual(timing['exit_code'], 41)
|
||||||
|
self.assertEqual(timing['command_exit_code'], 41)
|
||||||
|
self.assertEqual(timing['stream_exit_code'], 0)
|
||||||
|
self.assertGreaterEqual(timing['duration_seconds'], 0)
|
||||||
|
self.assertEqual(timing['cache_status'], 'unmeasured')
|
||||||
self.assertFalse((self.snapshot / 'core-deferred.txt').exists())
|
self.assertFalse((self.snapshot / 'core-deferred.txt').exists())
|
||||||
|
|
||||||
|
def test_gate_streams_before_command_finishes_and_records_the_log(self):
|
||||||
|
self._stub('make', '''#!/bin/sh
|
||||||
|
printf 'fixture output before completion\\n'
|
||||||
|
IFS= read -r release
|
||||||
|
printf 'fixture completed\\n'
|
||||||
|
exit 41
|
||||||
|
''')
|
||||||
|
proc = subprocess.Popen(['bash', str(self.runner)], env=self.env,
|
||||||
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.STDOUT)
|
||||||
|
output = b''
|
||||||
|
try:
|
||||||
|
deadline = time.monotonic() + 8
|
||||||
|
while b'fixture output before completion' not in output:
|
||||||
|
remaining = deadline - time.monotonic()
|
||||||
|
if remaining <= 0 or not select.select([proc.stdout], [], [], remaining)[0]:
|
||||||
|
break
|
||||||
|
chunk = os.read(proc.stdout.fileno(), 4096)
|
||||||
|
if not chunk:
|
||||||
|
break
|
||||||
|
output += chunk
|
||||||
|
self.assertIn(b'fixture output before completion', output)
|
||||||
|
self.assertIsNone(proc.poll(), 'gate must still be waiting for its input')
|
||||||
|
self.assertEqual((self.snapshot / 'core.exit').read_text().strip(), 'RUNNING')
|
||||||
|
self.assertIn('fixture output before completion', (self.snapshot / 'core.log').read_text())
|
||||||
|
finally:
|
||||||
|
remaining_output, _ = proc.communicate(input=b'continue\n', timeout=10)
|
||||||
|
output += remaining_output
|
||||||
|
self.assertEqual(proc.returncode, 41, output.decode(errors='replace'))
|
||||||
|
self.assertIn(b'fixture completed', output)
|
||||||
|
self.assertEqual((self.snapshot / 'core.exit').read_text().strip(), '41')
|
||||||
|
self.assertIn('fixture completed', (self.snapshot / 'core.log').read_text())
|
||||||
|
|
||||||
|
def test_gate_fails_if_log_stream_fails_even_when_command_succeeds(self):
|
||||||
|
self._stub('make', '#!/bin/sh\nprintf "fixture successful command\\n"\nexit 0\n')
|
||||||
|
self._stub('tee', '''#!/bin/sh
|
||||||
|
case "$1" in
|
||||||
|
*/core.log) cat >"$1"; exit 73 ;;
|
||||||
|
*) exec /usr/bin/tee "$@" ;;
|
||||||
|
esac
|
||||||
|
''')
|
||||||
|
result = self._run()
|
||||||
|
self.assertEqual(result.returncode, 73, result.stdout)
|
||||||
|
self.assertEqual((self.snapshot / 'core.exit').read_text().strip(), '73')
|
||||||
|
self.assertEqual((self.snapshot / 'core.command.exit').read_text().strip(), '0')
|
||||||
|
self.assertEqual((self.snapshot / 'core.stream.exit').read_text().strip(), '73')
|
||||||
|
timing = json.loads((self.snapshot / 'core.timing.json').read_text())
|
||||||
|
self.assertEqual((timing['exit_code'], timing['command_exit_code'], timing['stream_exit_code']), (73, 0, 73))
|
||||||
|
|
||||||
def test_combined_ci_explicitly_defers_core_without_a_fake_pass(self):
|
def test_combined_ci_explicitly_defers_core_without_a_fake_pass(self):
|
||||||
self.env['ARTSTUDIO_SNAPSHOT_CORE'] = 'defer-to-make-ci'
|
self.env['ARTSTUDIO_SNAPSHOT_CORE'] = 'defer-to-make-ci'
|
||||||
result = self._run()
|
result = self._run()
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,74 @@
|
|||||||
|
"""Ensure cached Go builds cannot replace required CI test executions."""
|
||||||
|
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[2]
|
||||||
|
TARGETS = {
|
||||||
|
'test-race-packages': 1,
|
||||||
|
'test-editor': 1,
|
||||||
|
'test-runtime': 1,
|
||||||
|
'test-wasm': 7,
|
||||||
|
'test-nonative': 1,
|
||||||
|
'test-gl': 6,
|
||||||
|
'golden': 1,
|
||||||
|
'test-animation': 1,
|
||||||
|
'test-camera': 2,
|
||||||
|
'test-gameplay': 1,
|
||||||
|
'demo-physics': 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def go_test_lines(text):
|
||||||
|
return [line for line in text.splitlines() if re.search(r'\bgo\s+test\b', line)]
|
||||||
|
|
||||||
|
|
||||||
|
def require_fresh(lines):
|
||||||
|
if not lines or any(not re.search(r'(?<!\S)-count(?:=|\s+)1(?:\s|$)', line) for line in lines):
|
||||||
|
raise ValueError('a required Go test may use cached test results')
|
||||||
|
|
||||||
|
|
||||||
|
class GoTestFreshnessTest(unittest.TestCase):
|
||||||
|
def test_make_ci_go_tests_are_fresh_without_running_them(self):
|
||||||
|
with tempfile.TemporaryDirectory(prefix='aego-go-freshness-') as scratch:
|
||||||
|
env = dict(os.environ, HOME=scratch, XDG_CONFIG_HOME=scratch, GOTELEMETRY='off')
|
||||||
|
for name in ('MAKEFLAGS', 'MFLAGS', 'MAKELEVEL', 'GNUMAKEFLAGS'):
|
||||||
|
env.pop(name, None)
|
||||||
|
for target, minimum in TARGETS.items():
|
||||||
|
with self.subTest(target=target):
|
||||||
|
result = subprocess.run(['make', '-n', '-f', str(ROOT / 'Makefile'), '-o', 'bootstrap',
|
||||||
|
'GOOS=linux', 'GOARCH=amd64', 'XVFB=', target],
|
||||||
|
cwd=ROOT, env=env, text=True, stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL, timeout=30)
|
||||||
|
self.assertEqual(result.returncode, 0, result.stdout)
|
||||||
|
lines = go_test_lines(result.stdout)
|
||||||
|
self.assertGreaterEqual(len(lines), minimum, result.stdout)
|
||||||
|
require_fresh(lines)
|
||||||
|
|
||||||
|
def test_gitea_build_job_go_tests_are_fresh(self):
|
||||||
|
workflow = (ROOT / '.github/workflows/ci.yml').read_text()
|
||||||
|
job = workflow.split('\n build:\n', 1)[1].split('\n release:\n', 1)[0]
|
||||||
|
lines = go_test_lines(job)
|
||||||
|
self.assertEqual(len(lines), 4, lines)
|
||||||
|
require_fresh(lines)
|
||||||
|
|
||||||
|
def test_optional_gitea_platform_go_tests_are_fresh(self):
|
||||||
|
workflow = (ROOT / '.github/workflows/ci-platforms.yml').read_text()
|
||||||
|
lines = go_test_lines(workflow)
|
||||||
|
self.assertEqual(len(lines), 6, lines)
|
||||||
|
require_fresh(lines)
|
||||||
|
|
||||||
|
def test_missing_or_nonfresh_count_is_rejected(self):
|
||||||
|
for text in ('go test ./...', 'go test -count=2 ./...', ''):
|
||||||
|
with self.subTest(text=text), self.assertRaises(ValueError):
|
||||||
|
require_fresh(go_test_lines(text))
|
||||||
|
require_fresh(go_test_lines('go test -race -count=1 ./...'))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
"""Check prepared web dependency selection with isolated Node fixture packages."""
|
||||||
|
|
||||||
|
import importlib.util
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[2]
|
||||||
|
SPEC = importlib.util.spec_from_file_location('aego_prepared_web_deps', ROOT / 'tools/ci/prepared_web_deps.py')
|
||||||
|
WEB = importlib.util.module_from_spec(SPEC)
|
||||||
|
SPEC.loader.exec_module(WEB)
|
||||||
|
|
||||||
|
|
||||||
|
class PreparedWebDepsTest(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
if not shutil.which('node'):
|
||||||
|
self.skipTest('Node is unavailable')
|
||||||
|
self.temp = tempfile.TemporaryDirectory(prefix='aego-prepared-web-')
|
||||||
|
self.addCleanup(self.temp.cleanup)
|
||||||
|
self.scratch = Path(self.temp.name)
|
||||||
|
self.repo = self.scratch / 'repo'
|
||||||
|
self.image = self.scratch / 'image'
|
||||||
|
self.repo.mkdir()
|
||||||
|
self.image.mkdir()
|
||||||
|
for source, image_name in WEB.PREFLIGHT.INPUTS.items():
|
||||||
|
for target in (self.repo / source, self.image / image_name):
|
||||||
|
target.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
shutil.copyfile(ROOT / source, target)
|
||||||
|
lock = json.loads((ROOT / 'tools/ci/env/lock.json').read_text())
|
||||||
|
lock['tools']['node'] = subprocess.check_output(['node', '--version'], text=True, timeout=10).strip()
|
||||||
|
for path in (self.repo / 'tools/ci/env/lock.json', self.image / 'ci-env/lock.json'):
|
||||||
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
path.write_text(json.dumps(lock))
|
||||||
|
self.modules = self.image / 'websmoke/node_modules'
|
||||||
|
packages = json.loads((self.repo / 'tools/websmoke/package-lock.json').read_text())['packages']
|
||||||
|
for name in WEB.PACKAGES:
|
||||||
|
directory = self.modules / name
|
||||||
|
directory.mkdir(parents=True)
|
||||||
|
version = packages['node_modules/' + name]['version']
|
||||||
|
(directory / 'package.json').write_text(json.dumps({'name': name, 'version': version, 'main': 'index.js'}))
|
||||||
|
(directory / 'index.js').write_text('module.exports = {};\n')
|
||||||
|
(self.repo / 'tools/websmoke/node_modules').symlink_to(self.modules, target_is_directory=True)
|
||||||
|
|
||||||
|
def test_imports_exact_packages_through_workspace_symlink(self):
|
||||||
|
result = WEB.verify(self.repo, self.image)
|
||||||
|
self.assertEqual(result['status'], 'PASS')
|
||||||
|
self.assertEqual(result['packages'], {'playwright-core': '1.64.1', 'pixelmatch': '6.0.0', 'pngjs': '7.0.0'})
|
||||||
|
self.assertFalse((self.repo / '.cache').exists())
|
||||||
|
|
||||||
|
def test_changed_or_missing_package_fails_without_installation(self):
|
||||||
|
manifest = self.modules / 'pixelmatch/package.json'
|
||||||
|
manifest.write_text(json.dumps({'name': 'pixelmatch', 'version': '0.0.1', 'main': 'index.js'}))
|
||||||
|
with self.assertRaisesRegex(ValueError, 'package versions differ'):
|
||||||
|
WEB.verify(self.repo, self.image)
|
||||||
|
manifest.write_text(json.dumps({'name': 'pixelmatch', 'version': '6.0.0', 'main': 'index.js'}))
|
||||||
|
(self.modules / 'pixelmatch/index.js').unlink()
|
||||||
|
with self.assertRaisesRegex(ValueError, 'dependency import failed'):
|
||||||
|
WEB.verify(self.repo, self.image)
|
||||||
|
self.assertFalse((self.repo / '.cache').exists())
|
||||||
|
|
||||||
|
def test_unrelated_node_modules_and_changed_inputs_are_rejected(self):
|
||||||
|
link = self.repo / 'tools/websmoke/node_modules'
|
||||||
|
link.unlink()
|
||||||
|
link.mkdir()
|
||||||
|
(link / 'user-data').write_text('keep')
|
||||||
|
with self.assertRaisesRegex(ValueError, 'workspace does not use'):
|
||||||
|
WEB.verify(self.repo, self.image)
|
||||||
|
self.assertEqual((link / 'user-data').read_text(), 'keep')
|
||||||
|
source = self.repo / 'tools/websmoke/package-lock.json'
|
||||||
|
source.write_bytes(source.read_bytes() + b' ')
|
||||||
|
with self.assertRaises(ValueError):
|
||||||
|
WEB.verify(self.repo, self.image)
|
||||||
|
self.assertEqual((link / 'user-data').read_text(), 'keep')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user