Bump GitHubActionsTestLogger from 2.4.1 to 3.0.1 #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: NativeAOT | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - 'hotfix/**' | |
| tags: | |
| - '*' | |
| pull_request: | |
| # Cancel previous PR branch commits (head_ref is only defined on PRs) | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| env: | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| AOT_Compat: | | |
| param([string]$targetFramework) | |
| $publishOutput = dotnet publish test/Npgsql.NativeAotTests/Npgsql.NativeAotTests.csproj -r linux-x64 -c Release -f $targetFramework -p:RootNpgsql=true | |
| $actualWarningCount = 0 | |
| foreach ($line in $($publishOutput -split "`r`n")) | |
| { | |
| if ($line -like "*analysis warning IL*") | |
| { | |
| Write-Host $line | |
| $actualWarningCount += 1 | |
| } | |
| } | |
| $testPassed = 0 | |
| $binaryPath = "test/Npgsql.NativeAotTests/bin/Release/$targetFramework/linux-x64/native/" | |
| if (-not (Test-Path -LiteralPath $binaryPath)) | |
| { | |
| $testPassed = 1 | |
| Write-Host "Could not publish app, output was:" | |
| foreach ($line in $($publishOutput -split "`r`n")) | |
| { | |
| Write-Host $line | |
| } | |
| } | |
| Write-Host "Actual warning count is:", $actualWarningCount | |
| $expectedWarningCount = 0 | |
| if ($actualWarningCount -ne $expectedWarningCount) | |
| { | |
| $testPassed = 2 | |
| Write-Host "Actual warning count:", $actualWarningCount, "is not as expected. Expected warning count is:", $expectedWarningCount | |
| } | |
| Exit $testPassed | |
| # Uncomment and edit the following to use nightly/preview builds | |
| # nuget_config: | | |
| # <?xml version="1.0" encoding="utf-8"?> | |
| # <configuration> | |
| # | |
| # <packageSources> | |
| # <add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> | |
| # <add key="dotnet8" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" /> | |
| # </packageSources> | |
| # | |
| # <packageSourceMapping> | |
| # <packageSource key="nuget.org"> | |
| # <package pattern="*" /> | |
| # </packageSource> | |
| # <packageSource key="dotnet8"> | |
| # <package pattern="runtime.*" /> | |
| # <package pattern="Microsoft.NETCore.App.Runtime.*" /> | |
| # <package pattern="Microsoft.AspNetCore.App.Runtime.*" /> | |
| # <package pattern="Microsoft.NET.ILLink.Tasks" /> | |
| # <package pattern="Microsoft.DotNet.ILCompiler" /> | |
| # </packageSource> | |
| # </packageSourceMapping> | |
| # | |
| # </configuration> | |
| jobs: | |
| full: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu-24.04 ] | |
| pg_major: [ 15 ] | |
| tfm: [ net9.0 ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| # - name: Setup nuget config | |
| # run: echo "$nuget_config" > NuGet.config | |
| - name: NuGet Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Build.targets') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Setup .NET Core SDK | |
| uses: actions/[email protected] | |
| - name: Write script | |
| run: echo "$AOT_Compat" > test-aot-compatibility.ps1 | |
| - name: Publish and check for trimmer warnings | |
| run: ./test-aot-compatibility.ps1 ${{ matrix.tfm }} | |
| shell: pwsh | |
| trimmed: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-24.04] | |
| pg_major: [15] | |
| tfm: [ net9.0 ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| # - name: Setup nuget config | |
| # run: echo "$nuget_config" > NuGet.config | |
| - name: NuGet Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Build.targets') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Setup .NET Core SDK | |
| uses: actions/[email protected] | |
| - name: Start PostgreSQL | |
| run: | | |
| sudo systemctl start postgresql.service | |
| sudo -u postgres psql -c "CREATE USER npgsql_tests SUPERUSER PASSWORD 'npgsql_tests'" | |
| sudo -u postgres psql -c "CREATE DATABASE npgsql_tests OWNER npgsql_tests" | |
| - name: Build | |
| run: dotnet publish test/Npgsql.NativeAotTests/Npgsql.NativeAotTests.csproj -r linux-x64 -c Release -f ${{ matrix.tfm }} -p:OptimizationPreference=Size | |
| shell: bash | |
| # Uncomment the following to SSH into the agent running the build (https://github.com/mxschmitt/action-tmate) | |
| #- uses: actions/checkout@v5 | |
| #- name: Setup tmate session | |
| # uses: mxschmitt/action-tmate@v3 | |
| - name: Run | |
| run: test/Npgsql.NativeAotTests/bin/Release/${{ matrix.tfm }}/linux-x64/native/Npgsql.NativeAotTests | |
| - name: Write binary size to summary | |
| run: | | |
| size="$(ls -l test/Npgsql.NativeAotTests/bin/Release/net9.0/linux-x64/native/Npgsql.NativeAotTests | cut -d ' ' -f 5)" | |
| echo "Binary size is $size bytes ($((size / (1024 * 1024))) mb)" >> $GITHUB_STEP_SUMMARY | |
| - name: Dump mstat | |
| run: dotnet run --project test/MStatDumper/MStatDumper.csproj -c release -f ${{ matrix.tfm }} -- "test/Npgsql.NativeAotTests/obj/Release/net9.0/linux-x64/native/Npgsql.NativeAotTests.mstat" md >> $GITHUB_STEP_SUMMARY | |
| - name: Upload mstat | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: npgsql.mstat | |
| path: "test/Npgsql.NativeAotTests/obj/Release/${{ matrix.tfm }}/linux-x64/native/Npgsql.NativeAotTests.mstat" | |
| retention-days: 3 | |
| - name: Upload codedgen dgml | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: npgsql.codegen.dgml.xml | |
| path: "test/Npgsql.NativeAotTests/obj/Release/${{ matrix.tfm }}/linux-x64/native/Npgsql.NativeAotTests.codegen.dgml.xml" | |
| retention-days: 3 | |
| - name: Upload scan dgml | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: npgsql.scan.dgml.xml | |
| path: "test/Npgsql.NativeAotTests/obj/Release/${{ matrix.tfm }}/linux-x64/native/Npgsql.NativeAotTests.scan.dgml.xml" | |
| retention-days: 3 | |
| - name: Assert binary size | |
| run: | | |
| size="$(ls -l test/Npgsql.NativeAotTests/bin/Release/${{ matrix.tfm }}/linux-x64/native/Npgsql.NativeAotTests | cut -d ' ' -f 5)" | |
| echo "Binary size is $size bytes ($((size / (1024 * 1024))) mb)" | |
| if (( size > 5242880 )); then | |
| echo "Binary size exceeds 5MB threshold" | |
| exit 1 | |
| fi |