Skip to content

Commit

Permalink
Fix: GitHub build workflow now will error on fail and use matrix conf…
Browse files Browse the repository at this point in the history
…iguration

Fixes dnSpyEx#86
Build script will also throw error now if invalid arch specified.
  • Loading branch information
mitchcapper committed Jul 12, 2022
1 parent 0a947e4 commit 9f6b8e2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 40 deletions.
64 changes: 25 additions & 39 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@ jobs:
build:
name: Build
runs-on: windows-2022
defaults:
run:
shell: pwsh
strategy:
matrix:
platform: [netframework, net-x86, net-x64]
include:
- platform: netframework
package-name: netframework
build-dir: net48
- platform: net-x86
package-name: win32
build-dir: net6.0-windows\win-x86\publish
- platform: net-x64
package-name: win64
build-dir: net6.0-windows\win-x64\publish

steps:
- uses: actions/checkout@v2
Expand All @@ -31,47 +47,17 @@ jobs:
- uses: microsoft/setup-msbuild@v1.0.2

# Build each tfm separately since building all requires too much disk space
- name: Build dnSpy (.NET Framework)
shell: pwsh
run: |
.\build.ps1 netframework
New-Item -ItemType Directory -Path C:\builtfiles\dnSpy-netframework -Force > $null
Copy-Item -Path dnSpy\dnSpy\bin\Release\net48\* -Destination C:\builtfiles\dnSpy-netframework -Recurse
.\clean-all.cmd
- name: Build dnSpy (${{matrix.platform}})
run: .\build.ps1 ${{matrix.platform}}
- name: Create output directory
run: New-Item -ItemType Directory -Path C:\builtfiles\dnSpy-${{matrix.platform}} -Force > $null
continue-on-error: true
- name: Copy release files for upload
run: Copy-Item -Path dnSpy\dnSpy\bin\Release\${{matrix.build-dir}}\* -Destination C:\builtfiles\dnSpy-${{matrix.platform}} -Recurse

- uses: actions/upload-artifact@v2
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
with:
name: dnSpy-netframework
path: C:\builtfiles\dnSpy-netframework
if-no-files-found: error

- name: Build dnSpy (.NET x86)
shell: pwsh
run: |
.\build.ps1 net-x86
New-Item -ItemType Directory -Path C:\builtfiles\dnSpy-net-win32 -Force > $null
Copy-Item -Path dnSpy\dnSpy\bin\Release\net6.0-windows\win-x86\publish\* -Destination C:\builtfiles\dnSpy-net-win32 -Recurse
.\clean-all.cmd
- uses: actions/upload-artifact@v2
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
with:
name: dnSpy-net-win32
path: C:\builtfiles\dnSpy-net-win32
if-no-files-found: error

- name: Build dnSpy (.NET x64)
shell: pwsh
run: |
.\build.ps1 net-x64
New-Item -ItemType Directory -Path C:\builtfiles\dnSpy-net-win64 -Force > $null
Copy-Item -Path dnSpy\dnSpy\bin\Release\net6.0-windows\win-x64\publish\* -Destination C:\builtfiles\dnSpy-net-win64 -Recurse
.\clean-all.cmd
- uses: actions/upload-artifact@v2
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
with:
name: dnSpy-net-win64
path: C:\builtfiles\dnSpy-net-win64
name: dnSpy-${{matrix.package-name}}
path: C:\builtfiles\dnSpy-${{matrix.platform}}
if-no-files-found: error
6 changes: 5 additions & 1 deletion build.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
param([string]$buildtfm = 'all', [switch]$NoMsbuild)
param(
[ValidateSet("all","net-x86","net-x64")]
[string]$buildtfm = 'all',
[switch]$NoMsbuild
)
$ErrorActionPreference = 'Stop'

$netframework_tfm = 'net48'
Expand Down

0 comments on commit 9f6b8e2

Please sign in to comment.