Skip to content

Bump Meziantou.Analyzer from 3.0.117 to 3.0.123 #489

Bump Meziantou.Analyzer from 3.0.117 to 3.0.123

Bump Meziantou.Analyzer from 3.0.117 to 3.0.123 #489

Workflow file for this run

name: AOT Publish Smoke
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
jobs:
aot-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup .NET
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5
with:
global-json-file: global.json
- name: Resolve package versions
id: versions
run: |
python - <<'PY'
import os
import xml.etree.ElementTree as ET
def read_text(path, tag):
root = ET.parse(path).getroot()
node = root.find(f".//{tag}")
return (node.text or "").strip()
version_prefix = read_text("Version.props", "VersionPrefix")
version_suffix = read_text("Version.props", "VersionSuffix")
version = version_prefix if not version_suffix else f"{version_prefix}-{version_suffix}"
openapi_version = read_text("Version.props", "MicrosoftAspNetCoreOpenApiVersion")
output_path = os.environ["GITHUB_OUTPUT"]
with open(output_path, "a", encoding="utf-8") as output:
output.write(f"version={version}\n")
output.write(f"openapi_version={openapi_version}\n")
PY
- name: Build and pack local packages
run: |
dotnet build src/ErrorOrX/ErrorOrX.csproj -c Release
dotnet build src/ErrorOrX.Generators/ErrorOrX.Generators.csproj -c Release
dotnet pack src/ErrorOrX/ErrorOrX.csproj -c Release -o artifacts -p:Version=${{ steps.versions.outputs.version }} --no-build
dotnet pack src/ErrorOrX.Generators/ErrorOrX.Generators.csproj -c Release -o artifacts -p:Version=${{ steps.versions.outputs.version }} --no-build
- name: Create AOT sample (package-based)
run: |
project_dir="$RUNNER_TEMP/errororx-aot-sample"
src_dir="samples/ErrorOrX.Samples.Api"
mkdir -p "$project_dir/Domain"
# Copy source files only. Skip the source .csproj, bin/, obj/, README.md, and requests.http
# — the .csproj is regenerated below with vanilla Microsoft.NET.Sdk.Web for a clean AOT test
# against the published packages, not the project references the repo csproj uses.
cp "$src_dir/Program.cs" "$project_dir/"
cp "$src_dir/AppJsonSerializerContext.cs" "$project_dir/"
cp "$src_dir/TodoApi.cs" "$project_dir/"
cp "$src_dir/OrderApi.cs" "$project_dir/"
cp "$src_dir/AdvancedErrorHandlingApi.cs" "$project_dir/"
cp "$src_dir/AdminApi.cs" "$project_dir/"
cp "$src_dir/Domain/Todo.cs" "$project_dir/Domain/"
cp "$src_dir/Domain/ITodoService.cs" "$project_dir/Domain/"
cp "$src_dir/Domain/TodoService.cs" "$project_dir/Domain/"
cp "$src_dir/Domain/CreateOrderRequest.cs" "$project_dir/Domain/"
cp "$src_dir/Domain/IOrderService.cs" "$project_dir/Domain/"
cat > "$project_dir/nuget.config" <<EOF
<configuration>
<packageSources>
<clear />
<add key="local-artifacts" value="${GITHUB_WORKSPACE}/artifacts" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
EOF
cat > "$project_dir/ErrorOrX.Samples.Api.csproj" <<EOF
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>ErrorOrX.Samples.Api</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>\$(BaseIntermediateOutputPath)\\GeneratedFiles</CompilerGeneratedFilesOutputPath>
<ErrorOrGenerateJsonContext>false</ErrorOrGenerateJsonContext>
</PropertyGroup>
<ItemGroup>
<Using Include="ErrorOr" />
<Using Include="ErrorOrX.Samples.Api" />
<Using Include="ErrorOrX.Samples.Api.Domain" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="${{ steps.versions.outputs.openapi_version }}" />
<PackageReference Include="ErrorOrX" Version="${{ steps.versions.outputs.version }}" />
<PackageReference Include="ErrorOrX.Generators" Version="${{ steps.versions.outputs.version }}" PrivateAssets="all" />
</ItemGroup>
</Project>
EOF
# Gate, not smoke test: a green `dotnet publish` is not enough. The regenerated sample lives in
# $RUNNER_TEMP (outside the repo's TreatWarningsAsErrors), so trim/AOT IL warnings stay warnings and
# the publish exits 0 — they would hide a regression where a generated endpoint slips onto the
# reflection RequestDelegateFactory path or emits a [RequiresUnreferencedCode] call site. Fail on any
# ILxxxx. ErrorOrX-generated code must publish AOT-clean; fix the generator, never suppress.
- name: Publish AOT (fail on trim/AOT IL warnings)
working-directory: ${{ runner.temp }}/errororx-aot-sample
run: |
set -o pipefail
dotnet publish -c Release -r linux-x64 -p:PublishAot=true --self-contained --configfile nuget.config 2>&1 | tee publish.log
if grep -nE 'IL[0-9]{4}' publish.log; then
echo "::error::Native AOT publish surfaced trim/AOT (ILxxxx) warnings (above). Fix the generator — do not suppress."
exit 1
fi
echo "Native AOT publish clean — 0 ILxxxx warnings."