Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Build OGraph project
description: >-
Restore, build, and (optionally) test a single OGraph project against the SDK
pinned in global.json. Warnings-as-errors is disabled so the tree's ~1k
documentation warnings (CS1591) never fail a build. Modelled on the Cohesion
composite-build pattern (assimalign/cohesion Project #13, roadmap N-01).

Two escape hatches keep CI green on a tree that is still being restored,
without silently swallowing regressions:
* allow-build-failure — for projects with known, deferred build errors
(Assimalign.OGraph.Server). The build still runs; a failure becomes a loud
::warning annotation instead of a red job, and tests are skipped.
* allow-test-failure — for suites that are pre-existing red or are empty
stubs. The build still gates; only the test phase is downgraded to a
::warning. Flip these back to a hard gate once the suites are green.

inputs:
project:
description: Path to the project (.csproj) or directory to restore and build.
required: true
tests:
description: >-
Path to a test project (.csproj) or directory. When set and the path
exists, `dotnet test` runs after a successful build. Leave empty for areas
with no tests (e.g. Core) or whose tests cannot run on this runner (e.g.
the net472 analyzer tests on ubuntu — see ograph-analyzers.yml).
required: false
default: ''
configuration:
description: Build configuration.
required: false
default: Release
allow-build-failure:
description: >-
When 'true', a build failure is reported as a warning annotation instead
of failing the job (used for the Server library's deferred errors).
required: false
default: 'false'
allow-test-failure:
description: >-
When 'true', a test failure (or an empty test stub) is reported as a
warning annotation instead of failing the job.
required: false
default: 'false'
annotation-title:
description: Friendly label used in warning/error annotations.
required: false
default: ''

runs:
using: composite
steps:
# global.json pins the SDK but is JSONC (contains a // comment), which
# setup-dotnet's strict JSON parser rejects via `global-json-file`. Source
# the pinned version from global.json ourselves (comment-tolerant) so the
# pin still drives CI. `dotnet build`/`restore` read global.json directly and
# already tolerate the comment.
- name: Resolve pinned SDK version (from global.json)
id: sdk
shell: bash
run: |
ver=$(sed -E 's://.*$::' global.json \
| grep -oE '"version"[[:space:]]*:[[:space:]]*"[^"]+"' \
| head -1 | grep -oE '[0-9][^"]*')
echo "version=$ver" >> "$GITHUB_OUTPUT"
echo "Pinned SDK from global.json: $ver"

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ steps.sdk.outputs.version }}

- name: Restore, build & test
shell: bash
run: |
set -o pipefail
PROJECT='${{ inputs.project }}'
TESTS='${{ inputs.tests }}'
CONFIG='${{ inputs.configuration }}'
TITLE='${{ inputs.annotation-title }}'
[ -z "$TITLE" ] && TITLE="$PROJECT"

echo "::group::Restore $PROJECT"
dotnet restore "$PROJECT"
echo "::endgroup::"

# -warnaserror off: never let documentation/style warnings gate a build.
echo "::group::Build $PROJECT"
if dotnet build "$PROJECT" --configuration "$CONFIG" --no-restore -p:TreatWarningsAsErrors=false; then
BUILD_OK=1
else
BUILD_OK=0
fi
echo "::endgroup::"

if [ "$BUILD_OK" -ne 1 ]; then
if [ '${{ inputs.allow-build-failure }}' = 'true' ]; then
echo "::warning title=$TITLE — build failing (non-blocking)::Known, pre-existing build errors; intentionally NOT gating CI. Restore this project before promoting it to a required gate."
exit 0
fi
echo "::error title=$TITLE — build failed::"
exit 1
fi

if [ -n "$TESTS" ] && [ -e "$TESTS" ]; then
echo "::group::Test $TESTS"
if dotnet test "$TESTS" --configuration "$CONFIG" -p:TreatWarningsAsErrors=false --verbosity normal; then
echo "Tests passed."
else
if [ '${{ inputs.allow-test-failure }}' = 'true' ]; then
echo "::warning title=$TITLE — tests failing (non-blocking)::Known, pre-existing failures or an empty stub; intentionally NOT gating CI. Make the suite green before promoting it to a required gate."
else
echo "::error title=$TITLE — tests failed::"
echo "::endgroup::"
exit 1
fi
fi
echo "::endgroup::"
fi
68 changes: 68 additions & 0 deletions .github/workflows/ograph-analyzers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: ograph-analyzers

# Analyzers area (analyzers/src): the Roslyn source generators and code fixes
# (ToolKit.Gdm.* and ToolKit.TypeUtilities.*). These target netstandard2.0 and
# build cleanly on ubuntu — the build is a required gate.
#
# MATRIX EXTENSION POINT (windows-latest):
# The analyzer test project
# (analyzers/tests/…​TypeUtilities.SourceGeneration.Tests) targets net472 and
# cannot build or run on ubuntu-latest. Running it is the one place a
# windows-latest leg adds real value. When that suite is ready, extend this
# job with a matrix and gate the tests to Windows, e.g.:
#
# strategy:
# matrix:
# os: [ubuntu-latest, windows-latest]
# runs-on: ${{ matrix.os }}
# ...
# - if: runner.os == 'Windows'
# uses: ./.github/actions/build
# with:
# project: analyzers/tests/Assimalign.OGraph.ToolKit.TypeUtilities.SourceGeneration.Tests/Assimalign.OGraph.ToolKit.TypeUtilities.SourceGeneration.Tests.csproj
# tests: analyzers/tests/Assimalign.OGraph.ToolKit.TypeUtilities.SourceGeneration.Tests/Assimalign.OGraph.ToolKit.TypeUtilities.SourceGeneration.Tests.csproj
#
# For now: ubuntu-only, build the generators/code-fixes only.

on:
push:
branches: [main, development]
paths:
- 'global.json'
- 'Directory.Build.props'
- 'Directory.Build.targets'
- 'build/**'
- 'analyzers/**'
- '.github/actions/build/**'
- '.github/workflows/ograph-analyzers.yml'
pull_request:
paths:
- 'global.json'
- 'Directory.Build.props'
- 'Directory.Build.targets'
- 'build/**'
- 'analyzers/**'
- '.github/actions/build/**'
- '.github/workflows/ograph-analyzers.yml'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build
with:
project: analyzers/src/Assimalign.OGraph.ToolKit.Gdm.SourceGeneration/Assimalign.OGraph.ToolKit.Gdm.SourceGeneration.csproj
annotation-title: Analyzers · Gdm.SourceGeneration
- uses: ./.github/actions/build
with:
project: analyzers/src/Assimalign.OGraph.ToolKit.Gdm.CodeFixes/Assimalign.OGraph.ToolKit.Gdm.CodeFixes.csproj
annotation-title: Analyzers · Gdm.CodeFixes
- uses: ./.github/actions/build
with:
project: analyzers/src/Assimalign.OGraph.ToolKit.TypeUtilities.SourceGeneration/Assimalign.OGraph.ToolKit.TypeUtilities.SourceGeneration.csproj
annotation-title: Analyzers · TypeUtilities.SourceGeneration
- uses: ./.github/actions/build
with:
project: analyzers/src/Assimalign.OGraph.ToolKit.TypeUtilities.CodeFixes/Assimalign.OGraph.ToolKit.TypeUtilities.CodeFixes.csproj
annotation-title: Analyzers · TypeUtilities.CodeFixes
88 changes: 38 additions & 50 deletions .github/workflows/ograph-client.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,45 @@
name: ograph.client.ci
name: ograph-client

# Client library (libraries/Assimalign.OGraph.Client). Build is a required gate.
# The test project is currently an empty stub (no discoverable tests), so the
# test phase is non-blocking — tracked in #90. Drop allow-test-failure once real
# tests exist.
#
# Runner: ubuntu-latest.

on:
push:
branches:
- main
- development
paths:
- 'Directory.Build.props' # When the Global Props File Changes
- 'libraries/Client/src/**'
- '.github/workflows/assimalign.ograph.client.yml' # When Pipeline File Changes


branches: [main, development]
paths:
- 'global.json'
- 'Directory.Build.props'
- 'Directory.Build.targets'
- 'build/**'
- 'libraries/Directory.Build.props'
- 'libraries/Directory.Build.targets'
- 'libraries/Assimalign.OGraph.Client/**'
- '.github/actions/build/**'
- '.github/workflows/ograph-client.yml'
pull_request:
paths:
- 'global.json'
- 'Directory.Build.props'
- 'Directory.Build.targets'
- 'build/**'
- 'libraries/Directory.Build.props'
- 'libraries/Directory.Build.targets'
- 'libraries/Assimalign.OGraph.Client/**'
- '.github/actions/build/**'
- '.github/workflows/ograph-client.yml'

jobs:
build:
runs-on: windows-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.x'

- name: Setup .NET 7
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.x'
include-prerelease: true

- name: Setup .NET 8
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.x'
include-prerelease: true

- name: Restore Project
run: dotnet restore
working-directory: './libraries/Client/src/Assimalign.OGraph.Client'

- name: Build Project
run: dotnet build --configuration Release --no-restore
working-directory: './libraries/Client/src/Assimalign.OGraph.Client'

- name: Restore Unit Tests Project
run: dotnet restore
working-directory: './libraries/Client/tests/Assimalign.OGraph.Client.Tests'

- name: Run Unit Tests
run: dotnet test --no-restore --verbosity normal
working-directory: './libraries/Client/tests/Assimalign.OGraph.Client.Tests'

- name: Publish Nuget Package
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: dotnet nuget push "*.nupkg" -k ${{ secrets.NUGET_PUBLISHING_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
working-directory: './libraries/Client/src/Assimalign.OGraph.Client/bin/Release/'
- uses: actions/checkout@v4
- uses: ./.github/actions/build
with:
project: libraries/Assimalign.OGraph.Client/src/Assimalign.OGraph.Client.csproj
tests: libraries/Assimalign.OGraph.Client/tests/Assimalign.OGraph.Client.Tests.csproj
allow-test-failure: 'true'
annotation-title: Client
84 changes: 36 additions & 48 deletions .github/workflows/ograph-core.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,43 @@
name: ograph.client.ci
name: ograph-core

# Core library (libraries/Assimalign.OGraph.Core): thin error primitives +
# re-exports. No test project yet, so only the build phase runs.
#
# Runner: ubuntu-latest (every OGraph library targets net10.0). A windows-latest
# leg adds no value for this area yet — see ograph-analyzers.yml for the matrix
# extension point where it does.

on:
push:
branches:
- main
- development
paths:
- 'Directory.Build.props' # When the Global Props File Changes
- 'libraries/Core/src/**'
- '.github/workflows/assimalign.ograph.core.yml' # When Pipeline File Changes
branches: [main, development]
paths:
- 'global.json'
- 'Directory.Build.props'
- 'Directory.Build.targets'
- 'build/**'
- 'libraries/Directory.Build.props'
- 'libraries/Directory.Build.targets'
- 'libraries/Assimalign.OGraph.Core/**'
- '.github/actions/build/**'
- '.github/workflows/ograph-core.yml'
pull_request:
paths:
- 'global.json'
- 'Directory.Build.props'
- 'Directory.Build.targets'
- 'build/**'
- 'libraries/Directory.Build.props'
- 'libraries/Directory.Build.targets'
- 'libraries/Assimalign.OGraph.Core/**'
- '.github/actions/build/**'
- '.github/workflows/ograph-core.yml'

jobs:
build:
runs-on: windows-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.x'

- name: Setup .NET 7
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.x'
include-prerelease: true

- name: Setup .NET 8
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.x'
include-prerelease: true

- name: Restore Project
run: dotnet restore
working-directory: './libraries/Core/src/Assimalign.OGraph.Core'

- name: Build Project
run: dotnet build --configuration Release --no-restore
working-directory: './libraries/Core/src/Assimalign.OGraph.Core'

- name: Restore Unit Tests Project
run: dotnet restore
working-directory: './libraries/Core/tests/Assimalign.OGraph.Core.Tests'

- name: Run Unit Tests
run: dotnet test --no-restore --verbosity normal
working-directory: './libraries/Core/tests/Assimalign.OGraph.Core.Tests'

- name: Publish Nuget Package
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: dotnet nuget push "*.nupkg" -k ${{ secrets.NUGET_PUBLISHING_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
working-directory: './libraries/Core/src/Assimalign.OGraph.Core/bin/Release/'
- uses: actions/checkout@v4
- uses: ./.github/actions/build
with:
project: libraries/Assimalign.OGraph.Core/src/Assimalign.OGraph.Core.csproj
annotation-title: Core
Loading
Loading