Skip to content

Commit

Permalink
feat: basic implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
FizzBuzz791 committed Aug 2, 2024
0 parents commit 95a13d9
Show file tree
Hide file tree
Showing 17 changed files with 1,161 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: nuget
directory: "/tests"
schedule:
interval: weekly
time: "21:00"
- package-ecosystem: nuget
directory: "/src"
schedule:
interval: weekly
time: "21:00"
31 changes: 31 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '27 7 * * 2'

jobs:
analyze:
name: Analyze
runs-on: 'ubuntu-latest'
permissions:
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: csharp
build-mode: autobuild

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:csharp"
74 changes: 74 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: CI/CD

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.next_tag }}

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- id: version
name: Calculate Version
uses: craig-day/compute-tag@v18
with:
github_token: ${{ github.token }}
version_type: patch
- name: Install dependencies (Solution)
run: dotnet restore src/NHealthCheck.csproj
- name: Build
run: dotnet build --configuration Release --no-restore /p:Version=${{ steps.version.outputs.next_tag }} src/NHealthCheck.csproj
- name: Install dependencies (Test)
run: dotnet restore tests/NHealthCheck.Tests.csproj
- name: Test
run: dotnet test tests/NHealthCheck.Tests.csproj --collect:"XPlat Code Coverage"
- name: Coverage
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: tests/TestResults/**/coverage.cobertura.xml
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: NuGetPackage
path: ./src/bin/Release/NHealthCheck.${{ steps.version.outputs.next_tag }}.nupkg

release:
runs-on: ubuntu-latest
if: ${{ contains(github.ref, 'main') }}
needs: [ build ]

steps:
- name: Download Build Artifact
uses: actions/download-artifact@v4
with:
name: NuGetPackage
- name: Push to NuGet
run: dotnet nuget push ./NHealthCheck.${{ needs.build.outputs.version }}.nupkg -k $NuGetApiKey -s https://api.nuget.org/v3/index.json
env:
NuGetApiKey: ${{ secrets.NuGetApiKey }}
- name: Release
id: release
uses: comnoco/create-release-action@v2
with:
tag_name: ${{ needs.build.outputs.version }}
release_name: ${{ needs.build.outputs.version }}
body: 'Automatic release of ${{ needs.build.outputs.version }}'
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload Release Asset
uses: csexton/release-asset-action@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
release-url: ${{ steps.release.outputs.upload_url }}
file: ./NHealthCheck.${{ needs.build.outputs.version }}.nupkg
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,dotnetcore
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,dotnetcore

### DotnetCore ###
# .NET Core build folders
bin/
obj/

# Common node modules locations
/node_modules
/wwwroot/node_modules

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,dotnetcore

TestResults
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"ms-dotnettools.csdevkit",
"github.vscode-github-actions",
"ryanluker.vscode-coverage-gutters"
]
}
19 changes: 19 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "test with coverage",
"command": "dotnet",
"type": "process",
"args": [
"test",
"--collect:\"XPlat Code Coverage\""
],
"problemMatcher": [],
"group": {
"kind": "test",
"isDefault": true
}
}
]
}
Loading

0 comments on commit 95a13d9

Please sign in to comment.