forked from ValveResourceFormat/ValveResourceFormat
-
Notifications
You must be signed in to change notification settings - Fork 0
209 lines (172 loc) · 6.67 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: CI
permissions:
actions: write
contents: write
on:
push:
paths-ignore:
- '.github/*_TEMPLATE/**'
- '*.md'
pull_request:
paths-ignore:
- '.github/*_TEMPLATE/**'
- '*.md'
workflow_dispatch:
schedule:
- cron: "0 10 1 * *"
jobs:
build:
name: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Cache NuGet
uses: actions/cache@v4
with:
path: ${{ env.NUGET_PACKAGES }}
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj') }}
restore-keys: |
nuget-${{ runner.os }}-
nuget-
- name: Build Library
run: dotnet build -c Release ./ValveResourceFormat/ValveResourceFormat.csproj
- name: Build CLI
run: dotnet build -c Release ./Decompiler/Decompiler.csproj
- name: Build GUI
if: matrix.os == 'windows-latest'
run: dotnet build -c Release ./ValveResourceFormat/ValveResourceFormat.csproj
- name: Run tests
run: dotnet test ./Tests/Tests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput='./lcov.info' /p:Include="[ValveResourceFormat*]*"
# - name: Check formatting
# if: matrix.os == 'ubuntu-latest'
# run: dotnet format --verify-no-changes
- name: Pack nupkg
run: dotnet pack --configuration Release ValveResourceFormat/ValveResourceFormat.csproj
- name: Publish GUI
if: matrix.os == 'windows-latest'
run: dotnet publish --configuration Release --self-contained --runtime win-x64 GUI/GUI.csproj
- name: Publish Decompiler (Windows x64)
if: matrix.os == 'windows-latest'
run: dotnet publish --configuration Release --self-contained --runtime win-x64 Decompiler/Decompiler.csproj
- name: Publish Decompiler (Linux x64)
if: matrix.os == 'ubuntu-latest'
run: dotnet publish --configuration Release --self-contained --runtime linux-x64 Decompiler/Decompiler.csproj
- name: Publish Decompiler (Linux arm)
if: matrix.os == 'ubuntu-latest'
run: dotnet publish --configuration Release --self-contained --runtime linux-arm Decompiler/Decompiler.csproj
- name: Publish Decompiler (Linux arm64)
if: matrix.os == 'ubuntu-latest'
run: dotnet publish --configuration Release --self-contained --runtime linux-arm64 Decompiler/Decompiler.csproj
- name: Publish Decompiler (macOS x64)
if: matrix.os == 'macos-latest'
run: dotnet publish --configuration Release --self-contained --runtime osx-x64 Decompiler/Decompiler.csproj
- name: Publish Decompiler (macOS arm64)
if: matrix.os == 'macos-latest'
run: dotnet publish --configuration Release --self-contained --runtime osx-arm64 Decompiler/Decompiler.csproj
- name: Upload GUI
uses: actions/upload-artifact@v4
if: matrix.os == 'windows-latest'
with:
name: Source2Viewer
path: GUI/bin/Release/win-x64/publish
- name: Upload nupkg
uses: actions/upload-artifact@v4
if: matrix.os == 'windows-latest'
with:
name: nupkg
path: 'ValveResourceFormat/bin/Release/*.nupkg'
- name: Upload Decompiler (Windows x64)
uses: actions/upload-artifact@v4
if: matrix.os == 'windows-latest'
with:
name: Decompiler-windows-x64
path: Decompiler/bin/Release/win-x64/publish
- name: Upload Decompiler (Linux x64)
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest'
with:
name: Decompiler-linux-x64
path: Decompiler/bin/Release/linux-x64/publish
- name: Upload Decompiler (Linux arm)
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest'
with:
name: Decompiler-linux-arm
path: Decompiler/bin/Release/linux-arm/publish
- name: Upload Decompiler (Linux arm64)
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest'
with:
name: Decompiler-linux-arm64
path: Decompiler/bin/Release/linux-arm64/publish
- name: Upload Decompiler (macOS x64)
uses: actions/upload-artifact@v4
if: matrix.os == 'macos-latest'
with:
name: Decompiler-macos-x64
path: Decompiler/bin/Release/osx-x64/publish
- name: Upload Decompiler (macOS arm64)
uses: actions/upload-artifact@v4
if: matrix.os == 'macos-latest'
with:
name: Decompiler-macos-arm64
path: Decompiler/bin/Release/osx-arm64/publish
- name: Upload test coverage
uses: codecov/codecov-action@v4
if: github.ref == 'refs/heads/master'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./Tests/lcov.info
fail_ci_if_error: true
verbose: true
release:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display artifacts folder structure
run: ls -Rl
working-directory: artifacts
- name: Create release files
run: |
mkdir release
chmod +x artifacts/Decompiler-linux-x64/Decompiler
chmod +x artifacts/Decompiler-linux-arm/Decompiler
chmod +x artifacts/Decompiler-linux-arm64/Decompiler
chmod +x artifacts/Decompiler-macos-x64/Decompiler
chmod +x artifacts/Decompiler-macos-arm64/Decompiler
zip -9j release/Decompiler-windows-x64.zip artifacts/Decompiler-windows-x64/*
zip -9j release/Decompiler-linux-x64.zip artifacts/Decompiler-linux-x64/*
zip -9j release/Decompiler-linux-arm.zip artifacts/Decompiler-linux-arm/*
zip -9j release/Decompiler-linux-arm64.zip artifacts/Decompiler-linux-arm64/*
zip -9j release/Decompiler-macos-x64.zip artifacts/Decompiler-macos-x64/*
zip -9j release/Decompiler-macos-arm64.zip artifacts/Decompiler-macos-arm64/*
mv artifacts/Source2Viewer/Source2Viewer.exe release/
mv artifacts/nupkg/*.nupkg release/
- name: Display structure of archived files
run: ls -Rl
working-directory: release
- name: Release
uses: softprops/action-gh-release@v2
with:
draft: true
files: release/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to NuGet Gallery
run: find -name '*.nupkg' | xargs -i dotnet nuget push {} --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
working-directory: artifacts/nupkg