mirror of
https://github.com/2dust/v2rayN.git
synced 2026-09-14 18:32:10 +03:00
Follow-ups to #10007, none of which change what the test command does. The `paths:` filter listed individual source folders rather than the projects the suite builds, so a change anywhere else in that build produced no check at all. Of the last 40 merged pull requests, 31 touch the test build and 15 of those ran no tests. #9976 and #9932 edit `ServiceLib/Common/`, which every test depends on, and neither shows a single check. `Directory.Build.props` is the sharpest case: it sets `TargetFramework` and the Release options for every project, so an edit there can break the test build without producing a workflow run at all. The filter now follows the project graph instead. `ServiceLib.Tests` references `ServiceLib`, which references `ServiceLib.UdpTest`, and `Directory.Build.*`, `Directory.Packages.props` and `global.json` configure that build. It is shorter than the list it replaces, needs no edit when a test is added or a class moves, and still skips UI and documentation work: of those same 40 pull requests, 9 stay filtered out. `global.json` belongs there for a different reason: it does not affect a single line of the code under test, but it decides whether the tests run at all, so a bad edit there silently reproduces the failure #10007 fixed. The Checkout step needs neither `submodules: 'recursive'` nor `fetch-depth: '0'`. `GlobalHotKeys` is pulled in by `v2rayN.Desktop` only, and nothing in this job reads git history. `global.json` also gained the final newline `.editorconfig` asks for with `insert_final_newline = true` under `[*]`.
42 lines
944 B
YAML
42 lines
944 B
YAML
name: Code Test
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- 'v2rayN/ServiceLib/**'
|
|
- 'v2rayN/ServiceLib.UdpTest/**'
|
|
- 'v2rayN/ServiceLib.Tests/**'
|
|
- 'v2rayN/Directory.Build.*'
|
|
- 'v2rayN/Directory.Packages.props'
|
|
- 'global.json'
|
|
- '.github/workflows/test.yml'
|
|
|
|
permissions:
|
|
checks: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v6
|
|
with:
|
|
dotnet-version: '10.x'
|
|
dotnet-quality: 'ga'
|
|
|
|
- name: Test Code
|
|
run: dotnet test --project ./v2rayN/ServiceLib.Tests -c Release --results-directory ./TestResults -- --report-trx
|
|
|
|
- name: Comment PR with results
|
|
if: always()
|
|
uses: EnricoMi/publish-unit-test-result-action@v2
|
|
with:
|
|
files: ./TestResults/*.trx
|
|
comment_mode: failures
|