-
Notifications
You must be signed in to change notification settings - Fork 51
90 lines (77 loc) · 3.7 KB
/
pull-requests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Copyright 2021 Yubico AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: CI build for pull requests into main and develop
# Triggers build on pull requests and pushes to the main and develop branches.
on:
pull_request:
branches:
- main
- 'develop**'
- 'release/**'
push:
branches:
- 'release/**'
jobs:
build:
# Give this job a friendly name to show in GitHub UI.
name: Build + Test the SDK
# Even though we build for multiple platforms, we only need to run
# on a single host operating system. This is because we utilize cross-
# build functionality of the dotnet build system.
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
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: run dotnet version
run: dotnet --version
- name: Add local NuGet repository
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"
# Build the project
- name: Build Yubico.NET.SDK.sln
run: dotnet build --configuration ${{matrix.configuration}} --nologo --verbosity normal Yubico.NET.SDK.sln
# 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}}
path: |
Yubico.DotNetPolyfills/src/bin/${{matrix.configuration}}/*.nupkg
Yubico.Core/src/bin/${{matrix.configuration}}/*.nupkg
Yubico.YubiKey/src/bin/${{matrix.configuration}}/*.nupkg
- name: Save build artifacts
uses: actions/upload-artifact@v4
with:
name: Assemblies ${{matrix.configuration}}
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
#
# Here we call `dotnet test` on each individual test project that we want to have run as part of CI. We do this
# to skip running the integration tests which require actual YubiKeys to be present. We have tried using the filter
# capabilities of the `dotnet test` runner tool, however we have found that failures don't always register with
# GitHub when that is done.
- 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