Skip to content

Commit

Permalink
Create dotnet-desktop.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
lukegor authored Jul 2, 2024
1 parent 4a15809 commit 4628fda
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow will build and test a WPF desktop application
# built on .NET Core.
# To learn how to migrate your existing application to .NET Core,
# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework
#
# 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: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
strategy:
matrix:
configuration: [Debug, Release]

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: JSharp.sln # Your solution name
Test_Project_Path: JSharp.Tests/JSharp.Tests.csproj # Path to your test project

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x # Adjust to match your project's .NET version

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2

- name: Restore the solution
run: msbuild ${{ env.Solution_Name }} /t:Restore /p:Configuration=${{ matrix.configuration }}

- name: Build the solution
run: msbuild ${{ env.Solution_Name }} /p:Configuration=${{ matrix.configuration }}

# Execute all unit tests in the solution
- name: Execute unit tests
run: dotnet test ${{ env.Test_Project_Path }} --configuration ${{ matrix.configuration }}

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: Build artifacts
path: |
**/bin/${{ matrix.configuration }}/*

0 comments on commit 4628fda

Please sign in to comment.