Skip to content

Commit 39e6339

Browse files
committed
updated to be more full-hearted template
1 parent f125e18 commit 39e6339

19 files changed

+436
-9
lines changed

.docfx/BuildDocfxImage.ps1

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
$version = minver -i
2+
docfx metadata docfx.json
3+
docker build -t yourbranding/classlibrary1:$version -f Dockerfile.docfx .
4+
get-childItem -recurse -path api -include *.yml, .manifest | remove-item

.docfx/Dockerfile.docfx

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# escape=`
2+
3+
FROM nginx:1.25.4 AS base
4+
RUN rm -rf /usr/share/nginx/html/*
5+
6+
FROM mono:6.12.0.182 AS build
7+
ARG DOCFX_VERSION=v2.75.3
8+
9+
ENV PATH ${PATH}:/opt/docfx
10+
ENV DOCFX_SOURCE_BRANCH_NAME="main"
11+
12+
# MONO IMAGE
13+
RUN curl -sSL --output packages-microsoft-prod.deb https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb
14+
RUN dpkg -i packages-microsoft-prod.deb
15+
RUN apt-get update `
16+
&& apt-get install -y powershell zip apt-transport-https dirmngr gnupg ca-certificates git `
17+
&& mkdir -p /opt/docfx/ `
18+
&& curl -sSL --output docfx.zip "https://github.com/dotnet/docfx/releases/download/${DOCFX_VERSION}/docfx-linux-x64-${DOCFX_VERSION}.zip" `
19+
&& unzip docfx.zip -d /opt/docfx/ `
20+
&& rm docfx.zip `
21+
&& echo '#!/bin/bash' >> /opt/docfx/docfx `
22+
&& echo 'exec mono /opt/docfx/docfx.exe $@' >> /opt/docfx/docfx `
23+
&& chmod +x /opt/docfx/docfx `
24+
&& apt-get -y purge unzip
25+
26+
SHELL ["/opt/microsoft/powershell/7/pwsh", "-Command"]
27+
28+
WORKDIR /build
29+
30+
ADD [".", "docfx"]
31+
#ADD ["src", "src"] INCLUDE THIS WHEN DOCFX IS MATURED - SEE NOTE BELOW
32+
33+
RUN cd docfx; `
34+
# docfx metadata; ` INCLUDE THIS WHEN DOCFX IS MATURED - SEE NOTE BELOW
35+
docfx build
36+
37+
# After carefull considerations, I have concluded that DoxFx is not a matured product to be run entirely as part of a Docker image.
38+
# Reason is that for DocFx to resolve cref correctly (and assembly names) it requires the msbuild project file (csproj) and not only the source files (cs).
39+
# As stated by docfx team themself: Visual Studio 2019 is needed for docfx metadata msbuild projects.
40+
# Given that VS2019 is to hard a dependency, I have moved the docfx metadata taskto my local development environment.
41+
# It would have been great to have all documentation done in a container - but for now this is not an option without significant drawbacks.
42+
43+
FROM base AS final
44+
WORKDIR /usr/share/nginx/html
45+
COPY --from=build /build/docfx/wwwroot /usr/share/nginx/html
46+
47+
ENTRYPOINT ["nginx", "-g", "daemon off;"]

.docfx/PublishDocfxImage.ps1

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
$version = minver -i
2+
docker tag sharedkernel-docfx:$version yourbranding/classlibrary1:$version
3+
docker push yourbranding/classlibrary1:$version

.docfx/docfx.json

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"metadata": [
3+
{
4+
"src": [
5+
{
6+
"files": [
7+
"ClassLibrary1/**.csproj"
8+
],
9+
"src": "../src"
10+
}
11+
],
12+
"dest": "api",
13+
"filter": "filterConfig.yml",
14+
"properties": {
15+
"TargetFramework": "net8.0"
16+
}
17+
}
18+
],
19+
"build": {
20+
"xref": [
21+
"https://docs.cuemon.net/xrefmap.yml",
22+
"https://docs.savvyio.net/xrefmap.yml",
23+
"https://sharedkernel.codebelt.net/xrefmap.yml"
24+
],
25+
"content": [
26+
{
27+
"files": [
28+
"api/**/*.yml",
29+
"api/**/*.md",
30+
"toc.yml",
31+
"*.md"
32+
],
33+
"exclude": [
34+
"bin/**",
35+
"obj/**"
36+
]
37+
}
38+
],
39+
"resource": [
40+
{
41+
"files": [
42+
"images/**"
43+
]
44+
}
45+
],
46+
"globalMetadata": {
47+
"_appTitle": "Shared Kernel (DDD) for .NET",
48+
"_appFooter": "<span>Generated by <strong>DocFX</strong>. Copyright 2024 ClassLibrary1. All rights reserved.</span>",
49+
"_appLogoPath": "images/50x50.png",
50+
"_appFaviconPath": "images/favicon.ico",
51+
"_googleAnalyticsTagId": "G-X000000000",
52+
"_enableSearch": false,
53+
"_disableContribution": false,
54+
"_gitContribute": {
55+
"repo": "https://github.com/classlibrary1/ClassLibrary1",
56+
"branch": "main"
57+
},
58+
"_gitUrlPattern": "github"
59+
},
60+
"dest": "wwwroot",
61+
"globalMetadataFiles": [],
62+
"fileMetadataFiles": [],
63+
"template": [
64+
"default",
65+
"modern"
66+
],
67+
"overwrite": [
68+
{
69+
"files": [
70+
"api/namespaces/**.md"
71+
],
72+
"exclude": [
73+
"obj/**",
74+
"wwwroot/**"
75+
]
76+
}
77+
],
78+
"postProcessors": [],
79+
"markdownEngineName": "markdig",
80+
"noLangKeyword": false,
81+
"keepFileLink": false,
82+
"cleanupCacheHistory": false,
83+
"disableGitFeatures": false,
84+
"xrefService": [
85+
"https://xref.docs.microsoft.com/query?uid={uid}" ]
86+
}
87+
}

.docfx/filterConfig.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiRules:
2+
- exclude:
3+
uidRegex: ^System\.Object
4+
type: Type

.docfx/images/32x32.png

1.58 KB
Loading

.docfx/images/50x50.png

2.02 KB
Loading

.docfx/images/favicon.ico

14.7 KB
Binary file not shown.

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"

.github/workflows/pipelines.yml

+192
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
name: ClassLibrary1 CI/CD Pipeline
2+
on:
3+
push:
4+
branches: [main]
5+
paths-ignore:
6+
- .codecov
7+
- .docfx
8+
- .github
9+
- .nuget
10+
pull_request:
11+
branches: [main]
12+
workflow_dispatch:
13+
inputs:
14+
configuration:
15+
type: choice
16+
description: The build configuration to use in the deploy stage.
17+
required: true
18+
default: Release
19+
options:
20+
- Debug
21+
- Release
22+
23+
jobs:
24+
build:
25+
name: 🛠️ Build
26+
runs-on: ubuntu-22.04
27+
outputs:
28+
version: ${{ steps.minver-calculate.outputs.version }}
29+
steps:
30+
- name: Checkout
31+
uses: codebeltnet/git-checkout@main
32+
33+
- name: Install .NET
34+
uses: codebeltnet/install-dotnet@main
35+
36+
- name: Install MinVer
37+
uses: codebeltnet/dotnet-tool-install-minver@main
38+
39+
- id: minver-calculate
40+
name: Calculate Version
41+
uses: codebeltnet/minver-calculate@main
42+
43+
- name: Download sharedkernel.snk file
44+
uses: codebeltnet/gcp-download-file@main
45+
with:
46+
serviceAccountKey: ${{ secrets.GCP_TOKEN }}
47+
bucketName: ${{ secrets.GCP_BUCKETNAME }}
48+
objectName: sharedkernel.snk
49+
50+
- name: Restore Dependencies
51+
uses: codebeltnet/dotnet-restore@main
52+
53+
- name: Build for Preview
54+
uses: codebeltnet/dotnet-build@main
55+
with:
56+
configuration: Debug
57+
58+
- name: Build for Production
59+
uses: codebeltnet/dotnet-build@main
60+
with:
61+
configuration: Release
62+
63+
pack:
64+
name: 📦 Pack
65+
runs-on: ubuntu-22.04
66+
strategy:
67+
matrix:
68+
configuration: [Debug, Release]
69+
needs: [build]
70+
steps:
71+
- name: Pack for ${{ matrix.configuration }}
72+
uses: codebeltnet/dotnet-pack@main
73+
with:
74+
configuration: ${{ matrix.configuration }}
75+
uploadPackedArtifact: true
76+
version: ${{ needs.build.outputs.version }}
77+
78+
test:
79+
name: 🧪 Test
80+
needs: [build]
81+
strategy:
82+
matrix:
83+
os: [ubuntu-22.04, windows-2022]
84+
runs-on: ${{ matrix.os }}
85+
steps:
86+
- name: Checkout
87+
uses: codebeltnet/git-checkout@main
88+
89+
- name: Install .NET
90+
uses: codebeltnet/install-dotnet@main
91+
92+
- name: Install .NET Tool - Report Generator
93+
uses: codebeltnet/dotnet-tool-install-reportgenerator@main
94+
95+
- name: Test with Debug build
96+
uses: codebeltnet/dotnet-test@main
97+
with:
98+
configuration: Debug
99+
buildSwitches: -p:SkipSignAssembly=true
100+
101+
- name: Test with Release build
102+
uses: codebeltnet/dotnet-test@main
103+
with:
104+
configuration: Release
105+
buildSwitches: -p:SkipSignAssembly=true
106+
107+
sonarcloud:
108+
name: 🔬 Code Quality Analysis
109+
needs: [build,test]
110+
runs-on: ubuntu-22.04
111+
steps:
112+
- name: Checkout
113+
uses: codebeltnet/git-checkout@main
114+
115+
- name: Install .NET
116+
uses: codebeltnet/install-dotnet@main
117+
118+
- name: Install .NET Tool - Sonar Scanner
119+
uses: codebeltnet/dotnet-tool-install-sonarscanner@main
120+
121+
- name: Restore Dependencies
122+
uses: codebeltnet/dotnet-restore@main
123+
124+
- name: Run SonarCloud Analysis
125+
uses: codebeltnet/sonarcloud-scan@main
126+
with:
127+
token: ${{ secrets.SONAR_TOKEN }}
128+
organization: geekle
129+
projectKey: sharedkernel
130+
version: ${{ needs.build.outputs.version }}
131+
132+
- name: Build
133+
uses: codebeltnet/dotnet-build@main
134+
with:
135+
buildSwitches: -p:SkipSignAssembly=true
136+
uploadBuildArtifact: false
137+
138+
- name: Finalize SonarCloud Analysis
139+
uses: codebeltnet/sonarcloud-scan-finalize@main
140+
with:
141+
token: ${{ secrets.SONAR_TOKEN }}
142+
143+
codecov:
144+
name: 📊 Code Coverage Analysis
145+
needs: [build,test]
146+
runs-on: ubuntu-22.04
147+
steps:
148+
- name: Checkout
149+
uses: codebeltnet/git-checkout@main
150+
151+
- name: Run CodeCov Analysis
152+
uses: codebeltnet/codecov-scan@main
153+
with:
154+
token: ${{ secrets.CODECOV_TOKEN }}
155+
repository: codebeltnet/shared-kernel
156+
157+
codeql:
158+
name: 🛡️ Security Analysis
159+
needs: [build,test]
160+
runs-on: ubuntu-22.04
161+
steps:
162+
- name: Checkout
163+
uses: codebeltnet/git-checkout@main
164+
165+
- name: Install .NET
166+
uses: codebeltnet/install-dotnet@main
167+
168+
- name: Restore Dependencies
169+
uses: codebeltnet/dotnet-restore@main
170+
171+
- name: Prepare CodeQL SAST Analysis
172+
uses: codebeltnet/codeql-scan@main
173+
174+
- name: Build
175+
uses: codebeltnet/dotnet-build@main
176+
with:
177+
buildSwitches: -p:SkipSignAssembly=true
178+
uploadBuildArtifact: false
179+
180+
- name: Finalize CodeQL SAST Analysis
181+
uses: codebeltnet/codeql-scan-finalize@main
182+
183+
deploy:
184+
name: 🚀 Deploy v${{ needs.build.outputs.version }}
185+
runs-on: ubuntu-22.04
186+
needs: [build,pack,test,sonarcloud,codecov,codeql]
187+
environment: Production
188+
steps:
189+
- uses: codebeltnet/nuget-push@main
190+
with:
191+
token: ${{ secrets.NUGET_TOKEN }}
192+
configuration: ${{ inputs.configuration == '' && 'Release' || inputs.configuration }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Version: 0.1.0
2+
Availability: .NET 8
3+
 
4+
# New Features
5+
- ADDED
6+
 

.nuget/ClassLibrary1/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# ClassLibrary1
2+
3+
An open-source project (MIT license) offering the next great thing withing .NET development.
4+
5+
Essential code for your ever growing toolbelt of code.

.nuget/ClassLibrary1/icon.png

4.03 KB
Loading

0 commit comments

Comments
 (0)