-
Notifications
You must be signed in to change notification settings - Fork 12
211 lines (204 loc) · 8.89 KB
/
Copy pathci.yml
File metadata and controls
211 lines (204 loc) · 8.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
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 ./...
# The core gets a race run and this module did not, which was the
# wrong way round: the concurrency is here. A loopback server with
# handlers answering at once, a watchdog counting held work against a
# ticker, and an import that must outlive a quiet page are all in this
# module, and its tests start real servers, so the detector has
# something to watch. It needs cgo, which is why it runs on Linux and
# not in the Windows job.
go test -race -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