-
Notifications
You must be signed in to change notification settings - Fork 3
193 lines (162 loc) · 7.54 KB
/
dotnet-desktop.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
# This workflow will build, test and package a WPF or Windows Forms desktop application
# built on .NET Core.
#
# To configure this workflow:
#
# 1. Configure environment variables
# GitHub sets default environment variables for every workflow run.
# Replace the variables relative to your project in the "env" section below.
#
# For more information on GitHub Actions, refer to https://github.com/features/actions
# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications,
# refer to https://github.com/microsoft/github-actions-for-desktop-apps
name: .NET Core Desktop
on:
push:
branches: [ "master" ]
tags: [ "v*" ]
pull_request:
branches: [ "master" ]
jobs:
lint_csharp:
runs-on: windows-latest # For a list of available runner types, refer to https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
env:
Solution_Name: ScrapPackedExplorer.sln
Test_Project_Path: ScrapPackedTests/ScrapPackedTests.csproj
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
# Format the output of dotnet format
- name: Add dotnet-format problem matcher
uses: xt0rted/dotnet-format-problem-matcher@v1
# Install dotnet format as a global tool
- name: Install dotnet format
run: dotnet tool update --global dotnet-format
# Run dotnet format --verify-no-changes
# By default, the task ensure the exit code is 0
# If a file needs to be edited by dotnet format, the exit code will be a non-zero value
# So the task will fail
- name: Run dotnet format
run: dotnet format --verify-no-changes --verbosity diagnostic
build-test-and-deploy:
runs-on: windows-latest # For a list of available runner types, refer to https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
env:
Solution_Name: ScrapPackedExplorer.sln
Test_Project_Path: ScrapPackedTests/ScrapPackedTests.csproj
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Restore dependencies
run: dotnet restore ${{ env.Solution_Name }}
- name: Build Project
run: dotnet build ${{ env.Solution_Name }} -c Release --no-restore
- name: Run Tests
run: dotnet test
- name: Store Failed Test Results
if: failure()
uses: actions/upload-artifact@v3
with:
name: TestFails
path: |
**/TestFails/
- name: Publish Project
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
shell: cmd
run: |
@rem simplify
@echo Building Scrap Packed Explorer GUI
msbuild ScrapPackedExplorer\ScrapPackedExplorer.csproj -p:Configuration=Release -restore -t:Publish -p:Platform=AnyCPU -p:PublishProfile="ScrapPackedExplorer\Properties\PublishProfiles\ScrapPackedExplorer.exe (x64).pubxml"
msbuild ScrapPackedExplorer\ScrapPackedExplorer.csproj -p:Configuration=Release -restore -t:Publish -p:Platform=x86 -p:PublishProfile="ScrapPackedExplorer\Properties\PublishProfiles\ScrapPackedExplorer.exe (x86).pubxml"
ren "Publish (32bit)\ScrapPackedExplorer.exe" "ScrapPackedExplorer32.exe"
@echo Building Scrap Packed Explorer Combined
msbuild ScrapPackedExplorerCombined\ScrapPackedExplorerCombined.csproj -p:Configuration=Release -restore -t:Publish -p:Platform=AnyCPU -p:PublishProfile="ScrapPackedExplorerCombined\Properties\PublishProfiles\ScrapPackedExplorerCombined.exe (x64).pubxml"
msbuild ScrapPackedExplorerCombined\ScrapPackedExplorerCombined.csproj -p:Configuration=Release -restore -t:Publish -p:Platform=x86 -p:PublishProfile="ScrapPackedExplorerCombined\Properties\PublishProfiles\ScrapPackedExplorerCombined.exe (x86).pubxml"
ren "Publish (32bit)\ScrapPackedExplorerCombined.exe" "ScrapPackedExplorerCombined32.exe"
@echo Building Scrap Packed Explorer CLI
msbuild ScrapPackedExplorerCli\ScrapPackedExplorerCli.csproj -p:Configuration=Release -restore -t:Publish -p:Platform=AnyCPU -p:PublishProfile="ScrapPackedExplorerCli\Properties\PublishProfiles\ScrapPackedExplorerCli.exe (x64).pubxml"
msbuild ScrapPackedExplorerCli\ScrapPackedExplorerCli.csproj -p:Configuration=Release -restore -t:Publish -p:Platform=x86 -p:PublishProfile="ScrapPackedExplorerCli\Properties\PublishProfiles\ScrapPackedExplorerCli.exe (x86).pubxml"
ren "Publish (32bit)\ScrapPackedExplorerCli.exe" "ScrapPackedExplorerCli32.exe"
msbuild ScrapPackedExplorerCli\ScrapPackedExplorerCli.csproj -p:Configuration=Release -restore -t:Publish -p:Platform=AnyCPU -p:PublishProfile="ScrapPackedExplorerCli\Properties\PublishProfiles\ScrapPackedExplorerCli (linux-x86_64).pubxml"
- name: Prepare Release
id: create_release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
- name: Upload build artifacts (.exe)
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: csexton/release-asset-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
pattern: Publish*/*.exe
release-url: ${{ steps.create_release.outputs.upload_url }}
- name: Upload build artifacts (linux binary)
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: csexton/release-asset-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: Publish (linux-x86_64)/ScrapPackedExplorerCli
release-url: ${{ steps.create_release.outputs.upload_url }}
build-and-tests-on-linux:
runs-on: ubuntu-latest
env:
Solution_Name: ScrapPackedExplorer.sln
Test_Project_Path: ScrapPackedTests/ScrapPackedTests.csproj
steps:
- name: Prepare git
run: |-
git config --global core.autocrlf false
git config --global core.eol CRLF
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check Git status
run: |-
git config --global core.autocrlf
git config --global core.eol
git config core.autocrlf
git config core.eol
cat .gitattributes
- name: Install .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: |
dotnet restore ScrapPackedLibrary/ScrapPackedLibrary.csproj
dotnet restore ScrapPackedExplorerCli/ScrapPackedExplorerCli.csproj
dotnet restore ScrapPackedTests/ScrapPackedTests.csproj
- name: Build Project
run: |
dotnet build ScrapPackedLibrary/ScrapPackedLibrary.csproj -c Release --no-restore
dotnet build ScrapPackedExplorerCli/ScrapPackedExplorerCli.csproj -c Release --no-restore
dotnet build ScrapPackedTests/ScrapPackedTests.csproj -c Release --no-restore
- name: Run Tests
run: dotnet test --no-restore
- name: Store Failed Test Results
if: failure()
uses: actions/upload-artifact@v3
with:
name: TestFails
path: |
**/TestFails/