-
Notifications
You must be signed in to change notification settings - Fork 415
117 lines (94 loc) · 2.82 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
111
112
113
114
115
116
117
name: Build
on:
push:
paths-ignore:
- '*.md'
- '*.txt'
- appveyor.yml
branches:
- master
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
SKIP_TEST_BUILD: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022, ubuntu-22.04, macos-11]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '14'
- name: Install ECLint
run: npm install -g eclint
- name: Delete EditorConfig file
run: git rm .editorconfig
- name: Check Final New-Line
run: eclint check -n "**/*.{cs,tt,cmd,sh,md,txt,yml}"
- name: Check Trailing Whitespace
run: eclint check -w "**/*.{cs,tt,cmd,sh,md,txt,yml,json,sln,csproj,shfbproj}"
- name: Restore Checkout
run: git reset --hard
- name: Setup .NET SDK per "global.json"
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
- name: Setup .NET SDK 6.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: .NET Information
run: dotnet --info
- name: Check Unit Tests Never Import "System.Linq"
shell: pwsh
run: |
grep --extended-regexp '^[[:space:]]*using[[:space:]]+System\.Linq;' (dir -Recurse -File -Filter *Test.cs MoreLinq.Test)
if ($LASTEXITCODE -eq 0) {
throw 'Unit tests should not import System.Linq'
} else {
$LASTEXITCODE = 0
}
- name: Build & Pack (Windows)
shell: cmd
if: runner.os == 'Windows'
run: call pack.cmd
- name: Build & Pack (Linux/macOS)
if: runner.os != 'Windows'
run: ./pack.sh
- name: Check Uncommitted Changes
shell: pwsh
run: |
$diff = git diff --ignore-all-space --exit-code 2>&1
$diff | % { if ($_ -is [string]) { $_ } else { [string]$_ } } | echo
if ($LASTEXITCODE -ne 0) {
throw "New code was generated during build that's not been committed."
}
- name: Validate NuGet Packages
shell: pwsh
run: |
dir dist\*.nupkg | % {
dotnet meziantou.validate-nuget-package --excluded-rules IconMustBeSet $_
if ($LASTEXITCODE) {
throw "Package validation failed: $_"
}
}
- name: Test (Windows)
shell: cmd
if: runner.os == 'Windows'
run: call test.cmd
- name: Test (Linux/macOS)
if: runner.os != 'Windows'
run: ./test.sh
- name: Publish Coverage to Codecov
uses: codecov/codecov-action@v3