Skip to content

Commit b62d6e9

Browse files
committed
Modernize builder tools
1 parent 8d6d4e9 commit b62d6e9

File tree

7 files changed

+96
-91
lines changed

7 files changed

+96
-91
lines changed

.github/workflows/pull-request.yaml

-44
This file was deleted.

.github/workflows/validate.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Validate
2+
on: [push, pull_request]
3+
4+
jobs:
5+
build:
6+
runs-on: windows-latest
7+
steps:
8+
- name: Checkout
9+
uses: actions/checkout@v4
10+
11+
- name: Setup Dotnet
12+
uses: actions/setup-dotnet@v4
13+
with:
14+
cache: true
15+
16+
- name: Build Native Bridge
17+
run: dotnet build ./SharpShellNativeBridge/SharpShellNativeBridge.sln -c Release
18+
19+
- name: Build SharpShell
20+
run: dotnet build ./SharpShell/SharpShell.sln -c Release
21+
22+
- name: Upload Artifacts
23+
uses: actions/upload-artifact@v4
24+
with:
25+
name: artifacts
26+
path: |
27+
./SharpShellNativeBridge/artifacts
28+
./SharpShell/artifacts

SharpShell/build.ps1

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ $solutionFile = "SharpShell.sln"
55
# Get the 'MSBuild.exe' path. On CI platforms (e.g. GitHub actions) it will
66
# already be in the path. If it's not, use vswhere to find it.
77
$msbuildPath = If (Get-Command $msbuild -ErrorAction SilentlyContinue) {
8-
# MSBuild.exe is avaialble from %PATH% - we are probably in CI...
9-
$msbuild
8+
# MSBuild.exe is avaialble from %PATH% - we are probably in CI...
9+
$msbuild
1010
} Else {
11-
# Find MSBuild.exe using 'vswhere'...
12-
& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe
11+
# Find MSBuild.exe using 'vswhere'...
12+
& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe
1313
}
1414
$arguments = @("/t:Clean,Restore,Build", "/p:Configuration=Release", "$PSScriptRoot\$solutionFile")
1515

SharpShell/coverage.ps1

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
# Define the location of the xml report and html report.
2-
$coverageDir = "$PSScriptRoot\artifacts\coverage"
2+
$coverageDir = "$PSScriptRoot\artifacts\coverage"
33
$coverageReport = "$coverageDir\coverage.xml"
44

5-
# Quote arguments for the commandline.
6-
$testAssemblyArgs = "`"$PSScriptRoot\SharpShell.Tests\bin\Release\SharpShell.Tests.dll`""
7-
$workArgs = "`"$PSScriptRoot\artifacts\tests`""
5+
# Get the set of test assemblies and the work folder.
6+
$testAssemblies = Get-ChildItem -Include *.Tests.dll -Recurse | Where-Object {$_.FullName -like "*bin\Release*"}
7+
$workArgs = "$PSScriptRoot\artifacts\tests"
88

9-
# Create an artifacts directory and build the report.
9+
# Create an artifacts directory and create the command to build the report.
1010
New-Item -ItemType Directory -Force -Path "$PSScriptRoot\artifacts\coverage"
11-
OpenCover.Console.exe "-target:nunit3-console.exe" `
12-
-targetargs:"$testAssemblyArgs --work=$workArgs" `
11+
$command = "OpenCover.Console.exe -target:nunit3-console.exe" `
12+
"-targetargs:`"$testAssemblies --work=$workArgs`"" `
1313
"-filter:+[SharpShell*]* -[SharpShell.Tests*]*" `
14-
"-register:user" `
15-
"-output:$coverageReport"
14+
"-register:user -output:$coverageReport"
15+
Write-Host "Running: `"$command`""
16+
Invoke-Expression $command
1617

1718
# Create a local report.
1819
reportgenerator "-reports:$coverageReport" "-targetdir:$coverageDir\html"
1920

2021
# Upload the report to codecov. The CODECOV_TOKEN env var must be set.
2122
codecov -f "$coverageReport"
22-

SharpShell/pack.ps1

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Create the artifacts packages folder.
2+
$artifactsFolder = "$PSScriptRoot/artifacts/packages"
3+
4+
if (Test-Path $artifactsFolder) { Remove-Item $artifactsFolder -Recurse -Force }
5+
New-Item -Path $artifactsFolder -ItemType directory
6+
7+
# Package each of our projects. This must be run *after* ./build.ps1.
8+
dotnet pack --no-restore --no-build "$PSScriptRoot/SharpShell.csproj" -c:Release
9+
10+
# Copy over the packages.
11+
Get-ChildItem "$PSScriptRoot" -Include SharpGL*.nupkg -Recurse | Copy-Item -Destination $artifactsFolder

SharpShell/test.ps1

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ New-Item -ItemType Directory -Force -Path "$PSScriptRoot\artifacts\tests"
33

44
# Find all test assemblies.
55
$testAssemblies = Get-ChildItem -Include *.Tests.dll -Recurse | Where-Object {$_.FullName -like "*bin\Release*"}
6-
nunit3-console.exe $testAssemblies --work="$PSScriptRoot\artifacts\tests"
6+
$command = "nunit3-console.exe $testAssemblies --work=`"$PSScriptRoot\artifacts\tests`""
7+
Write-Host "Running: `"$command`""
8+
Invoke-Expression $command

appveyor.yml

+40-32
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,57 @@
11
version: 1.0.{build}
2-
image: Visual Studio 2017
2+
image: Visual Studio 2019
33
configuration: Release
44
environment:
55
CODECOV_TOKEN: 875a7530-b25b-49e9-a2ba-fe8b7a80cc6b
66

7+
# Cache chocolatey packages and Nuget packages. Nuget package cache is invalidated
8+
# on any change to a project file, the choco cache on any change to the config
9+
# nuget file.
10+
cache:
11+
- SharpShell/packages -> **/*.csproj
12+
- C:/ProgramData/chocolatey/bin -> ./SharpShell/config.ps1
13+
- C:/ProgramData/chocolatey/lib -> ./SharpShell/config.ps1
14+
715
# Before building, restore Nuget packages and install dependencies.
816
before_build:
9-
- ps: |
10-
nuget restore SharpShell\SharpShell.sln
11-
.\SharpShell\config.ps1
17+
- ps: |
18+
nuget restore SharpShell/SharpShell.sln
19+
./SharpShell/config.ps1
1220
13-
build:
14-
project: SharpShell\SharpShell.sln
15-
publish_nuget: true
16-
verbosity: minimal
21+
# Use our own build script.
22+
build_script:
23+
- ps: |
24+
./SharpShell/build.ps1
25+
./SharpShell/pack.ps1
26+
# After the build as completed, analyse coverage and upload.
27+
on_success:
28+
- ps: ./SharpShell/coverage.ps1
1729

1830
# Before packaging, zip up the tools.
1931
before_package:
20-
- ps: |
21-
7z a ServerManager.zip C:\projects\sharpshell\SharpShell\Tools\ServerManager\bin\Release\*
22-
7z a ServerRegistrationManager.zip C:\projects\sharpshell\SharpShell\Tools\ServerRegistrationManager\bin\Release\*
32+
- ps: |
33+
7z a ServerManager.zip C:/projects/sharpshell/SharpShell/Tools/ServerManager/bin/Release/*
34+
7z a ServerRegistrationManager.zip C:/projects/sharpshell/SharpShell/Tools/ServerRegistrationManager/bin/Release/*
2335
2436
# Track our artifacts.
2537
artifacts:
26-
- path: ServerManager.zip
27-
name: ServerManager
28-
- path: ServerRegistrationManager.zip
29-
name: ServerRegistrationManager
30-
- path: SharpShell\artifacts
31-
name: artifacts
38+
- path: ServerManager.zip
39+
name: ServerManager
40+
- path: ServerRegistrationManager.zip
41+
name: ServerRegistrationManager
42+
- path: SharpShell/artifacts
43+
name: artifacts
44+
- path: './source/**/*.nupkg'
3245

3346
# Deploy to Nuget and GitHub Releases.
3447
deploy:
35-
- provider: NuGet
36-
api_key:
37-
secure: TWio+nDN8Ew7+OH7J3tLcEoM6DmxrIwfAr+2Ag8ROWJUEnXyoSAZ/I1GxBgB0qMd
38-
on:
39-
APPVEYOR_REPO_TAG: true
40-
- provider: GitHub
41-
auth_token:
42-
secure: KTWUORrnJKPKLSf/3ROLY50T9UfgTMnKHf3OjBOv8tlY/DAxtlglRU3eM+j45fMt
43-
artifact: SharpShell.*.nupkg, ServerRegistrationManager.*.nupkg, ServerManager.zip, ServerRegistrationManager.zip
44-
on:
45-
APPVEYOR_REPO_TAG: true
46-
47-
# After the build as completed, analyse coverage and upload.
48-
on_success:
49-
- ps: ./SharpShell/coverage.ps1
48+
- provider: NuGet
49+
api_key:
50+
secure: TWio+nDN8Ew7+OH7J3tLcEoM6DmxrIwfAr+2Ag8ROWJUEnXyoSAZ/I1GxBgB0qMd
51+
on:
52+
APPVEYOR_REPO_TAG: true
53+
- provider: GitHub
54+
auth_token:
55+
secure: KTWUORrnJKPKLSf/3ROLY50T9UfgTMnKHf3OjBOv8tlY/DAxtlglRU3eM+j45fMt
56+
on:
57+
APPVEYOR_REPO_TAG: true

0 commit comments

Comments
 (0)