Skip to content

Zodrules update

Zodrules update #59

Workflow file for this run

name: PR
on:
pull_request:
branches: [main]
concurrency:
group: ${{ 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, but this repository targets net11.0 and pins
# the .NET 11 SDK in global.json. Without the matching SDK the runner cannot resolve global.json
# ("A compatible .NET SDK was not found") and every step fails, starting with `dotnet tool
# install`. Before global.json pinned a version the same gap failed later instead, with
# NETSDK1045 on the net11.0 target, because the 10.0.x SDK cannot build it.
# Keep in sync with `sdk.version` in global.json.
dotnet-version: "11.0.100-rc.1.26425.128"
run-pack: true
validate-pack: true
secrets: inherit
# The shared pipeline runs the C# suite only, so the TypeScript/Zod side of the cross-platform
# parity guarantee (docs/wiki/Guarantees-and-Limitations.md) would otherwise never run in CI.
# The vitest suite validates the JSON the C# cross-platform tests write, so the C# tests must run
# first, in this same workspace — hence running them here rather than relying on the `build` job.
cross-platform:
name: Cross-platform (C# to Zod)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# Installs exactly the SDK global.json pins, which is the only thing the first dotnet command
# in the job can resolve against. Naming a floating version and a feed quality instead does
# not work: `11.0.x` with quality `preview` resolves the latest *preview*-channel build, and a
# preview sorts below the pinned rc, so global.json is left unsatisfiable.
- uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
- run: bun install --frozen-lockfile
- name: Run the C# cross-platform tests (writes the fixtures vitest reads)
run: >-
dotnet test --solution src/ZodSharp.slnx --configuration Debug
--treenode-filter '/*/ZodSharp.Json/*CrossPlatformTests/*'
- name: Run the TypeScript/Zod cross-platform tests
run: bun run test
# Pack validation checks the IL-merged generator is present in the .nupkg; it cannot check that the
# assembly loads and generates. That merge has regressed twice (#36, #38), both times breaking consumers
# while the in-repo tests stayed green, because those run against the unmerged generator.
packed-generator:
name: Packed generator smoke test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# Same reason as the cross-platform job: the SDK comes from global.json, not a floating
# version plus a feed quality.
- uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Build and run a consumer against the packed generator
shell: pwsh
run: ./scripts/test-packed-generator.ps1 -Configuration Release