-
Notifications
You must be signed in to change notification settings - Fork 99
131 lines (123 loc) · 5.09 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
name: Build XOutput
env:
VERSION: 4.0.0
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build_net:
runs-on: windows-latest
env:
SERVER_TARGET: 'net7.0'
GUI_TARGET: 'net7.0-windows'
SONARCLOUD_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: '17'
- name: Cache app
uses: actions/cache@v3
with:
key: app-${{ github.sha }}
path: ./app
- name: Clean
run: dotnet clean --configuration Release && dotnet nuget locals all --clear
- name: Restore dependencies
run: dotnet restore
- name: Install SonaScanner
run: dotnet tool install --global dotnet-sonarscanner
- name: Build and test
if: github.ref != 'refs/heads/master'
shell: powershell
run: |
dotnet build -c Release -p:Version=$env:VERSION -p:AssemblyVersion=$env:VERSION -p:FileVersion=$env:VERSION
dotnet test -c Release --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and test and analysis
if: github.ref == 'refs/heads/master'
shell: powershell
run: |
dotnet sonarscanner begin /k:XOutput /d:sonar.host.url=https://sonarcloud.io /o:csutorasa /d:sonar.login=$env:SONARCLOUD_TOKEN /d:sonar.coverage.exclusions="**Tests*.cs"
dotnet build -c Release -p:Version=$env:VERSION -p:AssemblyVersion=$env:VERSION -p:FileVersion=$env:VERSION
dotnet test -c Release --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
dotnet sonarscanner end /d:sonar.login=$env:SONARCLOUD_TOKEN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Copy artifacts
shell: powershell
run: |
New-Item -ItemType Directory -Force -Path app
Move-Item XOutput.Core\bin\Release\$env:SERVER_TARGET\XOutput.Core.dll app\XOutput.Core.dll -Force
Move-Item XOutput.Api\bin\Release\$env:SERVER_TARGET\XOutput.Api.dll app\XOutput.Api.dll -Force
Move-Item XOutput.Emulation\bin\Release\$env:SERVER_TARGET\XOutput.Emulation.dll app\XOutput.Emulation.dll -Force
Move-Item XOutput.Mapping\bin\Release\$env:SERVER_TARGET\XOutput.Mapping.dll app\XOutput.Mapping.dll -Force
Move-Item XOutput.Server\bin\Release\$env:SERVER_TARGET\XOutput.Server.dll app\XOutput.Server.dll -Force
Move-Item XOutput.Server\bin\Release\$env:SERVER_TARGET\XOutput.Server.exe app\XOutput.Server.exe -Force
Move-Item XOutput.Server\bin\Release\$env:SERVER_TARGET\XOutput.Server.runtimeconfig.json app\XOutput.Server.runtimeconfig.json -Force
Move-Item XOutput.Server\bin\Release\$env:SERVER_TARGET\Nefarius.ViGEm.Client.dll app\Nefarius.ViGEm.Client.dll -Force
Move-Item XOutput.Server\bin\Release\$env:SERVER_TARGET\NLog.dll app\NLog.dll -Force
Move-Item XOutput.App\bin\Release\$env:GUI_TARGET\XOutput.App.dll app\XOutput.App.dll -Force
Move-Item XOutput.App\bin\Release\$env:GUI_TARGET\XOutput.App.exe app\XOutput.App.exe -Force
Move-Item XOutput.App\bin\Release\$env:GUI_TARGET\XOutput.App.runtimeconfig.json app\XOutput.App.runtimeconfig.json -Force
Move-Item XOutput.App\bin\Release\$env:GUI_TARGET\SharpDX.dll app\SharpDX.dll -Force
Move-Item XOutput.App\bin\Release\$env:GUI_TARGET\SharpDX.DirectInput.dll app\SharpDX.DirectInput.dll -Force
Move-Item XOutput.App\bin\Release\$env:GUI_TARGET\Hardcodet.NotifyIcon.Wpf.dll app\Hardcodet.NotifyIcon.Wpf.dll -Force
Move-Item XOutput.App\bin\Release\$env:GUI_TARGET\HIDSharp.dll app\HIDSharp.dll -Force
build_node:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Cache webapp
uses: actions/cache@v3
with:
key: webapp-${{ github.sha }}
path: ./@xoutput/webapp/webapp
- name: Install pnpm
run: npm install --global pnpm
- name: Install dependencies
run: pnpm -r install
- name: Run lint
run: pnpm -r run lint
- name: Build webapp
run: pnpm -r --workspace-concurrency=1 run build
- name: Test webapp
run: pnpm -r test
create_package:
runs-on: windows-latest
needs: [ build_net, build_node ]
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache app
uses: actions/cache@v3
with:
key: app-${{ github.sha }}
path: ./app
- name: Cache webapp
uses: actions/cache@v3
with:
key: webapp-${{ github.sha }}
path: ./@xoutput/webapp/webapp
- name: Copy resources
run: move bin app\bin && move @xoutput\webapp\webapp app\webapp
- name: Create package
uses: actions/upload-artifact@v3
with:
name: XOutput
path: ./app/