Skip to content

Commit 7b8981f

Browse files
authored
Merge pull request #1455 from autofac/feature/github-actions
Update build to use GitHub Actions
2 parents cf88148 + b278ef7 commit 7b8981f

File tree

98 files changed

+1564
-1907
lines changed

Some content is hidden

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

98 files changed

+1564
-1907
lines changed

.editorconfig

+5
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ indent_size = 2
163163

164164
; .NET solution files - match defaults for VS
165165
[*.sln]
166+
end_of_line = crlf
166167
indent_style = tab
167168

168169
; Config - match XML and default nuget.config template
@@ -197,3 +198,7 @@ charset = utf-8-bom
197198
; ReStructuredText - standard indentation format from examples
198199
[*.rst]
199200
indent_size = 2
201+
202+
# YAML - match standard YAML like Kubernetes and GitHub Actions
203+
[*.{yaml,yml}]
204+
indent_size = 2

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*.png binary
1414
*.gif binary
1515

16-
*.cs text=auto diff=csharp
16+
*.cs text=auto diff=csharp
1717
*.vb text=auto
1818
*.resx text=auto
1919
*.c text=auto

.github/workflows/build.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build and Test
2+
on:
3+
workflow_call:
4+
secrets:
5+
CODECOV_TOKEN:
6+
description: Token for uploading code coverage metrics to CodeCov.io.
7+
required: true
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
- name: Setup .NET
15+
uses: actions/setup-dotnet@v4
16+
with:
17+
dotnet-version: |
18+
6.0.x
19+
7.0.x
20+
8.0.x
21+
- name: Build and test
22+
run: dotnet msbuild ./default.proj
23+
- name: Upload coverage
24+
uses: codecov/codecov-action@v5
25+
with:
26+
fail_ci_if_error: true
27+
files: artifacts/logs/*/coverage.cobertura.xml
28+
token: ${{ secrets.CODECOV_TOKEN }}
29+
- name: Upload package artifacts
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: packages
33+
path: |
34+
artifacts/packages/*.nupkg
35+
artifacts/packages/*.snupkg

.github/workflows/ci.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Continuous Integration
2+
on:
3+
pull_request:
4+
branches:
5+
- develop
6+
- master
7+
push:
8+
branches:
9+
- develop
10+
- master
11+
- feature/*
12+
tags:
13+
- v[0-9]+.[0-9]+.[0-9]+
14+
# If multiple pushes happen quickly in succession, cancel the running build and
15+
# start a new one.
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
jobs:
20+
# Linting
21+
dotnet-format:
22+
uses: ./.github/workflows/dotnet-format.yml
23+
pre-commit:
24+
uses: ./.github/workflows/pre-commit.yml
25+
# Build and test
26+
build:
27+
uses: ./.github/workflows/build.yml
28+
secrets:
29+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
30+
# Publish beta and release packages.
31+
publish:
32+
uses: ./.github/workflows/publish.yml
33+
needs:
34+
- build
35+
- dotnet-format
36+
- pre-commit
37+
if: ${{ github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/v') }}
38+
secrets:
39+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

.github/workflows/dotnet-format.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: dotnet format
2+
on:
3+
workflow_call:
4+
jobs:
5+
dotnet-format:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
- name: Setup .NET 8
10+
uses: actions/setup-dotnet@v4
11+
with:
12+
dotnet-version: 8.0.x
13+
- name: dotnet format
14+
run: dotnet format Autofac.sln --no-restore --verify-no-changes

.github/workflows/pre-commit.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: pre-commit
2+
on:
3+
workflow_call:
4+
jobs:
5+
pre-commit:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
- uses: actions/setup-python@v5
10+
with:
11+
python-version: 3.x
12+
- uses: pre-commit/[email protected]

.github/workflows/publish.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish
2+
on:
3+
workflow_call:
4+
secrets:
5+
NUGET_API_KEY:
6+
description: Token for publishing packages to NuGet.
7+
required: true
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Setup .NET 8
13+
uses: actions/setup-dotnet@v4
14+
with:
15+
dotnet-version: 8.0.x
16+
- name: Download package artifacts
17+
uses: actions/download-artifact@v4
18+
with:
19+
name: packages
20+
path: artifacts/packages
21+
- name: Publish to GitHub Packages
22+
run: |
23+
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"
24+
dotnet nuget push ./artifacts/packages/*.nupkg --source github --api-key ${{ secrets.GITHUB_TOKEN }}
25+
- name: Publish to NuGet
26+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
27+
run: |
28+
# Ensure the tag is on the master branch.
29+
git branch --remote --contains | grep origin/master
30+
31+
# Push to NuGet.
32+
dotnet nuget push ./artifacts/packages/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}

.gitignore

-5
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,6 @@ _TeamCity*
8484
# DotCover is a Code Coverage Tool
8585
*.dotCover
8686

87-
# Coverage
88-
coverage.*
89-
codecov.sh
90-
coverage/
91-
9287
# NCrunch
9388
*.ncrunch*
9489
.*crunch*.local.xml

.mailmap

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ Travis Illig <[email protected]> travis.illig <[email protected]>
2222
2323
Travis Illig <[email protected]> Travis@tillig-win8-vm <[email protected]>
2424
25-
Vijay Santhanam <[email protected]> vijay.santhanam <[email protected]>
25+
Vijay Santhanam <[email protected]> vijay.santhanam <[email protected]>

.markdownlint.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"MD013": false
3+
}

.pre-commit-config.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: "cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b" # v5.0.0
4+
hooks:
5+
- id: check-json
6+
- id: check-yaml
7+
- id: check-merge-conflict
8+
- id: end-of-file-fixer
9+
- id: trailing-whitespace
10+
- repo: https://github.com/igorshubovych/markdownlint-cli
11+
rev: "586c3ea3f51230da42bab657c6a32e9e66c364f0" # v0.44.0
12+
hooks:
13+
- id: markdownlint
14+
args:
15+
- --fix
16+
- repo: https://github.com/tillig/json-sort-cli
17+
rev: "e49ea86dde26d69661d5de4ab738a7e14c6275b2" # v2.0.3
18+
hooks:
19+
- id: json-sort
20+
args:
21+
- --autofix

.vscode/settings.json

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"browsable",
88
"cref",
99
"diagnoser",
10+
"diagnosers",
1011
"finalizers",
1112
"inheritdoc",
1213
"langword",

Autofac.sln

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
2424
EndProject
2525
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{F65B03DB-7242-4C47-BB28-2079DC050CC9}"
2626
ProjectSection(SolutionItems) = preProject
27-
build\Analyzers.ruleset = build\Analyzers.ruleset
2827
build\Autofac.Build.psd1 = build\Autofac.Build.psd1
2928
build\Autofac.Build.psm1 = build\Autofac.Build.psm1
3029
build\Documentation.proj = build\Documentation.proj
3130
build\Documentation.shfbproj = build\Documentation.shfbproj
31+
build\Source.ruleset = build\Source.ruleset
3232
build\stylecop.json = build\stylecop.json
3333
EndProjectSection
3434
EndProject

Autofac.sln.DotSettings

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
2121
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
2222
<s:Boolean x:Key="/Default/UserDictionary/Words/=Autofac/@EntryIndexedValue">True</s:Boolean>
23-
<s:Boolean x:Key="/Default/UserDictionary/Words/=Startable/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
23+
<s:Boolean x:Key="/Default/UserDictionary/Words/=Startable/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

LICENSE

-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22-

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
<!-- markdownlint-disable MD041 -->
12
![Autofac character](https://raw.githubusercontent.com/autofac/autofac.github.com/8737b1213a85ad8157ab7958aeb560c7af5eb494/img/autofac_web-banner_character_fixed_width.svg)
23
![Autofac logo](https://raw.githubusercontent.com/autofac/autofac.github.com/8737b1213a85ad8157ab7958aeb560c7af5eb494/img/autofac_logo-type_fixed_height.svg)
34

45
Autofac is an [IoC container](http://martinfowler.com/articles/injection.html) for Microsoft .NET. It manages the dependencies between classes so that **applications stay easy to change as they grow** in size and complexity. This is achieved by treating regular .NET classes as *[components](https://autofac.readthedocs.io/en/latest/glossary.html)*.
56

6-
[![Build status](https://ci.appveyor.com/api/projects/status/s0vgb4m8tv9ar7we?svg=true)](https://ci.appveyor.com/project/Autofac/autofac) [![codecov](https://codecov.io/gh/Autofac/Autofac/branch/develop/graph/badge.svg)](https://codecov.io/gh/Autofac/Autofac) [![NuGet](https://img.shields.io/nuget/v/Autofac.svg)](https://nuget.org/packages/Autofac)
7+
[![Build status](https://github.com/autofac/Autofac/actions/workflows/ci.yml/badge.svg)](https://github.com/autofac/Autofac/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/Autofac/Autofac/branch/develop/graph/badge.svg)](https://codecov.io/gh/Autofac/Autofac) [![NuGet](https://img.shields.io/nuget/v/Autofac.svg)](https://nuget.org/packages/Autofac)
78

89
[![Autofac on Stack Overflow](https://img.shields.io/badge/stack%20overflow-autofac-orange.svg)](https://stackoverflow.com/questions/tagged/autofac) [![Join the chat at https://gitter.im/autofac/autofac](https://img.shields.io/gitter/room/autofac/autofac.svg)](https://gitter.im/autofac/autofac)
910

appveyor.yml

-39
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<OutputType>Exe</OutputType>
54
<TargetFramework>net8.0</TargetFramework>
6-
<PlatformTarget>x64</PlatformTarget>
5+
<PlatformTarget>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)</PlatformTarget>
6+
<CodeAnalysisRuleSet>../../build/Test.ruleset</CodeAnalysisRuleSet>
7+
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
8+
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
9+
<IsPackable>false</IsPackable>
710
<ImplicitUsings>enable</ImplicitUsings>
811
</PropertyGroup>
9-
1012
<ItemGroup>
1113
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
1214
</ItemGroup>
13-
1415
<ItemGroup>
1516
<ProjectReference Include="..\Autofac.Benchmarks\Autofac.Benchmarks.csproj" />
1617
</ItemGroup>
17-
1818
</Project>

bench/Autofac.BenchmarkProfiling/Program.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Program
1111
static void Main(string[] args)
1212
{
1313
// Pick a benchmark.
14-
var availableBenchmarks = Benchmarks.Benchmarks.All;
14+
var availableBenchmarks = Benchmarks.BenchmarkSet.All;
1515

1616
if (args.Length == 0)
1717
{
@@ -23,7 +23,7 @@ static void Main(string[] args)
2323

2424
var inputType = args[0];
2525

26-
var selectedBenchmark = availableBenchmarks.FirstOrDefault(x => x.Name.Equals(inputType, StringComparison.InvariantCultureIgnoreCase));
26+
var selectedBenchmark = availableBenchmarks.FirstOrDefault(x => x.Name.Equals(inputType, StringComparison.OrdinalIgnoreCase));
2727

2828
if (selectedBenchmark is null)
2929
{
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"profiles": {
33
"Autofac.BenchmarkProfiling": {
4-
"commandName": "Project",
5-
"commandLineArgs": ""
4+
"commandLineArgs": "",
5+
"commandName": "Project"
66
}
77
}
88
}

0 commit comments

Comments
 (0)