-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[POC] Add native tests #201
Changes from 19 commits
7bce5a0
d8b7e40
d211f11
0803a21
2c763d6
884ff49
592e902
d3c61e6
18c8aed
f4f4dc1
5a982cf
f9248d0
38bf557
73a8881
874c38b
8537118
d9806ab
f8927ab
171ac20
3fa24f9
9148cac
eab859b
82d9bc5
f88b52d
610e4b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"nuke.globaltool": { | ||
"version": "5.2.1", | ||
"commands": [ | ||
"nuke" | ||
] | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# ------------------------------------------------------------------------------ | ||
# <auto-generated> | ||
# | ||
# This code was generated. | ||
# | ||
# - To turn off auto-generation set: | ||
# | ||
# [GitHubActions (AutoGenerate = false)] | ||
# | ||
# - To trigger manual generation invoke: | ||
# | ||
# nuke --generate-configuration GitHubActions_ci --host GitHubActions | ||
# | ||
# </auto-generated> | ||
# ------------------------------------------------------------------------------ | ||
|
||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- 'refs/tags/*' | ||
paths: | ||
- '!docs/*' | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
windows-latest: | ||
name: windows-latest | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Cache .nuke/temp, ~/.nuget/packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
.nuke/temp | ||
~/.nuget/packages | ||
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }} | ||
- name: Run './build.cmd Workflow' | ||
run: ./build.cmd Workflow |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,4 @@ jobs: | |
env: | ||
buildConfiguration: Release | ||
shell: bash | ||
run: ./build.sh | ||
run: ./build_poc.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
:; set -eo pipefail | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These lines seem like a left-over. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is some kind of hack to make There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Magic 😮 - I needed to chmod it to try it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On MacOS it also builds a bunch of files that are not ignored. @RassK could check if the .gitignore needs some updates? |
||
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) | ||
:; ${SCRIPT_DIR}/build.sh "$@" | ||
:; exit $? | ||
|
||
@ECHO OFF | ||
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
[CmdletBinding()] | ||
Param( | ||
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] | ||
[string[]]$BuildArguments | ||
) | ||
|
||
Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)" | ||
|
||
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 } | ||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent | ||
|
||
########################################################################### | ||
# CONFIGURATION | ||
########################################################################### | ||
|
||
$BuildProjectFile = "$PSScriptRoot\build\nuke\_build.csproj" | ||
$TempDirectory = "$PSScriptRoot\\.nuke\temp" | ||
|
||
$DotNetGlobalFile = "$PSScriptRoot\\global.json" | ||
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1" | ||
$DotNetChannel = "Current" | ||
|
||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1 | ||
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1 | ||
$env:DOTNET_MULTILEVEL_LOOKUP = 0 | ||
|
||
########################################################################### | ||
# EXECUTION | ||
########################################################################### | ||
|
||
function ExecSafe([scriptblock] $cmd) { | ||
& $cmd | ||
if ($LASTEXITCODE) { exit $LASTEXITCODE } | ||
} | ||
|
||
# If dotnet CLI is installed globally and it matches requested version, use for execution | ||
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and ` | ||
$(dotnet --version) -and $LASTEXITCODE -eq 0) { | ||
$env:DOTNET_EXE = (Get-Command "dotnet").Path | ||
} | ||
else { | ||
# Download install script | ||
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1" | ||
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null | ||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | ||
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile) | ||
|
||
# If global.json exists, load expected version | ||
if (Test-Path $DotNetGlobalFile) { | ||
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json) | ||
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) { | ||
$DotNetVersion = $DotNetGlobal.sdk.version | ||
} | ||
} | ||
|
||
# Install by channel or version | ||
$DotNetDirectory = "$TempDirectory\dotnet-win" | ||
if (!(Test-Path variable:DotNetVersion)) { | ||
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath } | ||
} else { | ||
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath } | ||
} | ||
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe" | ||
} | ||
|
||
Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)" | ||
|
||
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet } | ||
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to add a target with executes
git diff --exit-code
to ensure that someone has not forgotten to commit the autogenerated code.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great idea, I think it can be a task of it's own. Will add to todo.