-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (71 loc) · 2.73 KB
/
Copy pathci.yml
File metadata and controls
80 lines (71 loc) · 2.73 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
# The build gate — build + unit tests on every pull request and every push to main.
#
# Only `pull_request` and `push` are used. A fork's pull-request run gets a read-only token and no
# secrets, which is what makes it safe to run a stranger's code here at all. `pull_request_target`
# and `workflow_run` would run in this repository's context with access to secrets, and neither is
# used anywhere in this repository for that reason.
#
# The weekly schedule catches SDK and dependency drift in a quiet week, when no push would.
#
# Build + test operate on Stratara.Publish.slnf, the same solution filter the release workflow packs
# from. Integration suites (*IntegrationTests) need Docker and run in integration.yml.
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 6 * * 1' # weekly, Monday 06:00 UTC
workflow_dispatch:
permissions:
contents: read
# A new push to a pull request cancels the run it supersedes. On main every commit is built.
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build-test:
name: Build + unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Restore
run: dotnet restore Stratara.Publish.slnf
- name: Build (Release)
run: dotnet build Stratara.Publish.slnf -c Release --no-restore --nologo
- name: Unit tests (integration suites excluded — need Docker)
shell: bash
run: |
set -euo pipefail
# Mirrors the local gauntlet's test loop: run each MTP test dll directly
# (dotnet test on the csproj reports "Zero tests ran" with Stratara's MTP
# config). Projects not in Publish.slnf produce no Release dll and are
# skipped; *IntegrationTests are skipped by name.
failed=0
for test_proj in tests/*/*.csproj; do
name="$(basename "$(dirname "${test_proj}")")"
case "${name}" in
Stratara.Benchmarks) continue ;;
*IntegrationTests) continue ;;
esac
dll="tests/${name}/bin/Release/net10.0/${name}.dll"
if [[ ! -f "${dll}" ]]; then
echo "--- ${name} --- (no Release dll; not in Publish.slnf — skipping)"
continue
fi
echo ""
echo "--- ${name} ---"
if ! dotnet "${dll}"; then
failed=1
fi
done
if [[ ${failed} -ne 0 ]]; then
echo "Unit tests failed." >&2
exit 1
fi