Repository navigation
143 lines (127 loc) · 5.91 KB
/
Copy pathci.yml
File metadata and controls
143 lines (127 loc) · 5.91 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
name: CI
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
# The differential suite must actually run on CI — a missing toolchain is a
# failure here, not a skip.
MENSHARP_REQUIRE_DIFFERENTIAL: "1"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Roslyn (csc) + the runtime reference assemblies for differential testing
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- uses: dtolnay/rust-toolchain@d1031067263f94b142dd6c0ce24c5eb9d02d52a0
with:
toolchain: 1.96.1
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- name: Format
run: cargo fmt --all --check
- name: Clippy
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Tests (including Roslyn differential)
run: cargo test --workspace
unity-integration:
name: Unity / VRChat SDK integration
# Runs on GitHub's runners with GameCI's Unity container by default. Two
# repository variables move it to a self-hosted runner:
# MENSHARP_UNITY_RUNNER a runner label (`self-hosted`, or a runner's
# name such as `msci-01`); the runner needs
# Docker for the GameCI path, and the licence
# secrets below still apply
# MENSHARP_UNITY_EDITOR the path of a Unity 2022.3.22f1 editor binary
# installed on that runner; the tests then run
# through tools/test-unity.sh with that editor
# and its own activation, no container, no
# licence secrets
runs-on: ${{ vars.MENSHARP_UNITY_RUNNER || 'ubuntu-latest' }}
timeout-minutes: 45
# GameCI needs the Unity licence secrets, which a pull request from a
# fork cannot see
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
steps:
# GitHub's hosted runners ship with ~14 GB free, and the Unity image
# needs that much to pull and unpack (the layers exist twice while
# extracting). The Android SDK, Haskell, .NET, CodeQL and the
# preinstalled Docker images are all unused here — dropping them frees
# about 25 GB. A self-hosted runner is left as it is.
- name: Free disk space on the hosted runner
if: vars.MENSHARP_UNITY_RUNNER == ''
run: |
df -h /
sudo rm -rf /usr/local/lib/android /opt/ghc /usr/share/dotnet /usr/local/share/boost \
/opt/hostedtoolcache/CodeQL /usr/local/.ghcup /usr/share/swift
sudo docker image prune --all --force
df -h /
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@d1031067263f94b142dd6c0ce24c5eb9d02d52a0
with:
toolchain: 1.96.1
targets: x86_64-unknown-linux-musl
- uses: Swatinem/rust-cache@v2
# the compiler's allocator (mimalloc) is C, so the static musl build
# needs a musl-flavoured C compiler; the hosted runner has none, and
# cc-rs does not fall back from x86_64-linux-musl-gcc to musl-gcc on
# its own, so it is named explicitly
- name: Install the musl C toolchain
if: vars.MENSHARP_UNITY_RUNNER == ''
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
echo "CC_x86_64_unknown_linux_musl=musl-gcc" >> "$GITHUB_ENV"
# the VRChat SDK packages pinned in Packages/vpm-manifest.json — never
# committed, resolved from VRChat's package repository every run
- name: Resolve pinned VPM dependencies
uses: anatawa12/sh-actions/resolve-vpm-packages@1d155c7a26bcd0a54ffd9cb38fd66ab0d32d23cd
with:
project-path: tests/unity-project
# the compiler is built as a static binary: it runs inside GameCI's
# container, whose glibc is older than the runner's
- name: Stage the package and release compiler
run: ./tools/prepare-unity-tests.sh
env:
MENSHARP_CARGO_TARGET: x86_64-unknown-linux-musl
MENSHARP_SKIP_VPM_RESOLVE: "1"
# importing the SDK from scratch is most of the job's time
- name: Cache the Unity Library folder
uses: actions/cache@v4
with:
path: tests/unity-project/Library
key: unity-library-${{ runner.os }}-${{ hashFiles('tests/unity-project/Packages/vpm-manifest.json', 'tests/unity-project/Packages/manifest.json', 'tests/unity-project/ProjectSettings/ProjectVersion.txt') }}
restore-keys: unity-library-${{ runner.os }}-
- name: Run SDK-backed Unity tests (GameCI container)
if: vars.MENSHARP_UNITY_EDITOR == ''
uses: game-ci/unity-test-runner@0ff419b913a3630032cbe0de48a0099b5a9f0ed9
with:
projectPath: tests/unity-project
# the plain editor image: edit-mode tests build no player, so the
# IL2CPP variant the action would pick by default is dead weight
customImage: unityci/editor:ubuntu-2022.3.22f1-base-3
testMode: editmode
customParameters: -assemblyNames ProjectTesca.MenSharp.IntegrationTests
artifactsPath: artifacts/unity-tests
githubToken: ${{ secrets.GITHUB_TOKEN }}
checkName: MenSharp Unity integration tests
- name: Run SDK-backed Unity tests (editor on the runner)
if: vars.MENSHARP_UNITY_EDITOR != ''
run: ./tools/test-unity.sh
env:
UNITY_EDITOR: ${{ vars.MENSHARP_UNITY_EDITOR }}
MENSHARP_SKIP_VPM_RESOLVE: "1"
- name: Upload Unity logs and NUnit results
if: always()
uses: actions/upload-artifact@v4
with:
name: unity-integration-results
path: artifacts/unity-tests