-
Notifications
You must be signed in to change notification settings - Fork 8
110 lines (92 loc) · 2.66 KB
/
build.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Build & Test
on:
workflow_dispatch:
inputs:
reason:
description: 'The reason for running the workflow'
required: false
default: 'Manual run'
push:
branches: [ master ]
paths-ignore:
- 'README.md'
- '**/*.md'
- '**/*.gif'
- '**/*.png'
- '**/*.gitignore'
- '**/*.gitattributes'
- LICENSE
tags:
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches: [ master ]
paths-ignore:
- 'README.md'
- '**/*.md'
- '**/*.gif'
- '**/*.png'
- '**/*.gitignore'
- '**/*.gitattributes'
env:
# Disable the .NET logo in the console output.
DOTNET_NOLOGO: true
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_ADD_GLOBAL_TOOLS_TO_PATH: false
DOTNET_MULTILEVEL_LOOKUP: 0
BUILD_CONFIG: 'Release'
# https://docs.github.com/en/actions/learn-github-actions/expressions
# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: build-and-test-${{matrix.os}}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]
dotnet-version: ['3.x.x', '5.x.x', '6.x.x', '7.x.x']
steps:
- name: 'Print manual run reason'
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo 'Reason: ${{ github.event.inputs.reason }}'
- uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- name: Setup .NET (global.json)
uses: actions/setup-dotnet@v3
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration $BUILD_CONFIG --no-restore
- name: Test
run: |
dotnet test \
--configuration $BUILD_CONFIG \
--no-restore \
--no-build \
--verbosity normal \
--logger "trx;LogFileName=test-results.trx" || true
timeout-minutes: 60
# - name: Test Report
# uses: dorny/test-reporter@v1
# if: always()
# with:
# name: DotNET Tests
# path: "**/test-results.trx"
# reporter: dotnet-trx
# fail-on-error: true