Skip to content

Commit

Permalink
ci: add nuke build
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmairegger committed Jan 13, 2025
1 parent ffd970c commit beba5d5
Show file tree
Hide file tree
Showing 21 changed files with 548 additions and 101 deletions.
27 changes: 0 additions & 27 deletions .github/actions/build-and-test/action.yml

This file was deleted.

49 changes: 32 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
name: Build
on:
push:
branches:
- '**'
# ------------------------------------------------------------------------------
# <auto-generated>
#
# This code was generated.
#
# - To turn off auto-generation set:
#
# [GitHubActions (AutoGenerate = false)]
#
# - To trigger manual generation invoke:
#
# nuke --generate-configuration GitHubActions_build --host GitHubActions
#
# </auto-generated>
# ------------------------------------------------------------------------------

env:
buildConfiguration: 'Release'
workingDirectory: 'src'
name: build

on: [push]

jobs:
build-ci:
windows-latest:
name: windows-latest
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: ./.github/actions/build-and-test
with:
buildConfiguration: ${{ env.buildConfiguration }}
workingDirectory: ${{ env.workingDirectory }}
- uses: actions/checkout@v4
with:
fetch-depth: 50
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v4
with:
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
- name: 'Run: Compile'
run: ./build.cmd Compile
54 changes: 32 additions & 22 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
name: Publish
# ------------------------------------------------------------------------------
# <auto-generated>
#
# This code was generated.
#
# - To turn off auto-generation set:
#
# [GitHubActions (AutoGenerate = false)]
#
# - To trigger manual generation invoke:
#
# nuke --generate-configuration GitHubActions_publish --host GitHubActions
#
# </auto-generated>
# ------------------------------------------------------------------------------

name: publish

on:
push:
tags:
- 'v*.*.*'

env:
buildConfiguration: 'Release'
workingDirectory: 'src'

jobs:
deploy:
windows-latest:
name: windows-latest
runs-on: windows-latest
environment: production
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/build-and-test
id: build-and-test
fetch-depth: 50
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v4
with:
buildConfiguration: ${{ env.buildConfiguration }}
workingDirectory: ${{ env.workingDirectory }}

- name: Pack
run: dotnet pack --configuration Release --no-build --output artifacts
working-directory: src

- name: Push with dotnet
run: dotnet nuget push artifacts\*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
working-directory: src
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
- name: 'Run: Publish'
run: ./build.cmd Publish
env:
NuGetApiKey: ${{ secrets.NUGET_API_KEY }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
artifacts/
.nuke/temp
13 changes: 13 additions & 0 deletions .idea/.idea.Mairegger.Printing/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"Host": {
"type": "string",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
},
"ExecutableTarget": {
"type": "string",
"enum": [
"Clean",
"Compile",
"Pack",
"Publish",
"Restore",
"Test"
]
},
"Verbosity": {
"type": "string",
"description": "",
"enum": [
"Verbose",
"Normal",
"Minimal",
"Quiet"
]
},
"NukeBuild": {
"properties": {
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
},
"Help": {
"type": "boolean",
"description": "Shows the help text for this build assembly"
},
"Host": {
"description": "Host for execution. Default is 'automatic'",
"$ref": "#/definitions/Host"
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"Partition": {
"type": "string",
"description": "Partition to use on CI"
},
"Plan": {
"type": "boolean",
"description": "Shows the execution plan (HTML)"
},
"Profile": {
"type": "array",
"description": "Defines the profiles to load",
"items": {
"type": "string"
}
},
"Root": {
"type": "string",
"description": "Root directory during build execution"
},
"Skip": {
"type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies",
"items": {
"$ref": "#/definitions/ExecutableTarget"
}
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"$ref": "#/definitions/ExecutableTarget"
}
},
"Verbosity": {
"description": "Logging verbosity during build execution. Default is 'Normal'",
"$ref": "#/definitions/Verbosity"
}
}
}
},
"allOf": [
{
"properties": {
"Configuration": {
"type": "string",
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
"enum": [
"Debug",
"Release"
]
},
"NuGetApiKey": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
}
}
},
{
"$ref": "#/definitions/NukeBuild"
}
]
}
4 changes: 4 additions & 0 deletions .nuke/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "build.schema.json",
"Solution": "src/Mairegger.Printing.sln"
}
44 changes: 13 additions & 31 deletions src/Mairegger.Printing.sln → Mairegger.Printing.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,33 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29318.209
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mairegger.Printing", "Mairegger.Printing\Mairegger.Printing.csproj", "{0A7F0FD0-F7F4-415E-8494-E1CA351EF82F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mairegger.Printing", "src/Mairegger.Printing\Mairegger.Printing.csproj", "{0A7F0FD0-F7F4-415E-8494-E1CA351EF82F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleProject", "SampleProject\SampleProject.csproj", "{D5374955-B77F-4C54-B3DA-616723DDC5D8}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleProject", "src/SampleProject\SampleProject.csproj", "{D5374955-B77F-4C54-B3DA-616723DDC5D8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mairegger.Printing.Tests", "Mairegger.Printing.Test\Mairegger.Printing.Tests.csproj", "{5C6303B0-8F86-495B-A4FF-EAFB52849CE6}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mairegger.Printing.Tests", "src/Mairegger.Printing.Test\Mairegger.Printing.Tests.csproj", "{5C6303B0-8F86-495B-A4FF-EAFB52849CE6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FD2A69EE-3F3D-42F2-AFCE-C641D715F9DF}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
..\version.json = ..\version.json
..\.editorconfig = ..\.editorconfig
Directory.Build.targets = Directory.Build.targets
Directory.Packages.props = Directory.Packages.props
..\README.md = ..\README.md
Versions.props = Versions.props
Directory.Build.props = src/Directory.Build.props
version.json = version.json
.editorconfig = .editorconfig
Directory.Build.targets = src/Directory.Build.targets
Directory.Packages.props = src/Directory.Packages.props
README.md = README.md
Versions.props = src/Versions.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{B6545556-5FF3-42A6-92F4-6B609468AE80}"
ProjectSection(SolutionItems) = preProject
..\.github\dependabot.yml = ..\.github\dependabot.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "actions", "actions", "{94032B2D-96F4-4A31-A30C-D0FD6449980B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build-and-test", "build-and-test", "{F5EE117F-3999-4F59-847E-64B9A98AE589}"
ProjectSection(SolutionItems) = preProject
..\.github\actions\build-and-test\action.yml = ..\.github\actions\build-and-test\action.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{1882D2FB-1D59-4E61-9B75-31DAF505CDE5}"
ProjectSection(SolutionItems) = preProject
..\.github\workflows\build.yml = ..\.github\workflows\build.yml
..\.github\workflows\publish.yml = ..\.github\workflows\publish.yml
EndProjectSection
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "build", "build\build.csproj", "{C0FB7B76-E27D-42C3-8A9F-4AE00750402E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C0FB7B76-E27D-42C3-8A9F-4AE00750402E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C0FB7B76-E27D-42C3-8A9F-4AE00750402E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A7F0FD0-F7F4-415E-8494-E1CA351EF82F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A7F0FD0-F7F4-415E-8494-E1CA351EF82F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A7F0FD0-F7F4-415E-8494-E1CA351EF82F}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -64,9 +50,5 @@ Global
SolutionGuid = {598A1AB2-360A-415C-A7DA-E0325C6D2E2B}
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{B6545556-5FF3-42A6-92F4-6B609468AE80} = {FD2A69EE-3F3D-42F2-AFCE-C641D715F9DF}
{94032B2D-96F4-4A31-A30C-D0FD6449980B} = {B6545556-5FF3-42A6-92F4-6B609468AE80}
{F5EE117F-3999-4F59-847E-64B9A98AE589} = {94032B2D-96F4-4A31-A30C-D0FD6449980B}
{1882D2FB-1D59-4E61-9B75-31DAF505CDE5} = {B6545556-5FF3-42A6-92F4-6B609468AE80}
EndGlobalSection
EndGlobal
7 changes: 7 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:; set -eo pipefail
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
:; ${SCRIPT_DIR}/build.sh "$@"
:; exit $?

@ECHO OFF
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %*
Loading

0 comments on commit beba5d5

Please sign in to comment.