Use simplified key specs in cluster slot verification #8712
Workflow file for this run
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: Garnet .NET CI | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| pull_request: | |
| branches: | |
| - main | |
| - dev | |
| env: | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
| DOTNET_NOLOGO: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| changes: | |
| name: Check for changes | |
| runs-on: ubuntu-latest # don't need matrix to test where the changes were made in code | |
| permissions: | |
| pull-requests: read | |
| contents: read | |
| outputs: | |
| tsavorite: ${{ steps.filter.outputs.tsavorite }} | |
| website: ${{ steps.filter.outputs.website }} | |
| garnet: ${{ steps.filter.outputs.garnet }} | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Apply filter | |
| uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 #v3 for security reasons have pinned tag (commit SHA) for 3rd party | |
| id: filter | |
| with: | |
| filters: | | |
| tsavorite: | |
| - 'libs/storage/Tsavorite/**' | |
| website: | |
| - 'website/**' | |
| garnet: | |
| - '!((*.md)|(website/**))' | |
| format-garnet: | |
| name: Format Garnet | |
| needs: changes | |
| runs-on: ubuntu-latest | |
| if: needs.changes.outputs.garnet == 'true' | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| - name: Install dependencies | |
| run: dotnet restore Garnet.slnx | |
| - name: Check style format | |
| run: dotnet format Garnet.slnx --no-restore --verify-no-changes --verbosity diagnostic | |
| format-tsavorite: | |
| name: Format Tsavorite | |
| needs: changes | |
| runs-on: ubuntu-latest | |
| if: needs.changes.outputs.tsavorite == 'true' | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| - name: Install dependencies | |
| run: dotnet restore libs/storage/Tsavorite/cs/Tsavorite.slnx | |
| - name: Check style format | |
| run: dotnet format libs/storage/Tsavorite/cs/Tsavorite.slnx --no-restore --verify-no-changes --verbosity diagnostic | |
| # Job to build and test Garnet code | |
| build-test-garnet: | |
| name: Garnet | |
| needs: [changes, format-garnet] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu-latest, windows-latest ] | |
| framework: [ 'net8.0' , 'net10.0'] | |
| configuration: [ 'Debug', 'Release' ] | |
| test: [ 'Garnet.test', 'Garnet.test.cluster' ] | |
| if: needs.changes.outputs.garnet == 'true' | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| - name: Install dependencies | |
| run: dotnet restore | |
| - name: Build Garnet | |
| run: dotnet build --configuration ${{ matrix.configuration }} | |
| - name: Verify Allure wiring (${{ matrix.test }}) | |
| shell: pwsh | |
| run: | | |
| $asmPath = "${{ github.workspace }}/test/${{ matrix.test }}/bin/${{ matrix.configuration }}/${{ matrix.framework }}/${{ matrix.test }}.dll" | |
| $asm = [System.Reflection.Assembly]::LoadFrom($asmPath) | |
| # When using .Net 9.0/10.0 it tries to resolve every referenced type in that assembly and some dependencies are missing by design so pops exception. | |
| # Since we don't want to fail on every 9.0/10.0 run (even when has Allure inheritance), we catch it here. | |
| try { | |
| $types = $asm.GetTypes() | |
| } catch [System.Reflection.ReflectionTypeLoadException] { | |
| # Keep only successfully loaded types, skip nulls | |
| $types = $_.Exception.Types | Where-Object { $_ -ne $null } | |
| } | |
| $allureBase = $types | Where-Object { $_.Name -eq "AllureTestBase" } | |
| $bad = @() | |
| foreach ($t in $types) { | |
| # Detect NUnit test fixtures by attribute names | |
| $isFixture = $t.GetCustomAttributes($true) | | |
| Where-Object { $_.GetType().FullName -eq "NUnit.Framework.TestFixtureAttribute" } | | |
| Measure-Object | Select-Object -ExpandProperty Count | |
| if ($isFixture -eq 0) { | |
| $isFixture = $t.GetMethods() | | |
| ForEach-Object { $_.GetCustomAttributes($true) } | | |
| Where-Object { $_.GetType().FullName -eq "NUnit.Framework.TestAttribute" } | | |
| Measure-Object | Select-Object -ExpandProperty Count | |
| } | |
| if ($isFixture -gt 0) { | |
| $inheritsAllure = $allureBase -and $allureBase.IsAssignableFrom($t) | |
| $hasAttr = $t.GetCustomAttributes($true) | | |
| Where-Object { $_.GetType().FullName -eq "Allure.NUnit.AllureNUnitAttribute" } | | |
| Measure-Object | Select-Object -ExpandProperty Count | |
| if (-not $inheritsAllure -or $hasAttr -eq 0) { | |
| $bad += $t.FullName | |
| } | |
| } | |
| } | |
| if ($bad.Count -gt 0) { | |
| Write-Host "These test fixtures are missing Allure setup from $asmPath. See Pull Request Protocol for details on how to set up Allure for new tests. https://microsoft.github.io/garnet/docs/dev/onboarding" | |
| $bad | ForEach-Object { Write-Host $_ } | |
| exit 1 | |
| } else { | |
| Write-Host "All test fixtures wired to Allure in $asmPath" | |
| } | |
| - name: Run tests ${{ matrix.test }} | |
| run: dotnet test test/${{ matrix.test }} -f ${{ matrix.framework }} --configuration ${{ matrix.configuration }} --logger "console;verbosity=detailed" --logger trx --results-directory "GarnetTestResults-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }}-${{ matrix.test }}" -- NUnit.DisplayName=FullName | |
| timeout-minutes: 45 | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dotnet-garnet-results-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }}-${{ matrix.test }} | |
| path: GarnetTestResults-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }}-${{ matrix.test }} | |
| if: ${{ always() }} | |
| # Job to build and test Tsavorite code (only if there were changes to it) | |
| build-test-tsavorite: | |
| name: Tsavorite | |
| needs: [changes, format-tsavorite] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu-latest, windows-latest ] | |
| framework: [ 'net8.0', 'net10.0' ] | |
| configuration: [ 'Debug', 'Release' ] | |
| if: needs.changes.outputs.tsavorite == 'true' | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Set workaround for libaio on Ubuntu 24.04 (see https://askubuntu.com/questions/1512196/libaio1-on-noble/1512197#1512197) | |
| run: | | |
| sudo ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1 | |
| if: ${{ matrix.os == 'ubuntu-latest' }} | |
| - name: Set environment variable for Linux | |
| run: echo "RunAzureTests=yes" >> $GITHUB_ENV | |
| if: ${{ matrix.os == 'ubuntu-latest' }} | |
| - name: Set environment variable for Windows | |
| run: echo ("RunAzureTests=yes") >> $env:GITHUB_ENV | |
| if: ${{ matrix.os == 'windows-latest' }} | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| - name: Setup Node.js for Azurite | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install and Run Azurite | |
| shell: bash | |
| run: | | |
| npm install -g azurite | |
| azurite --skipApiVersionCheck & | |
| - name: Install dependencies | |
| run: dotnet restore | |
| - name: Build Tsavorite | |
| run: dotnet build libs/storage/Tsavorite/cs/test/Tsavorite.test.csproj --configuration ${{ matrix.configuration }} | |
| - name: Verify Allure wiring (Tsavorite) | |
| shell: pwsh | |
| run: | | |
| $asmPath = "${{ github.workspace }}/libs/storage/Tsavorite/cs/test/bin/${{ matrix.configuration }}/${{ matrix.framework }}/Tsavorite.test.dll" | |
| $asm = [System.Reflection.Assembly]::LoadFrom($asmPath) | |
| # when using .Net 9.0/10.0 it tries to resolve every referenced type in that assembly and some dependencies are missing by design so pops exception (we don't need those anyways) | |
| try { | |
| $types = $asm.GetTypes() | |
| } catch [System.Reflection.ReflectionTypeLoadException] { | |
| $types = $_.Exception.Types | Where-Object { $_ -ne $null } | |
| } | |
| $allureBase = $types | Where-Object { $_.Name -eq "AllureTestBase" } | |
| $bad = @() | |
| foreach ($t in $types) { | |
| # Detect NUnit test fixtures by attribute names | |
| $isFixture = $t.GetCustomAttributes($true) | | |
| Where-Object { $_.GetType().FullName -eq "NUnit.Framework.TestFixtureAttribute" } | | |
| Measure-Object | Select-Object -ExpandProperty Count | |
| if ($isFixture -eq 0) { | |
| $isFixture = $t.GetMethods() | | |
| ForEach-Object { $_.GetCustomAttributes($true) } | | |
| Where-Object { $_.GetType().FullName -eq "NUnit.Framework.TestAttribute" } | | |
| Measure-Object | Select-Object -ExpandProperty Count | |
| } | |
| if ($isFixture -gt 0) { | |
| $inheritsAllure = $allureBase -and $allureBase.IsAssignableFrom($t) | |
| $hasAttr = $t.GetCustomAttributes($true) | | |
| Where-Object { $_.GetType().FullName -eq "Allure.NUnit.AllureNUnitAttribute" } | | |
| Measure-Object | Select-Object -ExpandProperty Count | |
| if (-not $inheritsAllure -or $hasAttr -eq 0) { | |
| $bad += $t.FullName | |
| } | |
| } | |
| } | |
| if ($bad.Count -gt 0) { | |
| Write-Host "These test fixtures are missing Allure setup from $asmPath" | |
| $bad | ForEach-Object { Write-Host $_ } | |
| exit 1 | |
| } else { | |
| Write-Host "All test fixtures wired to Allure in $asmPath" | |
| } | |
| - name: Run Tsavorite tests | |
| run: dotnet test libs/storage/Tsavorite/cs/test/Tsavorite.test.csproj -f ${{ matrix.framework }} --configuration ${{ matrix.configuration }} --logger "console;verbosity=detailed" --logger trx --results-directory "TsavoriteTestResults-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }}" | |
| timeout-minutes: 45 | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dotnet-tsavorite-results-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }} | |
| path: TsavoriteTestResults-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }} | |
| if: ${{ always() }} | |
| build-website: | |
| name: Build Website | |
| needs: changes | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: website | |
| if: needs.changes.outputs.website == 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: yarn | |
| cache-dependency-path: ./website/yarn.lock | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build website | |
| run: yarn build | |
| pipeline-success: | |
| name: Garnet CI (Complete) | |
| runs-on: ubuntu-latest | |
| needs: [ build-test-garnet, build-test-tsavorite, build-website ] | |
| steps: | |
| - run: echo Done! | |
| if: ${{ !(failure() || cancelled()) }} |