Skip to content

Commit

Permalink
Nuke: Добавлена публикация проекта (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
dosymep authored Dec 6, 2024
1 parent 8c99d6d commit 19f7eb2
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 71 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: build

on:
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

# Add DevExpress source: https://docs.devexpress.com/GeneralInformation/117209/installation/install-devexpress-controls-using-nuget-packages/manage-packages-with-dotnet-cli
- name: Add DevExpress package source
run: dotnet nuget add source https://nuget.devexpress.com/api -n DXFeed -u DevExpress -p ${{ secrets.DEVEXPRESS_FEED_URL }}

# Build docs
- name: Run './build.cmd '
run: ./build.cmd compile
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Upload docs site: https://github.com/marketplace/actions/upload-a-build-artifact
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: bin
path: bin
5 changes: 5 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
name: docs

on:
# manual
workflow_dispatch:

# when update main branch
push:
branches: [main, master]

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
Expand Down
146 changes: 80 additions & 66 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref": "#/definitions/build",
"title": "Build Schema",
"definitions": {
"build": {
"type": "object",
"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",
"DocsCompile",
"Publish",
"Restore"
]
},
"Verbosity": {
"type": "string",
"description": "",
"enum": [
"Verbose",
"Normal",
"Minimal",
"Quiet"
]
},
"NukeBuild": {
"properties": {
"Configuration": {
"type": "string",
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
"enum": [
"Debug",
"Release"
]
},
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
},
"DocsCaches": {
"type": "string"
},
"DocsConfig": {
"type": "string"
},
"DocsOutput": {
"type": "string"
},
"Help": {
"type": "boolean",
"description": "Shows the help text for this build assembly"
},
"Host": {
"type": "string",
"description": "Host for execution. Default is 'automatic'",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
"$ref": "#/definitions/Host"
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"Output": {
"type": "string"
},
"Partition": {
"type": "string",
"description": "Partition to use on CI"
Expand All @@ -82,43 +82,57 @@
"type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"DocsCompile",
"Restore"
]
"$ref": "#/definitions/ExecutableTarget"
}
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"DocsCompile",
"Restore"
]
"$ref": "#/definitions/ExecutableTarget"
}
},
"Verbosity": {
"type": "string",
"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": [
"Minimal",
"Normal",
"Quiet",
"Verbose"
"Debug",
"Release"
]
},
"DocsCaches": {
"type": "string"
},
"DocsConfig": {
"type": "string"
},
"DocsOutput": {
"type": "string"
},
"Output": {
"type": "string"
},
"PublishOutput": {
"type": "string"
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
}
}
},
{
"$ref": "#/definitions/NukeBuild"
}
}
]
}
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,20 @@
[![DevExpress](https://img.shields.io/badge/DevExpress-WPF-blue.svg)](https://www.devexpress.com/products/net/controls/wpf)

Данный пакет содержит базовые интерфейсы сервисов.

## Сборка проекта

Компиляция проекта в папку `bin`
```
nuke compile
```

Локальная публикация проекта
```
nuke publish
```

Сборка и публикация документации
```
nuke doc-compile
```
24 changes: 21 additions & 3 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ class Build : NukeBuild, IHazSolution {
[Parameter] readonly string DocsOutput = Path.Combine("docs", "_site");
[Parameter] readonly string DocsConfig = Path.Combine("docs", "docfx.json");
[Parameter] readonly AbsolutePath DocsCaches = RootDirectory / Path.Combine("docs", "api");
[Parameter] readonly AbsolutePath PublishOutput;

public Build() {
AbsolutePath appdataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
PublishOutput = appdataFolder / "pyRevit" / "Extensions" / "BIM4Everyone.lib" / "dosymep_libs" / "libs";
}

Target Clean => _ => _
.Executes(() => {
Expand All @@ -61,11 +67,23 @@ class Build : NukeBuild, IHazSolution {
DotNetBuild(s => s
.EnableForce()
.DisableNoRestore()
.SetOutputDirectory(Output)
.SetConfiguration(Configuration)
.SetProjectFile(((IHazSolution) this).Solution)
.When(IsServerBuild, _ => _
.EnableContinuousIntegrationBuild()));
.When(settings => IsServerBuild,
_ => _
.EnableContinuousIntegrationBuild())
.SetProperty("OutputPath", Output));
});

Target Publish => _ => _
.DependsOn(Restore)
.OnlyWhenStatic(() => IsLocalBuild)
.Executes(() => {
DotNetPublish(s => s
.EnableForce()
.DisableNoRestore()
.SetConfiguration(Configuration)
.SetProperty("PublishDir", PublishOutput));
});

Target DocsCompile => _ => _
Expand Down
4 changes: 2 additions & 2 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nuke.Common" Version="8.0.0" />
<PackageReference Include="Nuke.Components" Version="8.0.0" />
<PackageReference Include="Nuke.Common" Version="9.0.3" />
<PackageReference Include="Nuke.Components" Version="9.0.3" />
</ItemGroup>

</Project>

0 comments on commit 19f7eb2

Please sign in to comment.