Skip to content

Commit

Permalink
✨ Upgrade build system
Browse files Browse the repository at this point in the history
  • Loading branch information
pleonex committed Nov 23, 2023
1 parent dadd132 commit e2c6b39
Show file tree
Hide file tree
Showing 27 changed files with 444 additions and 291 deletions.
26 changes: 22 additions & 4 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,35 @@
"version": 1,
"isRoot": true,
"tools": {
"cake.tool": {
"version": "3.0.0",
"gitversion.tool": {
"version": "5.12.0",
"commands": [
"dotnet-cake"
"dotnet-gitversion"
]
},
"thirdlicense": {
"version": "1.3.1",
"commands": [
"thirdlicense"
]
},
"dotnet-reportgenerator-globaltool": {
"version": "5.2.0",
"commands": [
"reportgenerator"
]
},
"docfx": {
"version": "2.70.3",
"version": "2.73.2",
"commands": [
"docfx"
]
},
"gitreleasemanager.tool": {
"version": "0.16.0",
"commands": [
"dotnet-gitreleasemanager"
]
}
}
}
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ root = true
[*]
indent_style = space

[*.yml]
indent_size = 2

[*.md]
charset = utf-8
insert_final_newline = true
Expand Down
29 changes: 11 additions & 18 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,22 @@ labels: ""
assignees: ""
---

**Describe the bug**
A clear and concise description of what the bug is.
## Description

**To Reproduce**
Steps to reproduce the behavior:
TODO: describe the issue

1. Get the library from '...' and version '...'
2. Use the class and method '....'
3. See error
## Reproducer

**Expected behavior**
A clear and concise description of what you expected to happen.
TODO: steps to reproduce the behavior.

**Exceptions**
If applicable, the full exception stacktrace that you get.
## Expected behavior

**Screenshots**
If applicable, add screenshots to help explain your problem.
TODO: description of the expected behavior.

**Desktop (please complete the following information):**
## Report info

- OS: [e.g. Windows, Linux, Mac]
- Version [e.g. 22]
TODO: if applicable, the full exception stacktrace that you get.

**Additional context**
Add any other context about the problem here.
TODO: if applicable, add screenshots to help explain your problem.

TODO: describe your environment like OS, app/lib version
16 changes: 14 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ labels: ""
assignees: ""
---

A clear and concise description of what the problem is.
## Goal

**Describe the solution you'd like to see.**
TODO: describe with user stories or a short text the goal of the feature.

## Description

TODO: describe the motivation behind of the idea and what it should do.

## Proposed solution

TODO: add any ideas for the implementation or how it should look like.

## Acceptance criteria

TODO: list of expectations it should pass to close the request.
22 changes: 22 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
TODO: description of the PR work.

This PR closes #

## Quality check list

- [ ] Related code has been tested automatically or manually
- [ ] Related documentation is updated
- [ ] I acknowledge I have read and filled this checklist and accept the
[developer certificate of origin](https://developercertificate.org/)

## Acceptance criteria

TODO: list of expectations it has passed from the related issue.

## Follow-up work

TODO: describe any missing or future required work.

## Example

TODO: small code-snippet or screenshot of the work
128 changes: 20 additions & 108 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,116 +9,28 @@ on:
branches: [ develop ]
# Stable
tags: [ "v*" ]

env:
NET_SDK: '6.0.406'
release:
types:
- published

jobs:
build_main:
name: "[ubuntu-latest] Build, test and stage"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 0 # We need full history for version number

- name: "Setup .NET SDK"
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.NET_SDK }}

- name: "Install build tools"
run: dotnet tool restore

- name: "Generate release notes"
run: dotnet cake --target=Generate-ReleaseNotes --verbosity=diagnostic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Build, test and stage"
run: dotnet cake --target=Stage-Artifacts-NewDocs --configuration=Release --verbosity=diagnostic

- name: "Publish test results"
uses: actions/upload-artifact@v2
with:
name: "Test results"
path: "./artifacts/test_results"
retention-days: 1

- name: "Publish artifacts to CI"
uses: actions/upload-artifact@v2
with:
name: "Artifacts"
path: |
./artifacts/*.zip
./artifacts/*.nupkg
./artifacts/*.snupkg
retention-days: 2

build_sec:
name: "[${{ matrix.os }}] Build and test"
strategy:
matrix:
os: [ macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 0 # We need full history for version number
build:
name: "Build"
uses: ./.github/workflows/build.yml
with:
dotnet_version: '8.0.100'

- name: "Setup .NET SDK"
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.NET_SDK }}

- name: "Install build tools"
run: dotnet tool restore

# No need to stage as one job can create the binaries for all platforms
- name: "Build and test"
run: dotnet cake --target=BuildTest --configuration=Release --verbosity=diagnostic

# Preview release on push to develop only
# Preview release on push to main only
# Stable release on version tag push only
push_artifacts:
name: "Push artifacts"
deploy:
name: "Deploy"
if: github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/v')
needs: [ "build_main", "build_sec" ]
runs-on: ubuntu-latest
env:
# Needed only for Azure DevOps Artifacts due to its weird auth method.
PREVIEW_NUGET_FEED: 'https://pkgs.dev.azure.com/SceneGate/SceneGate/_packaging/SceneGate-Preview/nuget/v3/index.json'
steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 0 # We need full history for version number

- name: "Download artifacts"
uses: actions/download-artifact@v2
with:
name: "Artifacts"
path: "./artifacts"

- name: "Setup .NET SDK"
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.NET_SDK }}

- name: "Install build tools"
run: dotnet tool restore

# Weird way to authenticate in Azure DevOps Artifacts
# Then, we need to setup VSS_NUGET_EXTERNAL_FEED_ENDPOINTS
- name: "Install Azure Artifacts Credential Provider"
run: wget -qO- https://aka.ms/install-artifacts-credprovider.sh | bash

- name: "Publish artifacts"
run: dotnet cake --target=Push-Artifacts --verbosity=diagnostic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
STABLE_NUGET_FEED_TOKEN: ${{ secrets.STABLE_NUGET_FEED_TOKEN }}
PREVIEW_NUGET_FEED_TOKEN: "az" # Dummy, auth via below env var
VSS_NUGET_EXTERNAL_FEED_ENDPOINTS: '{"endpointCredentials": [{"endpoint":"${{ env.PREVIEW_NUGET_FEED }}", "username":"", "password":"${{ secrets.PREVIEW_NUGET_FEED_TOKEN }}"}]}'
needs: build
uses: ./.github/workflows/deploy.yml
with:
dotnet_version: '8.0.100'
azure_nuget_feed: 'https://pkgs.dev.azure.com/SceneGate/SceneGate/_packaging/SceneGate-Preview/nuget/v3/index.json'
secrets:
nuget_preview_token: "az" # Dummy values as we use Azure DevOps only
nuget_stable_token: ${{ secrets.NUGET_FEED_TOKEN }}
azure_nuget_token: ${{ secrets.ADO_NUGET_FEED_TOKEN }}
57 changes: 57 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: "Build"

on:
workflow_call:
inputs:
dotnet_version:
required: true
type: string

jobs:
build:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
include:
# By default they are no "main build" but if it matches "os" then yes.
- os: ubuntu-latest
is_main_build: true
name: "${{ matrix.os }}"
runs-on: ${{ matrix.os }}
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 0 # We need full history for version number

- name: "Setup .NET SDK"
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ inputs.dotnet_version }}

- name: "Build and test"
run: dotnet run --project build/orchestrator -- --target=Default --dotnet-configuration=Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Bundle"
if: ${{ matrix.is_main_build }}
run: dotnet run --project build/orchestrator -- --target=Bundle --dotnet-configuration=Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Publish artifacts to CI"
if: ${{ matrix.is_main_build }}
uses: actions/upload-artifact@v3
with:
name: "Artifacts"
retention-days: 7
path: |
build/artifacts/
!build/artifacts/docs
- name: Publish docs artifact to CI
if: ${{ matrix.is_main_build }}
uses: actions/upload-pages-artifact@v2
with:
path: build/artifacts/docs
Loading

0 comments on commit e2c6b39

Please sign in to comment.