Repository navigation
78 lines (68 loc) · 3.85 KB
/
Copy pathpr.yml
File metadata and controls
78 lines (68 loc) · 3.85 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
name: PR
on:
pull_request:
branches: [main]
concurrency:
group: pr-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build and test
uses: purview-dev/build/.github/workflows/purview-build.yml@main
with:
# The shared workflow defaults to the 10.0.x SDK, which cannot build the net11.0 target this
# repository gained (NETSDK1045). Keep in sync with `sdk.version` in global.json.
dotnet-version: "11.0.100"
run-pack: true
validate-pack: true
secrets: inherit
# Every other job builds against ProjectReferences; this one builds what ships. It packs Purview.ValueObjects to an
# isolated feed and package cache, then publishes and runs consumers that reference the package only - a Native AOT
# console, a Blazor WebAssembly app (trimmed and RunAOTCompilation, run in headless Chrome), a Blazor Server app
# and a net10.0 console - and leak-scans every bin and publish folder for compiler-host assemblies. It then proves
# every PackValidation ForbiddenContent rule rejects a package. `just smoke-packed-consumers` and
# `just verify-pack-rules` run the same locally.
packed-consumers:
name: Packed consumers (Native AOT, Blazor WebAssembly, Blazor Server)
runs-on: ubuntu-latest
env:
# An extra feed for Purview.SourceGeneratorFramework* and Purview.ZodSharp* only, for versions that are not on
# nuget.org yet. Unset, the gate restores them from nuget.org alone.
VALUEOBJECTS_DEPENDENCY_FEED: ${{ vars.VALUEOBJECTS_DEPENDENCY_FEED }}
steps:
- uses: actions/checkout@v7
# The SDK global.json pins, plus the .NET 10 SDK and runtime the oldest consumer builds and runs on. The pin is
# named here rather than left to global-json-file: setup-dotnet reads a global.json whose rollForward is
# latestMajor as "the latest" and installs the LTS channel, so global-json-file alone installs 10.0.x and every
# later `dotnet` command fails with "A compatible .NET SDK was not found" for the 11.x pin.
# Keep both versions in sync with `sdk.version` in global.json.
- uses: actions/setup-dotnet@v6
with:
dotnet-version: |
11.0.100
10.0.x
# First, before any toolchain is installed: the generator is built against the Purview.SourceGeneratorFramework
# version Directory.Packages.props pins, and the consumers use the pinned Purview.ZodSharp. Until both are on
# nuget.org (or the VALUEOBJECTS_DEPENDENCY_FEED repository variable names a feed that has them) this fails here,
# with what to do, rather than skipping.
- name: Check the build-time and consumer dependencies restore
shell: pwsh
run: ./scripts/test-packed-consumers.ps1 -PreflightOnly
# Native AOT links with clang and needs the zlib headers; the hosted image may not carry both.
- name: Install the Native AOT prerequisites
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends clang zlib1g-dev
# RunAOTCompilation needs the Emscripten toolchain and the Mono AOT cross compiler. -WasmAot Require below makes
# a missing workload an error instead of a skipped step.
- name: Install the wasm-tools workload
run: dotnet workload install wasm-tools
# The hosted image ships Google Chrome; -Browser Require fails if it ever stops doing so.
- name: Pack, then publish, run and leak-scan consumers of the package
shell: pwsh
run: >-
./scripts/test-packed-consumers.ps1 -RuntimeIdentifier linux-x64 -WasmAot Require -Browser Require
-PackOutput artifacts/packed
- name: Prove every pack-validation forbidden-content rule rejects a package
shell: pwsh
run: |
./scripts/restore-dotnet-tools.ps1
./scripts/test-pack-validation-rules.ps1 -PackagesFolder artifacts/packed