Fresh production baseline [skip ci]

This commit is contained in:
DuneRealms 2026-11-27 23:43:05 +00:00
commit 0a11a18274
6 changed files with 229644 additions and 0 deletions

View file

@ -0,0 +1,7 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {readFileSync} from 'node:fs';
test('feature branch CI never invokes production deployment',()=>{
const workflow=readFileSync(new URL('../workflows/web-deploy.yml',import.meta.url),'utf8');
assert.match(workflow,/- name: Trigger deployment after successful CI\r?\n\s+if: github\.ref == 'refs\/heads\/main'/);
});

View file

@ -0,0 +1,37 @@
name: "🗑️ Clean old CI artifacts"
on:
workflow_dispatch:
inputs:
dry_run:
description: "Preview only (untick to delete eligible artifacts)"
type: boolean
default: true
concurrency:
group: manual-ci-artifact-cleanup
cancel-in-progress: false
jobs:
cleanup:
if: github.ref == 'refs/heads/main'
runs-on: dune-ci
timeout-minutes: 5
steps:
- name: Checkout cleanup script
shell: bash
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git init .
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/MC.git "$GITHUB_SHA"
git checkout --detach FETCH_HEAD
- name: Install Node 22
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Preview or clean old website artifacts
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRY_RUN: ${{ inputs.dry_run }}
run: node website/scripts/manual-ci-cleanup.mjs

View file

@ -0,0 +1,23 @@
name: DuneRealms Kit Delivery CI
on:
push:
branches: [main, dev/kit-atelier-v3]
paths:
- 'network/server-control/kit*'
- 'network/server-control/player_kits.py'
- '.forgejo/workflows/kit-delivery.yml'
workflow_dispatch:
jobs:
kits:
runs-on: dune-ci
steps:
- name: Checkout
shell: bash
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git init .
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/MC.git "$GITHUB_SHA"
git checkout --detach FETCH_HEAD
- name: Verify kit delivery bridge
run: python3 -m unittest discover -s network/server-control -p 'test_*.py' -v

View file

@ -0,0 +1,53 @@
name: DuneRealms Plugin CI
on:
workflow_dispatch:
push:
branches: [main]
paths:
- '.forgejo/workflows/plugins.yml'
- 'Dune*/**'
- 'JarvisConnector/**'
- 'gui-common/**'
jobs:
plugins:
runs-on: dune-ci
steps:
- name: Check out exact revision
shell: bash
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
git init .
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/MC.git "$GITHUB_SHA"
git checkout --detach FETCH_HEAD
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- uses: gradle/actions/setup-gradle@v4
with:
gradle-version: '9.2.1'
- name: Test and build first-party plugins
shell: bash
run: |
set -euo pipefail
modules=(DuneEss DuneLobby DuneNPC DuneRealms-minecraft-only DuneRealmsGUI DuneTerrain JarvisConnector)
mkdir -p plugin-artifacts
for module in "${modules[@]}"; do
gradle --no-daemon -p "$module" test jar
for jar in "$module"/build/libs/*.jar; do
test -f "$jar"
artifact="plugin-artifacts/${jar##*/}"
test ! -e "$artifact"
cp "$jar" "$artifact"
done
done
printf '%s\n' "$(git rev-parse HEAD)" > plugin-artifacts/SOURCE_COMMIT
(cd plugin-artifacts && sha256sum -- *.jar SOURCE_COMMIT > SHA256SUMS)
- uses: actions/upload-artifact@v3
with:
name: DuneRealms-Plugins
path: plugin-artifacts/
if-no-files-found: error

View file

@ -0,0 +1,65 @@
name: DuneRealms Resourcepack CI
on:
push:
branches: [main]
paths:
- 'DuneRealmsGUI/**'
- 'tools/build-resourcepack-repair.py'
- 'tools/test_resourcepack_repair.py'
- 'tools/build-arrakis-fauna-pack.mjs'
- 'tools/build-fauna-models.mjs'
- 'tools/build-fauna-pack-update.py'
- 'tools/test_fauna_pack_update.py'
- 'DuneTerrain/**'
- 'DuneRealms-minecraft-only/**'
- 'JarvisConnector/**'
- '.forgejo/workflows/resourcepack-ci.yml'
jobs:
resourcepack:
runs-on: dune-ci
steps:
- name: Checkout exact reviewed revision
shell: bash
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git init .
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/MC.git "$GITHUB_SHA"
git checkout --detach FETCH_HEAD
- name: Build immutable repair archives and verify pinned inputs
shell: bash
run: |
mkdir -p resourcepack-baselines resourcepack-output
curl --fail --location --retry 2 https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-v3.zip -o resourcepack-baselines/DuneRealms-Network-Artwork-v3.zip
curl --fail --location --retry 2 https://www.dunerealms.com/downloads/DuneRealms-Materials-arrakis-v4.zip -o resourcepack-baselines/DuneRealms-Materials-arrakis-v4.zip
DUNE_REPAIR_BASELINE_DIR="$PWD/resourcepack-baselines" python3 tools/test_resourcepack_repair.py -v
python3 tools/build-resourcepack-repair.py resourcepack-baselines/DuneRealms-Network-Artwork-v3.zip resourcepack-baselines/DuneRealms-Materials-arrakis-v4.zip resourcepack-output
DUNE_FAUNA_BASELINE_DIR="$PWD/resourcepack-output" python3 tools/test_fauna_pack_update.py -v
python3 tools/build-fauna-pack-update.py resourcepack-output resourcepack-output/fauna-preview
- name: Install Java 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: Install Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: '9.2.1'
- name: Build and test pack delivery plugin
run: |
gradle --no-daemon -p DuneRealmsGUI test jar
gradle --no-daemon -p DuneTerrain test jar
gradle --no-daemon -p DuneRealms-minecraft-only test jar
gradle --no-daemon -p JarvisConnector test jar
- name: Upload reviewed packs and GUI plugin
uses: actions/upload-artifact@v3
with:
name: DuneRealms-Resourcepack-Repair
path: |
resourcepack-output/
DuneRealmsGUI/build/libs/DunerealmsGUI.jar
DuneTerrain/build/libs/DuneRealms-Terrain.jar
DuneRealms-minecraft-only/build/libs/DuneRealms-Core.jar
JarvisConnector/build/libs/jarvistranslator.jar
if-no-files-found: error
retention-days: 7

View file

@ -0,0 +1,80 @@
name: DuneRealms Web CI
on:
push:
branches:
- main
paths:
- 'website/**'
- '.forgejo/workflows/web-deploy.yml'
workflow_dispatch:
jobs:
web:
runs-on: dune-ci
steps:
- name: Checkout
shell: bash
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git init .
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/MC.git "$GITHUB_SHA"
git checkout --detach FETCH_HEAD
- name: Install Node 22
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Prepare publication comparison
shell: bash
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BEFORE=$(node -e 'const fs=require("fs");const p=process.env.GITHUB_EVENT_PATH;const e=p&&fs.existsSync(p)?JSON.parse(fs.readFileSync(p)):{};process.stdout.write(e.before||"");')
if [[ ! "$BEFORE" =~ ^[0-9a-f]{40}$ || "$BEFORE" =~ ^0+$ ]]; then
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --deepen=1 https://www.dunerealms.com/git/unimatrix/MC.git "$GITHUB_SHA"
BEFORE=$(git rev-parse HEAD^)
else
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/MC.git "$BEFORE"
fi
node website/scripts/publication-changes.mjs "$BEFORE" "$GITHUB_SHA"
- name: Verify deployment policy
run: |
node --test .forgejo/tests/web-deploy.test.mjs
python3 -m unittest discover -s website/ops -p 'test_*.py'
- name: Build and test website
working-directory: website
run: |
corepack enable
corepack pnpm install --frozen-lockfile
corepack pnpm build
corepack pnpm test
node --test --test-concurrency=1 ../tools/tests/*.test.mjs
- name: Upload website build
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: DuneRealms-Website
path: website/dist/
if-no-files-found: error
retention-days: 1
- name: Trigger deployment after successful CI
if: github.ref == 'refs/heads/main'
shell: bash
env:
DEPLOY_KEY: ${{ secrets.DUNEREALMS_DEPLOY_KEY }}
run: |
install -m 700 -d ~/.ssh
printf '%s\n' "$DEPLOY_KEY" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
trap 'rm -f ~/.ssh/deploy_key' EXIT
printf '%s\n' '91.107.196.242 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC8x/XocsIz41fWHGty0DbZhSvafSQFt9jaHHgzdr55W root@ubuntu-4gb-fsn1-1' >> ~/.ssh/known_hosts
ssh -p 22 -i ~/.ssh/deploy_key -o IdentitiesOnly=yes -o BatchMode=yes -o StrictHostKeyChecking=yes dunedeploy@91.107.196.242 "$GITHUB_SHA"
rm -f ~/.ssh/deploy_key