Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ indent_size = 2

; .NET solution files - match defaults for VS
[*.sln]
end_of_line = crlf
indent_style = tab

; Config - match XML and default nuget.config template
Expand Down Expand Up @@ -197,3 +198,7 @@ charset = utf-8-bom
; ReStructuredText - standard indentation format from examples
[*.rst]
indent_size = 2

# YAML - match standard YAML like Kubernetes and GitHub Actions
[*.{yaml,yml}]
indent_size = 2
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*.png binary
*.gif binary

*.cs text=auto diff=csharp
*.cs text=auto diff=csharp
*.vb text=auto
*.resx text=auto
*.c text=auto
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build and Test
on:
workflow_call:
secrets:
CODECOV_TOKEN:
description: Token for uploading code coverage metrics to CodeCov.io.
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Build and test
run: dotnet msbuild ./default.proj
- name: Upload coverage
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
files: artifacts/logs/*/coverage.cobertura.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload package artifacts
uses: actions/upload-artifact@v4
with:
name: packages
path: |
artifacts/packages/*.nupkg
artifacts/packages/*.snupkg
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Continuous Integration
on:
pull_request:
branches:
- develop
- master
push:
branches:
- develop
- master
- feature/*
tags:
- v[0-9]+.[0-9]+.[0-9]+
# If multiple pushes happen quickly in succession, cancel the running build and
# start a new one.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Linting
dotnet-format:
uses: ./.github/workflows/dotnet-format.yml
pre-commit:
uses: ./.github/workflows/pre-commit.yml
# Build and test
build:
uses: ./.github/workflows/build.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# Publish beta and release packages.
publish:
uses: ./.github/workflows/publish.yml
needs:
- build
- dotnet-format
- pre-commit
if: ${{ github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/v') }}
secrets:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
14 changes: 14 additions & 0 deletions .github/workflows/dotnet-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: dotnet format
on:
workflow_call:
jobs:
dotnet-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: dotnet format
run: dotnet format Autofac.Multitenant.sln --verify-no-changes
12 changes: 12 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: pre-commit
on:
workflow_call:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: pre-commit/[email protected]
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish
on:
workflow_call:
secrets:
NUGET_API_KEY:
description: Token for publishing packages to NuGet.
required: true
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Download package artifacts
uses: actions/download-artifact@v4
with:
name: packages
path: artifacts/packages
- name: Publish to GitHub Packages
run: |
dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/autofac/index.json"
dotnet nuget push ./artifacts/packages/*.nupkg --skip-duplicate --source github --api-key ${{ secrets.GITHUB_TOKEN }}
dotnet nuget push ./artifacts/packages/*.snupkg --skip-duplicate --source github --api-key ${{ secrets.GITHUB_TOKEN }}
- name: Publish to NuGet
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
dotnet nuget push ./artifacts/packages/*.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ _TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover

# Coverage
coverage.*
codecov.sh
coverage/

# NCrunch
*.ncrunch*
.*crunch*.local.xml
Expand All @@ -113,7 +108,6 @@ publish/
*.pubxml

# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
packages/

# Windows Azure Build Output
Expand All @@ -138,6 +132,7 @@ node_modules/
bower_components/
wwwroot/
project.lock.json
*.Designer.cs

# RIA/Silverlight projects
Generated_Code/
Expand Down
3 changes: 3 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"MD013": false
}
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b" # v5.0.0
hooks:
- id: check-json
- id: check-yaml
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: "586c3ea3f51230da42bab657c6a32e9e66c364f0" # v0.44.0
hooks:
- id: markdownlint
args:
- --fix
- repo: https://github.com/tillig/json-sort-cli
rev: "e49ea86dde26d69661d5de4ab738a7e14c6275b2" # v2.0.3
hooks:
- id: json-sort
args:
- --autofix
19 changes: 7 additions & 12 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"recommendations": [
"bierner.markdown-emoji",
"davidanson.vscode-markdownlint",
"editorconfig.editorconfig",
"gruntfuggly.todo-tree",
"ms-dotnettools.csdevkit",
"ryanluker.vscode-coverage-gutters",
"stkb.rewrap",
"travisillig.vscode-json-stable-stringify"
]
}
{
"recommendations": [
"davidanson.vscode-markdownlint",
"editorconfig.editorconfig",
"ms-dotnettools.csdevkit"
]
}
10 changes: 6 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
"unmanaged",
"xunit"
],
"coverage-gutters.coverageBaseDir": "artifacts/coverage",
"coverage-gutters.coverageBaseDir": "artifacts/logs",
"coverage-gutters.coverageFileNames": [
"coverage.info"
"**/coverage.cobertura.xml"
],
"dotnet-test-explorer.runInParallel": true,
"dotnet-test-explorer.testProjectPath": "test/**/*.Test.csproj",
"dotnet.defaultSolution": "Autofac.Multitenant.sln",
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"*.resx": "$(capture).*.resx, $(capture).designer.cs, $(capture).designer.vb"
},
"files.watcherExclude": {
"**/target": true
}
Expand Down
130 changes: 85 additions & 45 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,85 @@
{
"tasks": [
{
"args": [
"build",
"${workspaceFolder}/Autofac.Multitenant.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"command": "dotnet",
"group": {
"isDefault": true,
"kind": "build"
},
"label": "build",
"problemMatcher": "$msCompile",
"type": "process"
},
{
"args": [
"test",
"${workspaceFolder}/Autofac.Multitenant.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"--results-directory",
"\"artifacts/coverage\"",
"--logger:trx",
"/p:CoverletOutput=\"${workspaceFolder}/artifacts/coverage/\"",
"/p:CollectCoverage=true",
"/p:CoverletOutputFormat=lcov",
"/p:Exclude=\"[System.*]*\"",
"-m:1"
],
"command": "dotnet",
"group": {
"isDefault": true,
"kind": "test"
},
"label": "test",
"problemMatcher": "$msCompile",
"type": "process"
}
],
"version": "2.0.0"
}
{
"linux": {
"options": {
"shell": {
"args": [
"-NoProfile",
"-Command"
],
"executable": "pwsh"
}
}
},
"osx": {
"options": {
"shell": {
"args": [
"-NoProfile",
"-Command"
],
"executable": "/usr/local/bin/pwsh"
}
}
},
"tasks": [
{
"command": "If (Test-Path ${workspaceFolder}/artifacts/logs) { Remove-Item ${workspaceFolder}/artifacts/logs -Recurse -Force }; New-Item -Path ${workspaceFolder}/artifacts/logs -ItemType Directory -Force | Out-Null",
"label": "create log directory",
"type": "shell"
},
{
"args": [
"build",
"${workspaceFolder}/Autofac.Multitenant.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"command": "dotnet",
"group": {
"isDefault": true,
"kind": "build"
},
"label": "build",
"problemMatcher": "$msCompile",
"type": "shell"
},
{
"args": [
"test",
"${workspaceFolder}/Autofac.Multitenant.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"--results-directory",
"\"artifacts/logs\"",
"--logger:trx",
"--collect:\"XPlat Code Coverage\"",
"--settings:build/Coverage.runsettings"
],
"command": "dotnet",
"dependsOn": [
"create log directory"
],
"group": {
"isDefault": true,
"kind": "test"
},
"label": "test",
"problemMatcher": "$msCompile",
"type": "process"
}
],
"version": "2.0.0",
"windows": {
"options": {
"shell": {
"args": [
"-NoProfile",
"-ExecutionPolicy",
"Bypass",
"-Command"
],
"executable": "pwsh.exe"
}
}
}
}
6 changes: 6 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
</Project>
Loading