Skip to content

Commit cd66369

Browse files
authored
Initial commit
0 parents  commit cd66369

15 files changed

Lines changed: 732 additions & 0 deletions

.config/dotnet-tools.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"slopwatch.cmd": {
6+
"version": "0.3.3",
7+
"commands": [
8+
"slopwatch"
9+
],
10+
"rollForward": false
11+
}
12+
}
13+
}

.github/dependabot.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: github-actions
5+
directory: "/"
6+
schedule:
7+
interval: daily
8+
time: "11:00"
9+
10+
- package-ecosystem: nuget
11+
directory: "/src"
12+
schedule:
13+
interval: daily
14+
time: "11:00"
15+
16+
- package-ecosystem: nuget
17+
directory: "/.config"
18+
schedule:
19+
interval: daily
20+
time: "11:00"
21+
22+
- package-ecosystem: dotnet-sdk
23+
directory: "/src"
24+
schedule:
25+
interval: daily
26+
time: "11:00"

.github/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# .github/release.yml
2+
changelog:
3+
exclude:
4+
labels:
5+
- ignore-for-release
6+
- documentation
7+
authors:
8+
- dependabot[bot]
9+
10+
categories:
11+
- title: "🚨 Breaking Changes"
12+
labels:
13+
- "Semver-Major"
14+
- "breaking-change"
15+
16+
- title: "🎉 New Features"
17+
labels:
18+
- "Semver-Minor"
19+
- enhancement
20+
- feature
21+
22+
- title: "🐛 Bug Fixes"
23+
labels:
24+
- "Semver-Patch"
25+
- bug
26+
- fix
27+
28+
- title: "📦 Dependencies"
29+
labels:
30+
- dependencies
31+
- nuget
32+
- github-actions
33+
34+
- title: "🔧 Other Changes"
35+
labels:
36+
- "*"
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Build and Release NuGet Package
2+
on:
3+
push:
4+
branches: [ "main" ]
5+
pull_request:
6+
branches: [ "main" ]
7+
8+
env:
9+
GLOBAL_JSON_PATH: './src/global.json'
10+
PROJECT_PATH: './src/dotnet.library.sln'
11+
PACKAGE_OUTPUT_DIRECTORY: './packages'
12+
TEST_OUTPUT_DIRECTORY: './testresults'
13+
14+
permissions:
15+
contents: write
16+
17+
jobs:
18+
build:
19+
permissions:
20+
contents: read
21+
# For a list of available runner types, refer to
22+
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
23+
runs-on: ubuntu-latest
24+
outputs:
25+
semVer: ${{ steps.gitversion.outputs.semVer }}
26+
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v6
30+
with:
31+
fetch-depth: 0
32+
33+
# Install the .NET Core workload
34+
- name: Install .NET Core
35+
uses: actions/setup-dotnet@v5
36+
with:
37+
global-json-file: ${{ env.GLOBAL_JSON_PATH }}
38+
39+
- name: Restore tools
40+
run: dotnet tool restore
41+
42+
- name: Run Slopwatch
43+
run: dotnet tool run slopwatch analyze --fail-on error
44+
45+
- name: Install GitVersion
46+
uses: gittools/actions/gitversion/setup@v4.2.0
47+
with:
48+
versionSpec: '6.x'
49+
50+
- name: Determine Version
51+
uses: gittools/actions/gitversion/execute@v4.2.0
52+
id: gitversion
53+
54+
- name: Display GitVersion outputs
55+
run: |
56+
echo "Version: ${{ steps.gitversion.outputs.semVer }}"
57+
58+
- name: Restore dependencies
59+
run: dotnet restore ${{ env.PROJECT_PATH }}
60+
61+
- name: Build
62+
run: >
63+
dotnet build
64+
--configuration Release
65+
--no-restore
66+
${{ env.PROJECT_PATH }}
67+
/p:Version=${{ steps.gitversion.outputs.semVer }}
68+
69+
- name: Run tests
70+
run: >
71+
dotnet test
72+
--configuration Release
73+
--no-build
74+
--collect:"XPlat Code Coverage;Format=opencover"
75+
--logger trx
76+
--results-directory ${{ env.TEST_OUTPUT_DIRECTORY }}
77+
--verbosity normal
78+
${{ env.PROJECT_PATH }}
79+
80+
- name: Create NuGet package
81+
run: >
82+
dotnet pack
83+
--configuration Release
84+
--no-build
85+
--output ${{ env.PACKAGE_OUTPUT_DIRECTORY }}
86+
${{ env.PROJECT_PATH }}
87+
/p:PackageVersion=${{ steps.gitversion.outputs.semVer }}
88+
89+
- name: Upload package artifacts
90+
uses: actions/upload-artifact@v6
91+
with:
92+
name: nuget-packages
93+
path: ${{ env.PACKAGE_OUTPUT_DIRECTORY }}/*.nupkg
94+
95+
publish:
96+
permissions:
97+
contents: write
98+
runs-on: ubuntu-latest
99+
needs: build
100+
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && false
101+
102+
steps:
103+
- name: Checkout
104+
uses: actions/checkout@v6
105+
with:
106+
fetch-depth: 1
107+
108+
- name: Download package artifacts
109+
uses: actions/download-artifact@v7
110+
with:
111+
name: nuget-packages
112+
path: ${{ env.PACKAGE_OUTPUT_DIRECTORY }}
113+
114+
- name: Setup .NET Core
115+
uses: actions/setup-dotnet@v5
116+
with:
117+
global-json-file: ${{ env.GLOBAL_JSON_PATH }}
118+
119+
- name: Publish to NuGet
120+
run: |
121+
dotnet nuget push --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate ${{ env.PACKAGE_OUTPUT_DIRECTORY }}/*.nupkg
122+
123+
- name: Create & Publish Release
124+
uses: softprops/action-gh-release@v2
125+
with:
126+
tag_name: "v${{ needs.build.outputs.semVer }}"
127+
target_commitish: ${{ github.sha }}
128+
name: "${{ github.event.repository.name }} v${{ needs.build.outputs.semVer }}"
129+
generate_release_notes: true
130+
draft: false
131+
prerelease: false
132+
make_latest: true
133+
files: ${{ env.PACKAGE_OUTPUT_DIRECTORY }}/*.nupkg

.github/workflows/codeql.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "main", feature/*, ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "main" ]
20+
schedule:
21+
- cron: '38 2 * * 2'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'csharp' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v6
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v4
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
52+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53+
# queries: security-extended,security-and-quality
54+
55+
56+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
57+
# If this step fails, then you should remove it and run the build manually (see below)
58+
- name: Autobuild
59+
uses: github/codeql-action/autobuild@v4
60+
61+
# ℹ️ Command-line programs to run using the OS shell.
62+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63+
64+
# If the Autobuild fails above, remove it and uncomment the following three lines.
65+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66+
67+
# - run: |
68+
# echo "Run, Build Application using script"
69+
# ./location_of_script_within_repo/buildscript.sh
70+
71+
- name: Perform CodeQL Analysis
72+
uses: github/codeql-action/analyze@v4
73+
with:
74+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)