Skip to content

Update dotnet-desktop.yml: cleanup and replace release action #22

Update dotnet-desktop.yml: cleanup and replace release action

Update dotnet-desktop.yml: cleanup and replace release action #22

# 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/