Skip to content

Update dotnet-desktop.yml: try to fix linux tests 5 #17

Update dotnet-desktop.yml: try to fix linux tests 5

Update dotnet-desktop.yml: try to fix linux tests 5 #17

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