This repository has been archived by the owner on Jun 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 10
148 lines (125 loc) · 4.42 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Builds and runs tests in all three supported OSes
# Pushes CI feed if secrets.SLEET_CONNECTION is provided
name: build
on:
workflow_dispatch:
push:
branches: [ main, dev, 'feature/*', 'rel/*' ]
pull_request:
types: [opened, synchronize, reopened]
env:
DOTNET_NOLOGO: true
defaults:
run:
shell: bash
jobs:
dotnet-format:
runs-on: ubuntu-latest
steps:
- name: 🤘 checkout
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- name: ✓ ensure format
run: |
dotnet tool update -g dotnet-format --version 5.0.*
dotnet restore
dotnet format --check -v:diag
build:
name: build-${{ matrix.os }}
needs: dotnet-format
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: 🤘 checkout
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- name: 🙏 build
run: dotnet build -m:1 -bl:build.binlog -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER" -p:RepositoryBranch=${GITHUB_REF#refs/*/}
- name: 🧪 test
run: dotnet test --no-build -m:1 --blame-hang --blame-hang-timeout 5m -d $GITHUB_WORKSPACE/logs/${{ matrix.os }}.txt -r $GITHUB_WORKSPACE/logs
- name: 📦 pack
run: dotnet pack -m:1 -bl:pack.binlog -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER" -p:RepositoryBranch=${GITHUB_REF#refs/*/}
- name: 🔼 packages
uses: actions/upload-artifact@v2
with:
name: bin
path: bin/*.nupkg
# Only push CI package to sleet feed if building on ubuntu (fastest)
- name: 🚀 sleet
env:
SLEET_CONNECTION: ${{ secrets.SLEET_CONNECTION }}
if: matrix.os == 'ubuntu-latest' && env.SLEET_CONNECTION != ''
run: |
dotnet tool install -g --version 4.0.18 sleet
sleet push bin --config none -f --verbose -p "SLEET_FEED_CONTAINER=nuget" -p "SLEET_FEED_CONNECTIONSTRING=${{ secrets.SLEET_CONNECTION }}" -p "SLEET_FEED_TYPE=azure" || echo "No packages found"
acceptance:
name: acceptance-${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: 🤘 checkout
uses: actions/checkout@v2
- name: 🔽 packages
uses: actions/download-artifact@v2
with:
name: bin
path: bin
- name: 🧪 test
run: dotnet test -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER"
working-directory: src/Acceptance
preview:
defaults:
run:
shell: pwsh
needs: dotnet-format
runs-on: windows-latest
steps:
- name: 🤘 checkout
uses: actions/checkout@v2
# > VS Preview
- name: 🔽 dotnet-vs
run: dotnet tool update -g dotnet-vs
- name: 🔽 vs preview
run: vs install preview --quiet +Microsoft.VisualStudio.Component.ManagedDesktop.Core +Microsoft.NetCore.Component.DevelopmentTools
- name: ≥ msbuild
run: echo "$(vs where preview --prop=InstallationPath)\MSBuild\Current\Bin" >> $env:GITHUB_PATH
# < VS Preview
- name: ⚙ curl
run: |
iwr -useb get.scoop.sh | iex
scoop install curl
- name: 🔍 status for PR
if: ${{ github.event.pull_request.head.sha }}
run: echo "STATUS_SHA=${{ github.event.pull_request.head.sha }}" >> $env:GITHUB_ENV
- name: 🔍 status for branch
if: ${{ !github.event.pull_request.head.sha }}
run: echo "STATUS_SHA=$($env:GITHUB_SHA)" >> $env:GITHUB_ENV
- name: ⌛ wait on build
env:
CHECK: build-windows-latest
SHA: ${{ env.STATUS_SHA }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./.github/workflows/wait-status.ps1
- name: ⌛ wait on acceptance
env:
CHECK: acceptance-windows-latest
SHA: ${{ env.STATUS_SHA }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./.github/workflows/wait-status.ps1
- name: 🔽 packages
uses: actions/download-artifact@v2
with:
name: bin
path: bin
- name: 🧪 test
run: msbuild -r -t:build,test -p:TargetFramework=net472 -p:VersionLabel="$($env:GITHUB_REF).$($env:GITHUB_RUN_NUMBER)"
working-directory: src/Acceptance