Skip to content

Fix assembly definition public key token computation #834

Fix assembly definition public key token computation

Fix assembly definition public key token computation #834

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
# Detect what changed to determine which jobs to run
changes:
runs-on: ubuntu-latest
outputs:
code: ${{ steps.filter.outputs.code }}
docs: ${{ steps.filter.outputs.docs }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Detect changes
id: filter
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
FILES=$(gh pr diff ${{ github.event.pull_request.number }} --name-only)
else
BEFORE=${{ github.event.before }}
if [ "$BEFORE" = "0000000000000000000000000000000000000000" ]; then
BEFORE=HEAD~1
fi
FILES=$(git diff --name-only "$BEFORE"..."${{ github.sha }}")
fi
CODE=false
DOCS=false
while IFS= read -r file; do
case "$file" in
src/*)
case "$file" in
*.md|*.txt) ;;
*) CODE=true ;;
esac ;;
*.props|*.sln) CODE=true ;;
.github/workflows/*) CODE=true ;;
esac
case "$file" in
*.md|*.txt|docs/*|skills/*) DOCS=true ;;
esac
done <<< "$FILES"
echo "code=$CODE" >> "$GITHUB_OUTPUT"
echo "docs=$DOCS" >> "$GITHUB_OUTPUT"
echo "Changed files:"
echo "$FILES"
echo "code=$CODE docs=$DOCS"
env:
GH_TOKEN: ${{ github.token }}
# Lint markdown files
markdownlint:
needs: changes
if: needs.changes.outputs.docs == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Run markdownlint
uses: DavidAnson/markdownlint-cli2-action@v19
with:
globs: '**/*.md'
# Build and test on Ubuntu and Windows
test:
needs: changes
if: needs.changes.outputs.code == 'true'
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
rid: linux-x64
- os: windows-latest
rid: win-x64
- os: macos-latest
rid: osx-arm64
runs-on: ${{ matrix.os }}
env:
DOTNET_INSPECT_TIPS: q
steps:
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '11.0.x'
dotnet-quality: 'preview'
- name: Build
run: dotnet build src/dotnet-inspect -c Release
- name: Install ilspycmd
run: dotnet tool install -g ilspycmd --allow-roll-forward
- name: Install ilasm/ildasm
continue-on-error: true
shell: bash
run: |
RID=${{ matrix.rid }}
VERSION=11.0.0-preview.1.26104.118
PACKAGES_DIR=$(mktemp -d)
PROJ_DIR=$(mktemp -d)
cat > "$PROJ_DIR/iltools.csproj" <<EOF
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup><TargetFramework>net11.0</TargetFramework></PropertyGroup>
<ItemGroup>
<PackageDownload Include="runtime.${RID}.Microsoft.NETCore.ILAsm" Version="[${VERSION}]" />
<PackageDownload Include="runtime.${RID}.Microsoft.NETCore.ILDAsm" Version="[${VERSION}]" />
</ItemGroup>
</Project>
EOF
dotnet restore "$PROJ_DIR/iltools.csproj" --packages "$PACKAGES_DIR" --source https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet11/nuget/v3/index.json --source https://api.nuget.org/v3/index.json
ILASM_DIR="$PACKAGES_DIR/runtime.$RID.microsoft.netcore.ilasm/$VERSION/runtimes/$RID/native"
ILDASM_DIR="$PACKAGES_DIR/runtime.$RID.microsoft.netcore.ildasm/$VERSION/runtimes/$RID/native"
chmod +x "$ILASM_DIR"/* "$ILDASM_DIR"/* 2>/dev/null || true
echo "$ILASM_DIR" >> "$GITHUB_PATH"
echo "$ILDASM_DIR" >> "$GITHUB_PATH"
- name: Run tests
run: dotnet run --project src/dotnet-inspect.Tests -c Release
# Pack and smoke test on Ubuntu
pack:
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-latest
env:
DOTNET_INSPECT_TIPS: q
steps:
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '11.0.x'
dotnet-quality: 'preview'
- name: Pack pointer package
run: dotnet pack src/dotnet-inspect -c Release -p:OfficialBuild=true
- name: Upload pointer package
uses: actions/upload-artifact@v7
with:
name: package-pointer
path: artifacts/package/release/*.nupkg
if-no-files-found: error
- name: Pack any (non-AOT) package
run: dotnet pack src/dotnet-inspect -c Release -r any -p:PublishAot=false -p:OfficialBuild=true
- name: Upload any package
uses: actions/upload-artifact@v7
with:
name: package-any
path: artifacts/package/release/*.nupkg
if-no-files-found: error
- name: Pack linux-x64 AOT package
run: dotnet pack src/dotnet-inspect -c Release -r linux-x64 -p:OfficialAotBuild=true
- name: Upload linux-x64 package
uses: actions/upload-artifact@v7
with:
name: package-linux-x64
path: artifacts/package/release/*.nupkg
if-no-files-found: error
- name: Install tool from local packages
run: dotnet tool install --global dotnet-inspect --add-source ./artifacts/package/release --no-cache
- name: Smoke test - version
run: |
OUTPUT=$(dotnet-inspect --version)
echo "$OUTPUT"
echo "$OUTPUT" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+'
- name: Smoke test - help
run: |
OUTPUT=$(dotnet-inspect --help)
echo "$OUTPUT"
echo "$OUTPUT" | grep -q "dotnet-inspect"
- name: Smoke test - package quiet
run: |
dotnet-inspect package System.Text.Json 10.0.0 -v:q > smoke-package.md
cat smoke-package.md
grep -q "System.Text.Json" smoke-package.md
grep -q "Library" smoke-package.md
- name: Smoke test - package normal
run: |
dotnet-inspect package System.Text.Json 10.0.0 -v:n > smoke-package-normal.md
cat smoke-package-normal.md
grep -q "## Package" smoke-package-normal.md
grep -q "## Package Dependencies" smoke-package-normal.md
grep -q "Library" smoke-package-normal.md
- name: Smoke test - type command (oneline default)
run: |
dotnet-inspect type --package System.Text.Json@10.0.0 -t 5 > smoke-type.txt
cat smoke-type.txt
grep -q "JsonSerializer" smoke-type.txt
- name: Smoke test - member command (oneline default)
run: |
dotnet-inspect member JsonSerializer --package System.Text.Json@10.0.0 -m 5 > smoke-member.txt
cat smoke-member.txt
grep -q "Serialize" smoke-member.txt
grep -q "Deserialize" smoke-member.txt
- name: Smoke test - type command (markdown)
run: |
dotnet-inspect type --package System.Text.Json@10.0.0 -v:m -t 5 > smoke-type.md
cat smoke-type.md
grep -q "JsonSerializer" smoke-type.md
- name: Smoke test - member command (markdown)
run: |
dotnet-inspect member JsonSerializer --package System.Text.Json@10.0.0 -v:m -m 5 > smoke-member.md
cat smoke-member.md
grep -q "JsonSerializer" smoke-member.md
grep -q "Serialize" smoke-member.md
grep -q "Deserialize" smoke-member.md
- name: Smoke test - platform command
run: |
dotnet-inspect platform list > smoke-platform.txt || true
cat smoke-platform.txt
- name: Validate markdown output
run: |
npm install -g markdownlint-cli
markdownlint smoke-*.md
- name: Uninstall tool
run: dotnet tool uninstall --global dotnet-inspect
# Build RID-specific Native AOT packages (cross-platform)
pack-rid:
needs: changes
if: needs.changes.outputs.code == 'true'
strategy:
fail-fast: false
matrix:
include:
- rid: win-x64
os: windows-latest
- rid: win-arm64
os: windows-latest
- rid: linux-arm64
os: ubuntu-24.04-arm
- rid: osx-arm64
os: macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '11.0.x'
dotnet-quality: 'preview'
- name: Pack RID-specific package
run: dotnet pack src/dotnet-inspect -c Release -r ${{ matrix.rid }} -p:OfficialAotBuild=true
- name: Upload RID package
uses: actions/upload-artifact@v7
with:
name: package-${{ matrix.rid }}
path: artifacts/package/release/*.nupkg
if-no-files-found: error