forked from Code-Artist/AGauge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creating initial debug build WF w/ helper action
Making an initial debug build CI workflow, and a helper action for interfacing with MSBuild. Loosely based on WinNUT workflows.
- Loading branch information
Showing
2 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-reference | ||
# Requires Windows Server runner | ||
|
||
name: "MSBuild-Helper" | ||
description: "Execute Visual Studio's MSBuild system on a Project or Solution with desired settings." | ||
|
||
branding: | ||
icon: "loader" | ||
color: "green" | ||
|
||
inputs: | ||
directory: | ||
description: "Full path where MSBuild should look for Project (or Solution) definition file, default to current working dir." | ||
required: false | ||
default: "" | ||
|
||
build-config: | ||
description: "Solution configuration to use when building." | ||
required: true | ||
|
||
# https://andrewlock.net/version-vs-versionsuffix-vs-packageversion-what-do-they-all-mean/#version | ||
version: | ||
description: "Version string to pass to MSBuild. Ex. 0.1.0, 1.2.3.5, 99.0.3-rc-preview-2-final" | ||
required: false | ||
|
||
verbosity: | ||
description: "Modify the verbosity of MSBuild. Options: q[uiet], m[inimal], n[ormal] (default), d[etailed], and diag[nostic]." | ||
required: false | ||
default: "normal" | ||
|
||
outputs: | ||
buildOutputDir: | ||
description: "Final directory of Project or Solution output(s)." | ||
value: ${{ steps.vars.outputs.BUILD_OUTPUT_DIR }} | ||
|
||
logFile: | ||
description: "Location of the MSBuild log file." | ||
value: "msbuild.log" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
# Need to define "global" variables for this script. See https://github.com/orgs/community/discussions/51280#discussioncomment-8726096 | ||
- name: Set variables | ||
id: vars | ||
shell: pwsh | ||
run: | | ||
echo "BUILD_OUTPUT_DIR=${{ runner.temp }}\msbuild-out" >> $env:GITHUB_OUTPUT | ||
- name: Setup MSBuild | ||
uses: microsoft/setup-msbuild@v2 | ||
|
||
- name: Build Solution | ||
id: build | ||
shell: pwsh | ||
run: > | ||
msbuild ${{ inputs.directory }} -nologo -fileLogger -verbosity:${{ inputs.verbosity }} | ||
-property:Configuration=${{ inputs.build-config }} | ||
-property:Version=${{ inputs.version }} | ||
-property:OutDir=${{ steps.vars.outputs.BUILD_OUTPUT_DIR }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: build-debug | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
pull_request: | ||
paths: | ||
- "**.cs" | ||
- "**.csproj" | ||
|
||
jobs: | ||
build-debug: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run MSBuild | ||
id: msbuild | ||
uses: ./.github/actions/msbuild-helper | ||
with: | ||
directory: "AGauge\\AGauge.csproj" | ||
build-config: "Debug" | ||
version: ${{ vars.VER_RELEASE }}.* | ||
|
||
- name: Get AssemblyVersion generated by msbuild | ||
id: getversion | ||
uses: berglie/assembly-version/get@v1 | ||
with: | ||
directory: ${{ steps.msbuild.outputs.buildOutputDir }} | ||
|
||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: AGauge-Debug-v${{ steps.getversion.outputs.version }} | ||
path: | | ||
${{ steps.msbuild.outputs.buildOutputDir }} | ||
${{ steps.msbuild.outputs.logFile }} | ||
if-no-files-found: error |