Skip to content

Commit 6c232bc

Browse files
committed
fix: Adding automation
1 parent 46577dd commit 6c232bc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2792
-27
lines changed

.config/dotnet-tools.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"husky": {
6+
"version": "0.5.4",
7+
"commands": [
8+
"husky"
9+
]
10+
},
11+
"versionize": {
12+
"version": "1.18.0",
13+
"commands": [
14+
"versionize"
15+
]
16+
}
17+
}
18+
}

.github/ISSUE_TEMPLATE/bug_report.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: JaCraig
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**Example code**
14+
Please provide example code that produces the bug either in a gist or pull request adding a test case and link here.
15+
16+
**Expected behavior**
17+
A clear and concise description of what you expected to happen.
18+
19+
**Screenshots**
20+
If applicable, add screenshots to help explain your problem.
21+
22+
**Version Information**
23+
- OS: [e.g. iOS]
24+
- .Net Version: [e.g. .Net 6]
25+
- Release Version of Library [e.g. 2.0.1]
26+
27+
**Additional context**
28+
Add any other context about the problem here.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/dependabot.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "nuget" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "daily"
12+
commit-message:
13+
prefix: "fix"
14+
ignore:
15+
- dependency-name: "Mecha.xUnit"

.github/workflows/codeql-analysis.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818
# The branches below must be a subset of the branches above
1919
branches: [ master ]
2020
schedule:
21-
- cron: '21 3 * * 1'
21+
- cron: '24 6 * * 0'
2222

2323
jobs:
2424
analyze:
@@ -38,11 +38,11 @@ jobs:
3838

3939
steps:
4040
- name: Checkout repository
41-
uses: actions/checkout@v3
41+
uses: actions/checkout@v2
4242

4343
# Initializes the CodeQL tools for scanning.
4444
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v2
45+
uses: github/codeql-action/init@v1
4646
with:
4747
languages: ${{ matrix.language }}
4848
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -53,7 +53,7 @@ jobs:
5353
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5454
# If this step fails, then you should remove it and run the build manually (see below)
5555
- name: Autobuild
56-
uses: github/codeql-action/autobuild@v2
56+
uses: github/codeql-action/autobuild@v1
5757

5858
# ℹ️ Command-line programs to run using the OS shell.
5959
# 📚 https://git.io/JvXDl
@@ -67,4 +67,4 @@ jobs:
6767
# make release
6868

6969
- name: Perform CodeQL Analysis
70-
uses: github/codeql-action/analyze@v2
70+
uses: github/codeql-action/analyze@v1
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Dependabot Reviewer
2+
3+
on: pull_request_target
4+
5+
permissions:
6+
pull-requests: write
7+
contents: write
8+
9+
jobs:
10+
review-dependabot-pr:
11+
runs-on: ubuntu-latest
12+
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
13+
steps:
14+
- name: Dependabot metadata
15+
id: dependabot-metadata
16+
uses: dependabot/[email protected]
17+
- name: Enable auto-merge for Dependabot PRs
18+
run: gh pr merge --auto --merge "$PR_URL"
19+
env:
20+
PR_URL: ${{github.event.pull_request.html_url}}
21+
GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}}
22+
- name: Approve patch and minor updates
23+
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' || steps.dependabot-metadata.outputs.update-type == 'version-update:semver-minor'}}
24+
run: gh pr review $PR_URL --approve -b "**Approving** this pull request because **it includes a patch or minor update**"
25+
env:
26+
PR_URL: ${{github.event.pull_request.html_url}}
27+
GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}}
28+
- name: Approve major updates of development dependencies
29+
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:development'}}
30+
run: gh pr review $PR_URL --approve -b "**Approving** this pull request because **it includes a major update of a dependency used only in development**"
31+
env:
32+
PR_URL: ${{github.event.pull_request.html_url}}
33+
GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}}
34+
- name: Comment on major updates of non-development dependencies
35+
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:production'}}
36+
run: |
37+
gh pr comment $PR_URL --body "**Not approving** this PR because **it includes a major update of a dependency used in production**"
38+
gh pr edit $PR_URL --add-label "requires-manual-qa"
39+
env:
40+
PR_URL: ${{github.event.pull_request.html_url}}
41+
GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}}

.github/workflows/docsfx.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Document Site Publish
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
7+
jobs:
8+
publish-docs:
9+
env:
10+
BUILD_CONFIG: 'Release'
11+
SOLUTION: 'FastActivator.sln'
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
dotnet-version: [ '6.0.x' ]
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
21+
- name: Setup .NET SDK ${{ matrix.dotnet-version }}
22+
uses: actions/[email protected]
23+
with:
24+
dotnet-version: ${{ matrix.dotnet-version }}
25+
26+
- name: Restore dependencies
27+
run: dotnet restore
28+
29+
- name: Build
30+
run: dotnet build --no-restore --configuration $BUILD_CONFIG
31+
32+
- run: dotnet tool update -g docfx
33+
- run: docfx docfx_project/docfx.json
34+
35+
- name: Deploy
36+
uses: peaceiris/actions-gh-pages@v3
37+
with:
38+
github_token: ${{ secrets.GITHUB_TOKEN }}
39+
publish_dir: docfx_project/_site

.github/workflows/dotnet-publish.yml

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: .NET Publish
5+
6+
on:
7+
push:
8+
branches: [ "master" ]
9+
10+
jobs:
11+
build:
12+
env:
13+
BUILD_CONFIG: 'Release'
14+
SOLUTION: 'FastActivator.sln'
15+
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
dotnet-version: [ '6.0.x' ]
20+
21+
steps:
22+
- uses: actions/checkout@v3
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Setup .NET SDK ${{ matrix.dotnet-version }}
27+
uses: actions/[email protected]
28+
with:
29+
dotnet-version: ${{ matrix.dotnet-version }}
30+
31+
- name: Install Versionize
32+
run: dotnet tool install --global Versionize
33+
34+
- name: Setup git
35+
run: |
36+
git config --local user.email "[email protected]"
37+
git config --local user.name "James Craig"
38+
39+
- name: Versionize Release
40+
id: versionize
41+
run: versionize --changelog-all --exit-insignificant-commits
42+
continue-on-error: true
43+
44+
- name: Restore dependencies
45+
run: dotnet restore
46+
47+
- name: Build
48+
run: dotnet build --no-restore --configuration $BUILD_CONFIG
49+
50+
- name: Test
51+
run: dotnet test /p:Configuration=$BUILD_CONFIG --no-build --verbosity normal --logger trx --results-directory "TestResults-${{ matrix.dotnet-version }}"
52+
53+
- name: Upload test results
54+
uses: actions/upload-artifact@v3
55+
with:
56+
name: dotnet-results-${{ matrix.dotnet-version }}
57+
path: TestResults-${{ matrix.dotnet-version }}
58+
if: ${{ always() }}
59+
60+
- name: Upload NuGet package
61+
uses: actions/upload-artifact@v3
62+
with:
63+
name: NugetPackage
64+
path: ./**/*.nupkg
65+
if: steps.versionize.outcome == 'success'
66+
67+
- name: Upload Symbol package
68+
uses: actions/upload-artifact@v3
69+
with:
70+
name: SymbolPackage
71+
path: ./**/*.snupkg
72+
if: steps.versionize.outcome == 'success'
73+
74+
- name: Push changes to Github
75+
if: steps.versionize.outcome == 'success'
76+
uses: ad-m/[email protected]
77+
with:
78+
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
79+
branch: ${{ github.ref }}
80+
force: true
81+
tags: true
82+
83+
- name: Upload package to NuGet
84+
if: steps.versionize.outcome == 'success'
85+
run: dotnet nuget push "**/*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json

.github/workflows/dotnet-test.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: .NET Test Pull Requests
5+
6+
on:
7+
pull_request:
8+
branches: [ "master" ]
9+
10+
jobs:
11+
build:
12+
13+
env:
14+
BUILD_CONFIG: 'Debug'
15+
SOLUTION: 'FastActivator.sln'
16+
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
dotnet-version: [ '6.0.x' ]
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
- name: Setup .NET SDK ${{ matrix.dotnet-version }}
25+
uses: actions/[email protected]
26+
with:
27+
dotnet-version: ${{ matrix.dotnet-version }}
28+
- name: Restore dependencies
29+
run: dotnet restore
30+
- name: Build
31+
run: dotnet build --no-restore --configuration $BUILD_CONFIG
32+
- name: Test
33+
run: dotnet test /p:Configuration=$BUILD_CONFIG --no-build --verbosity normal --logger trx --results-directory "TestResults-${{ matrix.dotnet-version }}"
34+
- name: Upload test results
35+
uses: actions/upload-artifact@v3
36+
with:
37+
name: dotnet-results-${{ matrix.dotnet-version }}
38+
path: TestResults-${{ matrix.dotnet-version }}
39+
if: ${{ always() }}

.husky/commit-msg

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
## husky task runner examples -------------------
5+
## Note : for local installation use 'dotnet' prefix. e.g. 'dotnet husky'
6+
7+
## run all tasks
8+
#husky run
9+
10+
### run all tasks with group: 'group-name'
11+
#husky run --group group-name
12+
13+
## run task with name: 'task-name'
14+
#husky run --name task-name
15+
16+
## pass hook arguments to task
17+
#husky run --args "$1" "$2"
18+
19+
## or put your custom commands -------------------
20+
#echo 'Husky.Net is awesome!'
21+
22+
dotnet husky run --name "commit-message-linter" --args "$1"

.husky/csxScripts/commit-lint.csx

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System.Text.RegularExpressions;
2+
3+
private var pattern = @"^(?=.{1,90}$)(?:build|feat|ci|chore|docs|fix|perf|refactor|revert|style|test)(?:\(.+\))*(?::).{4,}(?:#\d+)*(?<![\.\s])$";
4+
private var msg = File.ReadAllLines(Args[0])[0];
5+
6+
if (Regex.IsMatch(msg, pattern))
7+
return 0;
8+
9+
Console.ForegroundColor = ConsoleColor.Red;
10+
Console.WriteLine("Invalid commit message");
11+
Console.ResetColor();
12+
Console.WriteLine("e.g: 'feat(scope): subject' or 'fix: subject'");
13+
Console.ForegroundColor = ConsoleColor.Gray;
14+
Console.WriteLine("more info: https://www.conventionalcommits.org/en/v1.0.0/");
15+
16+
return 1;

.husky/pre-commit

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
## husky task runner examples -------------------
5+
## Note : for local installation use 'dotnet' prefix. e.g. 'dotnet husky'
6+
7+
## run all tasks
8+
#husky run
9+
10+
### run all tasks with group: 'group-name'
11+
#husky run --group group-name
12+
13+
## run task with name: 'task-name'
14+
#husky run --name task-name
15+
16+
## pass hook arguments to task
17+
#husky run --args "$1" "$2"
18+
19+
## or put your custom commands -------------------
20+
#echo 'Husky.Net is awesome!'
21+
22+
dotnet husky run -v --group "pre-commit"

0 commit comments

Comments
 (0)