Skip to content
Draft
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
63 changes: 63 additions & 0 deletions .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Conformance

on:
push:
branches:
- "**"
paths:
- "conformance/**"
- "src/SIL.Machine.Morphology.HermitCrab*/**"
pull_request:
paths:
- "conformance/**"
- "src/SIL.Machine.Morphology.HermitCrab*/**"

jobs:
conformance:
name: Conformance suite
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v6

- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
10.0.x

- name: Restore dependencies
run: dotnet restore src/SIL.Machine.Morphology.HermitCrab.Conformance/SIL.Machine.Morphology.HermitCrab.Conformance.csproj

# Gate (a): every fixture's declared parses/rejections must match what the C# oracle
# actually produces (self-check mode runs the reference engine in-process against every
# words.yaml, including budget_ms pathological fixtures).
- name: Run conformance self-check
run: >-
dotnet run --no-restore --project src/SIL.Machine.Morphology.HermitCrab.Conformance --
--fixtures conformance --include-pathological

# Gate (b): zero dead rules. --coverage-report also (re)writes fixtures.csv/coverage.csv/
# rules.csv, which the next step checks for staleness. This step's own exit code is the
# dead-rule gate (Program.cs returns 1 when CoverageReport.WriteCsvs finds any rule no word
# exercises) -- deliberately not grepped from stdout, which would be brittle. `if: always()`
# so this still runs (and reports its own true status) even if the self-check step above
# failed, keeping the two gates distinguishable in the log rather than one skipping the other.
- name: Run coverage report (dead-rule gate)
if: always()
run: >-
dotnet run --no-restore --project src/SIL.Machine.Morphology.HermitCrab.Conformance --
--fixtures conformance --coverage-report

# Gate (c): the checked-in fixtures.csv/coverage.csv/rules.csv must already reflect the
# fixtures as they stand -- generated so nobody needs to remember to refresh them, but that
# only holds if forgetting to refresh them is a CI failure. Runs after the coverage-report
# step (which just regenerated all three) and `if: always()` for the same reason as above:
# a dead rule and a stale index are two different failures and must not collapse into one.
- name: Verify generated coverage files are fresh
if: always()
run: |
if ! git diff --exit-code -- conformance/fixtures.csv conformance/coverage.csv conformance/rules.csv; then
echo "::error::conformance/fixtures.csv, coverage.csv, or rules.csv is stale relative to the fixtures (diff above). Run 'dotnet run --project src/SIL.Machine.Morphology.HermitCrab.Conformance -- --fixtures conformance --coverage-report' locally and commit the result."
exit 1
fi
7 changes: 7 additions & 0 deletions Machine.sln
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SIL.Machine.Tokenization.Se
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SIL.Machine.Tokenization.SentencePiece.Tests", "tests\SIL.Machine.Tokenization.SentencePiece.Tests\SIL.Machine.Tokenization.SentencePiece.Tests.csproj", "{AB5F75C1-64B7-4E0F-A4B5-B14EB16E6DDC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SIL.Machine.Morphology.HermitCrab.Conformance", "src\SIL.Machine.Morphology.HermitCrab.Conformance\SIL.Machine.Morphology.HermitCrab.Conformance.csproj", "{8E40C2C5-F4C5-4A41-B78A-10A43FCF0CE3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -99,6 +101,10 @@ Global
{AB5F75C1-64B7-4E0F-A4B5-B14EB16E6DDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB5F75C1-64B7-4E0F-A4B5-B14EB16E6DDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB5F75C1-64B7-4E0F-A4B5-B14EB16E6DDC}.Release|Any CPU.Build.0 = Release|Any CPU
{8E40C2C5-F4C5-4A41-B78A-10A43FCF0CE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E40C2C5-F4C5-4A41-B78A-10A43FCF0CE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E40C2C5-F4C5-4A41-B78A-10A43FCF0CE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E40C2C5-F4C5-4A41-B78A-10A43FCF0CE3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -116,6 +122,7 @@ Global
{0BBEED18-3CC1-4BA6-8E11-603A5D2DEDC9} = {31B4F5EB-E148-4A51-84B5-B90BB8F38AD3}
{09135223-6285-4268-BFA3-147BDB5B663B} = {31B4F5EB-E148-4A51-84B5-B90BB8F38AD3}
{AB5F75C1-64B7-4E0F-A4B5-B14EB16E6DDC} = {66246A1C-8D45-40FB-A660-C58577122CA7}
{8E40C2C5-F4C5-4A41-B78A-10A43FCF0CE3} = {31B4F5EB-E148-4A51-84B5-B90BB8F38AD3}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9F18C25E-E140-43C3-B177-D562E1628370}
Expand Down
Loading
Loading