forked from romibi/Scrap-Packed-Explorer
-
Notifications
You must be signed in to change notification settings - Fork 1
174 lines (145 loc) · 6.92 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
# This workflow will lint, build, test and package this project on windows and build and test on ubuntu
#
# 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
#
# todo: cleanup and simplify
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
permissions:
contents: write
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: Create Release Draft
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref }}
name: ${{ github.ref }}
artifacts: "Publish*/*.exe,Publish (linux-x86_64)/ScrapPackedExplorerCli"
draft: true
body: |
New Release: <insert big new thing>
### Changelog:
- insert more detailed changes
### Info
The UI is not tested very much! Expect Bugs!
If you are unsure which file to use:
- ScrapPackedExplorer.exe if you want a GUI
- ScrapPackedExplorerCli.exe if you want to use the command line
- ScrapPackedExplorerCombined.exe if you want to use both
prerelease: true
skipIfReleaseExists: true
build-and-tests-on-linux:
runs-on: ubuntu-latest
env:
Solution_Name: ScrapPackedExplorer.sln
Test_Project_Path: ScrapPackedTests/ScrapPackedTests.csproj
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- 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 --no-restore
dotnet build ScrapPackedExplorerCli/ScrapPackedExplorerCli.csproj --no-restore
dotnet build ScrapPackedTests/ScrapPackedTests.csproj --no-restore
- name: Run Tests
run: dotnet test --no-restore
- name: Store Failed Test Results
if: failure()
uses: actions/upload-artifact@v3
with:
name: TestResults
path: |
**/TestFails/