-
Notifications
You must be signed in to change notification settings - Fork 104
76 lines (59 loc) · 2.06 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
name: pull requests
on:
pull_request:
branches: [master]
jobs:
ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
- name: Install .NET dependencies
run: dotnet restore
- name: Install libpcap
run: sudo -E bash Scripts/install-libpcap.sh
- name: Build
run: dotnet build PacketDotNet/PacketDotNet.csproj -c Release -f "net7.0"
- name: Test
run: dotnet test -c Release -f "net7.0"
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
buildprops:
- 'Directory.Build.props'
- name: Update version
if: steps.changes.outputs.buildprops == 'false'
run: |
(Get-Content Directory.Build.props) | % {
$m = [regex]::match($_, '<Version>(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?</Version>');
if(!$m.Success -or $m.Groups[4].Success -or $m.Groups[5].Success) { $_; }
else { $_ -replace $m.Value, ("<Version>{0}.{1}.{2}-pre${{ github.run_number }}</Version>" -f $m.Groups[1].Value,$m.Groups[2].Value,([convert]::ToInt32($m.Groups[3].Value)+1)); }
} | Set-Content Directory.Build.props
- name: Clear NuGet cache
run: dotnet nuget locals all --clear
- name: Install .NET dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: PacketDotNet
path: |
PacketDotNet/bin/Release/net*