ModernUO/.github/workflows/build-test.yml
Kamron Batman 326dc470de fix(ci): run test projects on CI and drop impossible LowerStatReq tests
CI reported success despite two failing tests because the Test step ran
`dotnet test --no-restore`, but the Build step (BuildTool) only restores
and builds Application - never the test projects. Without a restore, the
test projects have no project.assets.json, so the Microsoft.NET.Test.Sdk
build targets aren't imported, the projects aren't recognized as test
projects, and `dotnet test` invokes the VSTest target against zero
projects: no output, exit 0. Failures were silently masked.

- Replace `--no-restore` with `dotnet test --logger trx --results-directory`
  on both the macOS and Linux jobs so the test projects restore and run.
- Add a guard that fails the job if no .trx is produced, as a permanent
  backstop against silent zero-test passes.

Also removes the two AosWeapon/AosArmor `EmitsLowerStatReqWhenPassed`
tests. PR #2501 deliberately emits LowerStatReq (1060435) inline in each
item, not in AosWeaponAttributes/AosArmorAttributes.GetProperties, which
no longer take a lowerStatReq argument. A prior "fix" dropped the argument
to make them compile but left the assertions expecting 1060435, so they
threw KeyNotFoundException at runtime. The "not emitted by GetProperties"
behavior stays covered by the sibling tests; the stale comments that
claimed lowerStatReq is passed in are removed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 22:14:03 -07:00

119 lines
3.8 KiB
YAML

name: Build
on:
push:
branches: [main]
paths:
- '.config/dotnet-tools.json'
- 'Projects/**'
- 'Directory.Build.props'
- 'global.json'
- 'version.json'
- '*.slnx'
pull_request:
branches: [main]
paths:
- '.config/dotnet-tools.json'
- 'Projects/**'
- 'Directory.Build.props'
- 'global.json'
- 'version.json'
- '*.slnx'
jobs:
build-macos:
runs-on: ${{ matrix.os }}
name: Build (${{ matrix.name }})
strategy:
fail-fast: false
matrix:
include:
- os: macos-15
name: MacOS 15
- os: macos-26
name: MacOS 26
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Install Prerequisites
run: |
brew update
brew install icu4c libdeflate zstd argon2
- name: Set Library Path
run: echo "DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
- name: Build
run: dotnet run --project Projects/BuildTool -- --config Release --skip-prereqs
- name: Migration Changes
run: git diff --exit-code ./**/Migrations/*.v*.json
- name: Test
run: |
dotnet test --logger trx --results-directory ./TestResults
if [ -z "$(find ./TestResults -name '*.trx' 2>/dev/null)" ]; then
echo "::error::No test result files were produced - no test projects ran. Failing to avoid masking failures."
exit 1
fi
build-linux:
runs-on: ubuntu-latest
container:
image: ${{ matrix.container }}
options: --security-opt seccomp=unconfined
name: Build (${{ matrix.name }})
strategy:
fail-fast: false
matrix:
include:
- container: ubuntu:noble
name: Ubuntu 24
packageManager: apt
- container: ubuntu:jammy
name: Ubuntu 22
packageManager: apt
- container: debian:trixie
name: Debian 13
packageManager: apt
- container: debian:bookworm
name: Debian 12
packageManager: apt
- container: fedora:42
name: Fedora 42
packageManager: dnf
- container: quay.io/centos/centos:stream9
name: CentOS 9 Stream
packageManager: dnf
steps:
- name: Enable EPEL and CRB for CentOS
run: |
dnf upgrade --refresh -y
dnf install -y epel-release epel-next-release
dnf config-manager --set-enabled crb
if: ${{ startsWith(matrix.name, 'CentOS') }}
- name: Install Prerequisites using dnf
run: dnf makecache --refresh && dnf install -y findutils libicu libdeflate-devel zstd libargon2-devel liburing-devel
if: ${{ matrix.packageManager == 'dnf' }}
- name: Install Prerequisites using apt
run: apt-get update -y && apt-get install -y curl libicu-dev libdeflate-dev zstd libargon2-dev tzdata liburing-dev
if: ${{ matrix.packageManager == 'apt' }}
- uses: actions/checkout@v7
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Build
run: dotnet run --project Projects/BuildTool -- --config Release --skip-prereqs
- name: Test
run: |
dotnet test --logger trx --results-directory ./TestResults
if [ -z "$(find ./TestResults -name '*.trx' 2>/dev/null)" ]; then
echo "::error::No test result files were produced - no test projects ran. Failing to avoid masking failures."
exit 1
fi