Repository navigation
fix(ffi): make AlgorithmIdentifier, Extension and AuthenticodeSignature disposable again #1225
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: CI | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| workflow_dispatch: | |
| jobs: | |
| formatting: | |
| name: Check formatting | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Check formatting | |
| run: | | |
| Write-Host "Check formatting" | |
| cargo fmt --all -- --check | |
| if ($LastExitCode -eq 1) { | |
| throw "Bad formatting, please run 'cargo +stable fmt --all'" | |
| } | |
| cargo fmt --manifest-path ./ffi/wasm/Cargo.toml -- --check | |
| if ($LastExitCode -eq 1) { | |
| throw "Bad formatting, please run 'cargo +stable fmt --manifest-path ./ffi/wasm/Cargo.toml'" | |
| } | |
| shell: pwsh | |
| lints: | |
| name: Lints [${{ matrix.os }}] | |
| needs: [formatting] | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ windows, linux ] | |
| include: | |
| - os: windows | |
| runner: windows-latest | |
| - os: linux | |
| runner: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Run clippy | |
| run: cargo clippy --locked --workspace --all-features --all-targets -- -D warnings | |
| lints-wasm: | |
| name: Lints [wasm] | |
| needs: [formatting] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Run clippy | |
| run: cargo clippy --locked --all-features --all-targets --manifest-path ./ffi/wasm/Cargo.toml -- -D warnings | |
| - name: Lint picky-ava-tests | |
| run: | | |
| Set-Location ./ffi/wasm/ava_tests | |
| npm install | |
| npm run ci | |
| shell: pwsh | |
| tests: | |
| name: Tests [${{ matrix.os }}] | |
| needs: [formatting] | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ windows, linux ] | |
| include: | |
| - os: windows | |
| runner: windows-latest | |
| - os: linux | |
| runner: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Run tests | |
| run: cargo test --locked --verbose --workspace --all-features | |
| msrv: | |
| # Minimum supported Rust version check for published crates. | |
| # If this break, bump crate version minor number. | |
| # See https://github.com/Devolutions/picky-rs/issues/89 | |
| name: Check MSRV [${{ matrix.crate }}] | |
| needs: [formatting] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| crate: [ picky-asn1, picky-asn1-der, picky-asn1-x509, picky ] | |
| include: | |
| - crate: picky-asn1 | |
| msvc: "1.85" | |
| - crate: picky-asn1-der | |
| msvc: "1.85" | |
| - crate: picky-asn1-x509 | |
| msvc: "1.85" | |
| - crate: picky | |
| msvc: "1.85" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Configure runner | |
| run: | | |
| set -e | |
| curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain ${{ matrix.msvc }} | |
| - name: cargo check ${{ matrix.crate }} | |
| run: cargo +${{ matrix.msvc }} check -p ${{ matrix.crate }} | |
| dotnet-tests: | |
| name: .NET binding tests (${{ matrix.profile }}) | |
| needs: [formatting] | |
| runs-on: windows-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| profile: [debug, release] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| # The .NET bindings are compatible up to .NET 6 SDK. | |
| # We run the tests of the oldest compatible framework. | |
| - name: Install .NET 6 SDK | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '6.0.x' | |
| # Release matches what ships (the ffi-production/NuGet build); debug also | |
| # exercises std's precondition checks at the FFI boundary. | |
| - name: Build native library | |
| run: cargo build --locked ${{ matrix.profile == 'release' && '--release' || '' }} -p picky-ffi | |
| shell: pwsh | |
| # Devolutions.Picky multi-targets net9.0-ios, so the iOS workload is required | |
| # just to build it. | |
| - name: Install iOS workload | |
| run: dotnet workload install ios | |
| shell: pwsh | |
| # GeneratePackageOnBuild is on by default; disable it so the build does not try to | |
| # pack native libraries for every RID (only the win-x64 one is available here). | |
| # The committed bindings are built as-is (not regenerated) so a stale binding fails CI. | |
| - name: Build .NET bindings and tests | |
| run: dotnet build ./ffi/dotnet/Devolutions.Picky.Tests/Devolutions.Picky.Tests.csproj -c Release -p:GeneratePackageOnBuild=false | |
| shell: pwsh | |
| # The project intentionally does not copy the native lib to output | |
| # (CopyToOutputDirectory=Never), so manually place it next to the test host. | |
| - name: Place native library next to the test host | |
| run: | | |
| $testDll = Get-ChildItem -Recurse -Path ./ffi/dotnet/Devolutions.Picky.Tests/bin/Release -Filter Devolutions.Picky.Tests.dll | Select-Object -First 1 | |
| Copy-Item ./target/${{ matrix.profile }}/picky.dll (Join-Path $testDll.DirectoryName DevolutionsPicky.dll) -Force | |
| shell: pwsh | |
| # The tests read fixtures via paths relative to the test host CWD that resolve to | |
| # <repo-parent>/test_assets; provision them from picky-test-data. | |
| # FIXME: It would be worth repointing them at picky-test-data/test_assets. | |
| - name: Provision test assets | |
| run: Copy-Item picky-test-data/test_assets ../test_assets -Recurse -Force | |
| shell: pwsh | |
| - name: Run .NET tests | |
| run: dotnet test ./ffi/dotnet/Devolutions.Picky.Tests/Devolutions.Picky.Tests.csproj -c Release --no-build | |
| shell: pwsh | |
| # The netstandard2.0 assembly also loads on .NET Framework, so run the | |
| # marshalling tests on the net48 CLR too. That project copies the native | |
| # library from dependencies/runtimes/win-x64/native at build time. | |
| - name: Run .NET Framework marshalling tests | |
| run: | | |
| New-Item -ItemType Directory -Force ./dependencies/runtimes/win-x64/native | Out-Null | |
| Copy-Item ./target/${{ matrix.profile }}/picky.dll ./dependencies/runtimes/win-x64/native/DevolutionsPicky.dll -Force | |
| dotnet test ./ffi/dotnet/Devolutions.Picky.Net48Tests/Devolutions.Picky.Net48Tests.csproj -c Release | |
| shell: pwsh | |
| success: | |
| name: Success | |
| if: ${{ always() }} | |
| needs: [formatting, lints, lints-wasm, tests, msrv, dotnet-tests] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: CI succeeded | |
| id: succeeded | |
| if: ${{ !contains(needs.*.result, 'failure') }} | |
| run: exit 0 | |
| - name: CI failed | |
| if: ${{ steps.succeeded.outcome == 'skipped' }} | |
| run: exit 1 |