Skip to content

Commit

Permalink
Try reusable action
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisDyallo committed May 6, 2024
1 parent 6e1e752 commit 5f39837
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 50 deletions.
33 changes: 12 additions & 21 deletions .github/workflows/build-pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
7 changes: 2 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-code-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
48 changes: 25 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 5f39837

Please sign in to comment.