Files
Workspace/.gitea/workflows/workspace-validate.yml
T
cneicy f92105c97d
Validate ShrinkSDK Workspace / catalog (push) Successful in 37s
Validate ShrinkSDK Workspace / unity (push) Successful in 3m7s
fix: use self-contained catalog runner image
2026-09-05 07:02:12 +08:00

93 lines
3.6 KiB
YAML

name: Validate ShrinkSDK Workspace
on:
push:
branches:
- main
workflow_dispatch:
jobs:
catalog:
runs-on: ubuntu-latest
container:
image: docker.m.daocloud.io/library/node:22-bookworm
permissions:
contents: read
steps:
- name: Validate submodules and version catalog
shell: bash
run: |
set -euo pipefail
ref="${{ gitea.sha }}"
git init .
git remote add origin "https://git.crash.work/ShrinkSDK/Workspace.git"
git fetch --depth=1 origin "$ref"
git checkout --detach FETCH_HEAD
git submodule sync --recursive
git submodule update --init --recursive
bash Tools/CI/Validate-Submodules.sh "$PWD"
node Tools/Release/update-shrinksdk-versions.mjs --check
unity:
needs: catalog
runs-on: unity-2022.3.62f3
container:
image: docker.1panel.live/unityci/editor:ubuntu-2022.3.62f3-windows-mono-3
volumes:
- /www/dk_project/bt-recovery/gitea/runner/seedskey-unity-license:/root/.local/share/unity3d/Unity
- /www/dk_project/bt-recovery/gitea/runner/seedskey-unity-entitlements:/root/.config/unity3d/Unity/licenses
permissions:
contents: read
env:
UNITY_VERSION: 2022.3.62f3
steps:
- name: Fetch exact Workspace revision and submodules
shell: bash
run: |
set -euo pipefail
ref="${{ gitea.sha }}"
git init .
git remote add origin "https://git.crash.work/ShrinkSDK/Workspace.git"
git fetch --depth=1 origin "$ref"
git checkout --detach FETCH_HEAD
git submodule sync --recursive
git submodule update --init --recursive
bash Tools/CI/Validate-Submodules.sh "$PWD"
- name: Compile Workspace and validate package graph
shell: bash
run: |
set -euo pipefail
ulf_file="/root/.local/share/unity3d/Unity/Unity_lic.ulf"
machine_id_file="/root/.local/share/unity3d/Unity/.machine-id"
entitlement_file="/root/.config/unity3d/Unity/licenses/UnityEntitlementLicense.xml"
if test -s "$ulf_file"; then
echo "Unity license mount: ULF present"
elif test -s "$entitlement_file"; then
echo "Unity license mount: entitlement present"
else
echo "No Unity license file is available through the configured mounts." >&2
exit 1
fi
if test -s "$machine_id_file"; then
cat "$machine_id_file" > /etc/machine-id
echo "Unity machine identity restored"
fi
git config --global url."https://ghfast.top/https://github.com/".insteadOf "https://github.com/"
unity_bin="$(command -v unity-editor || command -v unity || command -v Unity || true)"
test -n "$unity_bin"
mkdir -p Artifacts
"$unity_bin" -version | head -n 1 | grep -F "$UNITY_VERSION"
status=0
"$unity_bin" \
-batchmode \
-nographics \
-quit \
-projectPath "$PWD" \
-executeMethod ShrinkSDK.WorkspaceValidation.ShrinkSdkWorkspaceValidation.Run \
-logFile "$PWD/Artifacts/unity-workspace-validation.log" || status=$?
echo '--- Unity workspace errors and exceptions ---'
grep -in -C 12 -E 'exception|buildfailed|build failed|error|failed|compilererror|invalidoperation|nullreference|package manager' "$PWD/Artifacts/unity-workspace-validation.log" | tail -n 260 || true
tail -n 240 "$PWD/Artifacts/unity-workspace-validation.log" || true
exit "$status"