Skip to content

Ensure compression buffers do not overlap (#121) #404

Ensure compression buffers do not overlap (#121)

Ensure compression buffers do not overlap (#121) #404

Workflow file for this run

name: Build
on:
push:
pull_request:
branches:
- main
- release-*
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
framework: ["net6.0", "net8.0", "net9.0"]
disable: ["HWIntrinsics", "SSSE3", "BMI2", "Noop"]
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
# Cache packages for faster subsequent runs
- uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release --verbosity normal
- name: Test
run: |
export COMPlus_Enable${{ matrix.disable }}=0 && \
dotnet test --no-build -f ${{ matrix.framework }} --configuration Release --verbosity normal --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true" --collect:"XPlat Code Coverage"
- name: Collect Coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.framework }}-${{ matrix.disable }}
path: Snappier.Tests/TestResults/**/*.xml
retention-days: 1
test-windows:
runs-on: windows-latest
strategy:
matrix:
arch: ["x64", "x86"]
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
# Cache packages for faster subsequent runs
- uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Install dependencies
run: dotnet restore --runtime win-${{ matrix.arch }}
- name: Test
run: |-
dotnet test --no-restore --runtime win-${{ matrix.arch }} -f net48 --configuration Release --verbosity normal --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true" --collect:"XPlat Code Coverage" -- RunConfiguration.DisableAppDomain=true
- name: Collect Coverage
uses: actions/upload-artifact@v4
with:
name: coverage-net4-${{ matrix.arch }}
path: Snappier.Tests/TestResults/**/*.xml
retention-days: 1
coverage-report:
name: Coverage Report
runs-on: ubuntu-latest
needs:
- test
- test-windows
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Download Coverage
uses: actions/download-artifact@v4
with:
pattern: coverage-*
path: TestResults
- name: Cleanup Windows Coverage
run: |
find ./TestResults/coverage-net4-x86 -type f -name '*.xml' | xargs sed -i 's|[A-Z]:.*\\Snappier\\Snappier\\Snappier\\|${{ github.workspace }}/Snappier/|g'
find ./TestResults/coverage-net4-x64 -type f -name '*.xml' | xargs sed -i 's|[A-Z]:.*\\Snappier\\Snappier\\Snappier\\|${{ github.workspace }}/Snappier/|g'
shell: bash
- name: ReportGenerator
uses: danielpalme/ReportGenerator-GitHub-Action@v5
with:
reports: 'TestResults/**/*.xml'
targetdir: 'artifacts/coveragereport'
reporttypes: 'Html;MarkdownSummaryGithub'
classfilters: '-System.Diagnostics.*;-System.Runtime.*;-Snappier.Internal.ThrowHelper'
license: ${{ secrets.REPORT_GENERATOR_LICENSE }}
- name: Collect Report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: artifacts/coveragereport
- name: Add to Build Summary
run: cat artifacts/coveragereport/SummaryGithub.md >> $GITHUB_STEP_SUMMARY # Adjust path and filename if necessary
shell: bash
publish:
runs-on: ubuntu-latest
needs:
- test
- test-windows
if: ${{ startsWith(github.ref, 'refs/tags/release/') }}
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Install dependencies
run: dotnet restore
- name: Get version
id: version
run: echo "version=${GITHUB_REF/refs\/tags\/release\//}" >> $GITHUB_OUTPUT
- name: Pack
run: dotnet pack --configuration Release -p:Version=${{ steps.version.outputs.version }}
- name: Push to NuGet.org
run: |
dotnet nuget push artifacts/package/**/*.nupkg --api-key ${{ secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json