From 5f398374b6578a00b51f3473360baa536ada4fd2 Mon Sep 17 00:00:00 2001 From: Dennis Dyall Date: Mon, 6 May 2024 11:41:33 +0200 Subject: [PATCH] Try reusable action --- .github/workflows/build-pull-requests.yml | 33 ++++++-------- .github/workflows/build.yml | 7 +-- .github/workflows/check-code-formatting.yml | 2 +- .github/workflows/test.yml | 48 +++++++++++---------- 4 files changed, 40 insertions(+), 50 deletions(-) diff --git a/.github/workflows/build-pull-requests.yml b/.github/workflows/build-pull-requests.yml index 72c928502..0362bbbda 100644 --- a/.github/workflows/build-pull-requests.yml +++ b/.github/workflows/build-pull-requests.yml @@ -34,11 +34,6 @@ jobs: # Give this job a friendly name to show in GitHub UI. name: Build and test runs-on: windows-latest - # Build both Debug and ReleaseWithDocs configurations. Most people are probably building 'Debug' the most often. We - # should be sure that Release also builds, and that our documentation also compiles successfully. - strategy: - matrix: - configuration: [Debug, ReleaseWithDocs] steps: # Checkout the local repository @@ -52,30 +47,26 @@ jobs: # Build the project - name: Build Yubico.NET.SDK.sln - run: dotnet build --configuration ${{matrix.configuration}} --nologo --verbosity normal Yubico.NET.SDK.sln + run: dotnet build --configuration ReleaseWithDocs --nologo --verbosity normal Yubico.NET.SDK.sln + + - name: Run tests + uses: ./.github/workflows/test.yml # Save the built NuGet packages, just in case we need to inspect the build output. - name: Save build artifacts uses: actions/upload-artifact@v4 with: - name: Nuget Packages ${{matrix.configuration}} + name: Nuget Packages ReleaseWithDocs path: | - Yubico.DotNetPolyfills/src/bin/${{matrix.configuration}}/*.nupkg - Yubico.Core/src/bin/${{matrix.configuration}}/*.nupkg - Yubico.YubiKey/src/bin/${{matrix.configuration}}/*.nupkg + Yubico.DotNetPolyfills/src/bin/ReleaseWithDocs/*.nupkg + Yubico.Core/src/bin/ReleaseWithDocs/*.nupkg + Yubico.YubiKey/src/bin/ReleaseWithDocs/*.nupkg - name: Save build artifacts uses: actions/upload-artifact@v4 with: - name: Assemblies ${{matrix.configuration}} + name: Assemblies ReleaseWithDocs path: | - Yubico.DotNetPolyfills/src/bin/${{matrix.configuration}}/**/*.dll - Yubico.Core/src/bin/${{matrix.configuration}}/**/*.dll - Yubico.YubiKey/src/bin/${{matrix.configuration}}/**/*.dll - - # Test the project - - name: Test Yubico.YubiKey - run: dotnet test --configuration ${{matrix.configuration}} --verbosity normal --no-build --nologo Yubico.YubiKey/tests/unit/Yubico.YubiKey.UnitTests.csproj - - - name: Test Yubico.Core - run: dotnet test --configuration ${{matrix.configuration}} --verbosity normal --no-build --nologo Yubico.Core/tests/Yubico.Core.UnitTests.csproj + Yubico.DotNetPolyfills/src/bin/ReleaseWithDocs/**/*.dll + Yubico.Core/src/bin/ReleaseWithDocs/**/*.dll + Yubico.YubiKey/src/bin/ReleaseWithDocs/**/*.dll \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fddde2c80..01ba79a98 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,11 +76,8 @@ jobs: run: dotnet build --configuration ReleaseWithDocs --nologo --verbosity normal Yubico.NET.SDK.sln # Run tests - - name: Test Yubico.YubiKey - run: dotnet test --configuration ReleaseWithDocs --verbosity normal --no-build --nologo Yubico.YubiKey/tests/unit/Yubico.YubiKey.UnitTests.csproj - - - name: Test Yubico.Core - run: dotnet test --configuration ReleaseWithDocs --verbosity normal --no-build --nologo Yubico.Core/tests/Yubico.Core.UnitTests.csproj + - name: Run tests + uses: ./.github/workflows/test.yml # Upload artifacts - name: Save documentation artifacts diff --git a/.github/workflows/check-code-formatting.yml b/.github/workflows/check-code-formatting.yml index e551814fc..ff1c59221 100644 --- a/.github/workflows/check-code-formatting.yml +++ b/.github/workflows/check-code-formatting.yml @@ -43,7 +43,7 @@ jobs: run: dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Yubico/index.json" - name: Build Yubico.NET.SDK.sln - run: dotnet build --configuration Release --nologo --verbosity normal Yubico.NET.SDK.sln + run: dotnet build --nologo --verbosity normal Yubico.NET.SDK.sln - name: Check for correct formatting run: dotnet format --verify-no-changes --no-restore -v d \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2570270b9..07b70eb82 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,29 +15,31 @@ name: Run tests and code coverage on: - pull_request: - branches: - - main - - 'develop**' - - 'release/**' - paths: - - '**.h' - - '**.c' - - '**.cs' - - '**.csproj' - - '**.sln' - - '.github/workflows/test.yml' - push: - branches: - - main - - develop - paths: - - '**.h' - - '**.c' - - '**.cs' - - '**.csproj' - - '**.sln' - - '.github/workflows/test.yml' + workflow_call: + +# pull_request: +# branches: +# - main +# - 'develop**' +# - 'release/**' +# paths: +# - '**.h' +# - '**.c' +# - '**.cs' +# - '**.csproj' +# - '**.sln' +# - '.github/workflows/test.yml' +# push: +# branches: +# - main +# - develop +# paths: +# - '**.h' +# - '**.c' +# - '**.cs' +# - '**.csproj' +# - '**.sln' +# - '.github/workflows/test.yml' jobs: test-windows: