Skip to content

Commit 23f4d39

Browse files
authored
Merge pull request #757 from ElectronNET/feature/gh-actions
Migrated to NUKE
2 parents 33ac4ed + 05ac4a1 commit 23f4d39

File tree

384 files changed

+1444
-209
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

384 files changed

+1444
-209
lines changed

.github/workflows/ci.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
8+
9+
jobs:
10+
linux:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Setup dotnet
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: |
20+
6.0.x
21+
7.0.x
22+
23+
- name: Build
24+
run: ./build.sh
25+
26+
windows:
27+
runs-on: windows-latest
28+
29+
steps:
30+
- uses: actions/checkout@v2
31+
32+
- name: Setup dotnet
33+
uses: actions/setup-dotnet@v1
34+
with:
35+
dotnet-version: |
36+
6.0.x
37+
7.0.x
38+
39+
- name: Build
40+
run: |
41+
if ($env:GITHUB_REF -eq "refs/heads/main") {
42+
.\build.ps1 -Target Publish
43+
} elseif ($env:GITHUB_REF -eq "refs/heads/develop") {
44+
.\build.ps1 -Target PrePublish
45+
} else {
46+
.\build.ps1
47+
}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -263,3 +263,6 @@ __pycache__/
263263

264264
# Mac Only settings file
265265
.DS_Store
266+
267+
# Nuke build tool
268+
.nuke/temp

.nuke/build.schema.json

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"title": "Build Schema",
4+
"$ref": "#/definitions/build",
5+
"definitions": {
6+
"build": {
7+
"type": "object",
8+
"properties": {
9+
"Configuration": {
10+
"type": "string",
11+
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
12+
"enum": [
13+
"Debug",
14+
"Release"
15+
]
16+
},
17+
"Continue": {
18+
"type": "boolean",
19+
"description": "Indicates to continue a previously failed build attempt"
20+
},
21+
"Help": {
22+
"type": "boolean",
23+
"description": "Shows the help text for this build assembly"
24+
},
25+
"Host": {
26+
"type": "string",
27+
"description": "Host for execution. Default is 'automatic'",
28+
"enum": [
29+
"AppVeyor",
30+
"AzurePipelines",
31+
"Bamboo",
32+
"Bitbucket",
33+
"Bitrise",
34+
"GitHubActions",
35+
"GitLab",
36+
"Jenkins",
37+
"Rider",
38+
"SpaceAutomation",
39+
"TeamCity",
40+
"Terminal",
41+
"TravisCI",
42+
"VisualStudio",
43+
"VSCode"
44+
]
45+
},
46+
"NoLogo": {
47+
"type": "boolean",
48+
"description": "Disables displaying the NUKE logo"
49+
},
50+
"Partition": {
51+
"type": "string",
52+
"description": "Partition to use on CI"
53+
},
54+
"Plan": {
55+
"type": "boolean",
56+
"description": "Shows the execution plan (HTML)"
57+
},
58+
"Profile": {
59+
"type": "array",
60+
"description": "Defines the profiles to load",
61+
"items": {
62+
"type": "string"
63+
}
64+
},
65+
"ReleaseNotesFilePath": {
66+
"type": "string",
67+
"description": "ReleaseNotesFilePath - To determine the SemanticVersion"
68+
},
69+
"Root": {
70+
"type": "string",
71+
"description": "Root directory during build execution"
72+
},
73+
"Skip": {
74+
"type": "array",
75+
"description": "List of targets to be skipped. Empty list skips all dependencies",
76+
"items": {
77+
"type": "string",
78+
"enum": [
79+
"Clean",
80+
"Compile",
81+
"CompileSample",
82+
"CreatePackages",
83+
"Default",
84+
"ElectronizeCustomWin7TargetSample",
85+
"ElectronizeGenericTargetSample",
86+
"ElectronizeLinuxTargetSample",
87+
"ElectronizeMacOsTargetSample",
88+
"ElectronizeWindowsTargetSample",
89+
"Package",
90+
"PrePublish",
91+
"Publish",
92+
"PublishPackages",
93+
"PublishPreRelease",
94+
"PublishRelease",
95+
"Restore",
96+
"RunUnitTests"
97+
]
98+
}
99+
},
100+
"Solution": {
101+
"type": "string",
102+
"description": "Path to a solution file that is automatically loaded"
103+
},
104+
"Target": {
105+
"type": "array",
106+
"description": "List of targets to be invoked. Default is '{default_target}'",
107+
"items": {
108+
"type": "string",
109+
"enum": [
110+
"Clean",
111+
"Compile",
112+
"CompileSample",
113+
"CreatePackages",
114+
"Default",
115+
"ElectronizeCustomWin7TargetSample",
116+
"ElectronizeGenericTargetSample",
117+
"ElectronizeLinuxTargetSample",
118+
"ElectronizeMacOsTargetSample",
119+
"ElectronizeWindowsTargetSample",
120+
"Package",
121+
"PrePublish",
122+
"Publish",
123+
"PublishPackages",
124+
"PublishPreRelease",
125+
"PublishRelease",
126+
"Restore",
127+
"RunUnitTests"
128+
]
129+
}
130+
},
131+
"Verbosity": {
132+
"type": "string",
133+
"description": "Logging verbosity during build execution. Default is 'Normal'",
134+
"enum": [
135+
"Minimal",
136+
"Normal",
137+
"Quiet",
138+
"Verbose"
139+
]
140+
}
141+
}
142+
}
143+
}
144+
}

.nuke/parameters.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "./build.schema.json",
3+
"Solution": "src/ElectronNET.sln"
4+
}

.travis.yml

-8
This file was deleted.

Changelog.md

-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
# Not released
2-
3-
# 23.6.2
4-
5-
# Released
6-
71
# 23.6.1
82

93
ElectronNET.CLI:

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![Electron.NET Logo](https://github.com/ElectronNET/Electron.NET/raw/main/assets/images/electron.net-logo.png)](https://github.com/ElectronNET/Electron.NET)
22

3-
[![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://donorbox.org/electron-net) [![Gitter](https://badges.gitter.im/ElectronNET/community.svg)](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build status](https://ci.appveyor.com/api/projects/status/q95h4xt14papwi05/branch/main?svg=true)](https://ci.appveyor.com/project/robertmuehsig/electron-net/branch/main)
3+
[![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://donorbox.org/electron-net) [![Gitter](https://badges.gitter.im/ElectronNET/community.svg)](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build status](https://github.com/ElectronNET/Electron.NET/actions/workflows/ci.yml/badge.svg)](https://github.com/ElectronNET/Electron.NET/actions/workflows/ci.yml)
44

55
Build cross platform desktop apps with .NET 6 and Blazor, ASP.NET Core (Razor Pages, MVC).
66

@@ -30,11 +30,13 @@ Also you should have installed:
3030

3131
Besides the chat on Gitter and the issues [discussed here](https://github.com/ElectronNET/Electron.NET/issues) you can also use [StackOverflow](https://stackoverflow.com/questions/tagged/electron.net) with the tag `electron.net`.
3232

33+
If you want to sponsor the further maintenance and development of this project [see the donate section](#🙏-donate).
34+
3335
## 👩‍🏫 Usage
3436

3537
To activate and communicate with the "native" (sort of native...) Electron API include the [ElectronNET.API NuGet package](https://www.nuget.org/packages/ElectronNET.API/) in your ASP.NET Core app.
3638

37-
```
39+
```ps1
3840
PM> Install-Package ElectronNET.API
3941
```
4042

@@ -198,7 +200,7 @@ Please make sure all commits are properly documented.
198200

199201
This video provides an introduction to development for Electron.NET: [Electron.NET - Contributing Getting Started](https://youtu.be/Po-saU_Z6Ws)
200202

201-
This repository consists of the main parts (API & CLI) and it's own "playground" ASP.NET Core application. Both main parts produce local NuGet packages, that are versioned with 99.0.0. The first thing you will need is to run one of the buildAll scripts (.cmd for Windows, the other for macOS/Linux).
203+
This repository consists of the main parts (API & CLI) and it's own "playground" ASP.NET Core application. Both main parts produce local NuGet packages, that are versioned with 99.0.0. The first thing you will need is to run one of the build scripts (.cmd or .ps1 for Windows, the .sh for macOS/Linux).
202204

203205
If you look for pure __[demo projects](https://github.com/ElectronNET)__ checkout the other repositories.
204206

appveyor.yml

-9
This file was deleted.

build.cmd

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
:; set -eo pipefail
2+
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
3+
:; ${SCRIPT_DIR}/build.sh "$@"
4+
:; exit $?
5+
6+
@ECHO OFF
7+
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %*

build.ps1

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
[CmdletBinding()]
2+
Param(
3+
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
4+
[string[]]$BuildArguments
5+
)
6+
7+
Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)"
8+
9+
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 }
10+
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
11+
12+
###########################################################################
13+
# CONFIGURATION
14+
###########################################################################
15+
16+
$BuildProjectFile = "$PSScriptRoot\nuke\_build.csproj"
17+
$TempDirectory = "$PSScriptRoot\\.nuke\temp"
18+
19+
$DotNetGlobalFile = "$PSScriptRoot\\global.json"
20+
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
21+
$DotNetChannel = "Current"
22+
23+
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
24+
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
25+
$env:DOTNET_MULTILEVEL_LOOKUP = 0
26+
27+
###########################################################################
28+
# EXECUTION
29+
###########################################################################
30+
31+
function ExecSafe([scriptblock] $cmd) {
32+
& $cmd
33+
if ($LASTEXITCODE) { exit $LASTEXITCODE }
34+
}
35+
36+
# If dotnet CLI is installed globally and it matches requested version, use for execution
37+
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
38+
$(dotnet --version) -and $LASTEXITCODE -eq 0) {
39+
$env:DOTNET_EXE = (Get-Command "dotnet").Path
40+
}
41+
else {
42+
# Download install script
43+
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
44+
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
45+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
46+
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
47+
48+
# If global.json exists, load expected version
49+
if (Test-Path $DotNetGlobalFile) {
50+
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
51+
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
52+
$DotNetVersion = $DotNetGlobal.sdk.version
53+
}
54+
}
55+
56+
# Install by channel or version
57+
$DotNetDirectory = "$TempDirectory\dotnet-win"
58+
if (!(Test-Path variable:DotNetVersion)) {
59+
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
60+
} else {
61+
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
62+
}
63+
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
64+
}
65+
66+
Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"
67+
68+
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
69+
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }

0 commit comments

Comments
 (0)