-
Notifications
You must be signed in to change notification settings - Fork 58
101 lines (85 loc) · 3.3 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
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: PR Verification
on:
pull_request:
branches: [ "main" ]
workflow_dispatch: # Enable manually starting a build
jobs:
build:
strategy:
matrix:
os: [ windows-latest, macos-latest, ubuntu-latest ]
dotnet-version: [ net472, net6.0, net8.0]
node-version: [ 18.x, 20.x ]
configuration: [ Release ]
exclude:
# Exclude Node 18.x on .NET < 8, to thin the matrix.
- dotnet-version: net6.0
node-version: 18.x
- dotnet-version: net472
node-version: 18.x
# Exclude .NET 4.x on non-Windows OS.
- os: macos-latest
dotnet-version: net472
- os: ubuntu-latest
dotnet-version: net472
fail-fast: false # Don't cancel other jobs when one job fails
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Deep clone is required for versioning on git commit height
- name: Link libdl.so # Required by .NET 6
if: matrix.os == 'ubuntu-latest'
run: sudo ln -s /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libdl.so
- name: Setup .NET 6
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
# The .NET 8 SDK is required even when the build matrix targets other .NET versions.
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Build packages
id: pack
run: dotnet pack --configuration ${{ matrix.configuration }}
# Uncomment to enable an SSH session for debugging
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true
- name: Upload build artifacts
if: matrix.dotnet-version == 'net8.0' && matrix.node-version == '20.x'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.configuration }}-packages
path: |
out/pkg/*.*nupkg
out/pkg/*.tgz
- name: Test
if: steps.pack.conclusion == 'success' && !cancelled()
env:
TRACE_NODE_API_HOST: 1
run: >
dotnet test -f ${{ matrix.dotnet-version }}
--configuration ${{ matrix.configuration }}
--logger trx
--results-directory "out/test/${{matrix.dotnet-version}}-node${{matrix.node-version}}-${{matrix.configuration}}"
continue-on-error: true
- name: Upload test logs
# upload-artifact@v4 breaks the test reporter: https://github.com/dorny/test-reporter/issues/343
uses: actions/upload-artifact@v3
with:
name: test-logs-${{ matrix.os }}-${{matrix.dotnet-version}}-node${{matrix.node-version}}-${{matrix.configuration}}
path: |
out/obj/${{ matrix.configuration }}/**/*.log
out/obj/${{ matrix.configuration }}/**/*.rsp
out/test/**/*.trx
- name: Check formatting
if: ${{ !cancelled() }} # Run this step even when there are build failures but not when cancelled
run: dotnet format --no-restore --severity info --verbosity detailed --verify-no-changes