Skip to content

Walk the player's path as a player, and fix what that found #41

Walk the player's path as a player, and fix what that found

Walk the player's path as a player, and fix what that found #41

Workflow file for this run

name: ci
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
go:
name: Go core
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: '1.23.12'
cache: true
- name: Check formatting
shell: bash
run: |
mapfile -d '' go_files < <(find . -type f -name '*.go' -print0)
unformatted="$(gofmt -l "${go_files[@]}")"
test -z "$unformatted" || { printf '%s\n' "$unformatted"; exit 1; }
- name: Check committed canonical fixtures
run: go run ./cmd/mcjava-fixtures
- name: Check the documented baseline against the build files
run: ./scripts/check-documented-versions.sh
# Both of these ran only when a tag was pushed, which is the worst moment
# to learn that a packaged document points at something the package does
# not have. They are cheap, so they run on every push instead.
- name: Check every packaged link resolves inside the package
run: ./scripts/check-packaged-links.sh
- name: Check the packaged documents only invoke commands the release builds
run: ./scripts/check-packaged-commands.sh
- name: Test
run: go test -count=1 ./...
- name: Vet
run: go vet ./...
- name: Race test
run: go test -race -count=1 ./...
# desktop/ is its own module so that the archive core keeps having no
# dependencies at all. The cost is that ./... at the root does not reach
# it: without these steps its code would be neither built nor tested here,
# and would break silently.
- name: Test the desktop application
working-directory: desktop
run: |
test -z "$(gofmt -l .)" || { gofmt -l .; exit 1; }
go vet ./...
go test -count=1 ./...
- name: Build the commands the release ships
run: |
go build -trimpath -o "${RUNNER_TEMP}/worldledger" ./cmd/worldledger
go build -trimpath -o "${RUNNER_TEMP}/mcprofile" ./cmd/mcprofile
- name: Build the desktop application
working-directory: desktop
run: go build -trimpath -o "${RUNNER_TEMP}/worldledger-desktop" .
go-windows:
name: Go core (Windows)
runs-on: windows-latest
timeout-minutes: 15
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: '1.23.12'
cache: true
- name: Check committed canonical fixtures
run: go run ./cmd/mcjava-fixtures
- name: Test Windows paths and locking
run: go test -count=1 ./...
- name: Vet
run: go vet ./...
# Windows is where the desktop application is aimed first, so its tests
# run on the platform whose path handling they are about.
- name: Test the desktop application
working-directory: desktop
run: go test -count=1 ./...
- name: Build the commands the release ships
shell: pwsh
run: |
go build -trimpath -o "$env:RUNNER_TEMP\worldledger.exe" ./cmd/worldledger
go build -trimpath -o "$env:RUNNER_TEMP\mcprofile.exe" ./cmd/mcprofile
# A separate module cannot be built from the parent by relative path, so
# this runs where its go.mod is.
- name: Build the desktop application
working-directory: desktop
shell: pwsh
run: go build -trimpath -o "$env:RUNNER_TEMP\worldledger-desktop.exe" .
fabric:
name: Fabric 26.2 adapter
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Java 25
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
distribution: temurin
java-version: '25'
- name: Validate wrapper and set up Gradle
uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
with:
cache-provider: basic
- name: Clean build with all warnings
working-directory: adapters/fabric
run: ./gradlew --no-daemon clean build --warning-mode all
fabric-gametest:
name: Fabric 26.2 capture game test
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Java 25
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
distribution: temurin
java-version: '25'
- name: Validate wrapper and set up Gradle
uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
with:
cache-provider: basic
# A runner has no GPU, so the client needs a virtual display and a software
# OpenGL implementation. Without Mesa it starts and then fails on context
# creation, which reads as an unrelated crash.
- name: Install a virtual display and software OpenGL
run: |
sudo apt-get update
sudo apt-get install -y xvfb libgl1-mesa-dri libglx-mesa0 libxi6 libxcursor1 libxrandr2 libxinerama1 libxxf86vm1 libasound2t64
# The game test starts a dedicated server, which requires accepting
# Mojang's EULA: https://aka.ms/MinecraftEULA. Passing the flag here is the
# repository owner's acceptance for automated runs. The build never
# accepts it implicitly.
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: '1.23.12'
cache: true
- name: Run the capture game test
working-directory: adapters/fabric
env:
LIBGL_ALWAYS_SOFTWARE: '1'
GALLIUM_DRIVER: llvmpipe
run: xvfb-run -a --server-args="-screen 0 1280x1024x24" ./gradlew --no-daemon runClientGametest -Pworldledger.acceptMinecraftEula=true
# The fingerprint carries state and component digests only, so it can be
# compared against a capture from another platform whose instants,
# contributors, and session identifiers necessarily differ.
- name: Fingerprint what this platform captured
run: ./scripts/capture-fingerprint.sh adapters/fabric/build/run-gametest/config/worldledger/spool "${RUNNER_TEMP}/linux-capture-fingerprint.txt"
- name: Upload the capture fingerprint
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: linux-capture-fingerprint
path: ${{ runner.temp }}/linux-capture-fingerprint.txt
retention-days: 30
# Live as soon as a reference produced on another platform is committed.
# Until then it reports that the gate is not yet guarding anything, rather
# than passing silently and reading as though it were.
- name: Compare against the committed cross-platform reference
run: |
reference=testdata/capture-fingerprint-reference.txt
if [ ! -f "$reference" ]; then
echo "no cross-platform reference is committed yet, so this gate is not guarding anything"
echo "commit one produced on another platform to make it live"
exit 0
fi
go run ./cmd/worldledger fingerprint \
--file "${RUNNER_TEMP}/linux-capture-fingerprint.txt" --compare "$reference"
- name: Upload run directory on failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: client-gametest-run
path: |
adapters/fabric/build/run-gametest/logs
adapters/fabric/build/run-gametest/config/worldledger
retention-days: 7