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

Lines changed: 5 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 35 additions & 0 deletions
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

Lines changed: 39 additions & 0 deletions
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 }}
Lines changed: 14 additions & 0 deletions
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

Lines changed: 12 additions & 0 deletions
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/action@v3.0.1

.github/workflows/publish.yml

Lines changed: 32 additions & 0 deletions
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

Lines changed: 0 additions & 5 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ Travis Illig <tillig@paraesthesia.com> travis.illig <unknown@kiln.example.com>
2222
Travis Illig <tillig@paraesthesia.com> travis.illig@gmail.com <unknown@kiln.example.com>
2323
Travis Illig <tillig@paraesthesia.com> Travis@tillig-win8-vm <unknown@kiln.example.com>
2424
Travis Illig <tillig@paraesthesia.com> Travis@tillig-win8-vm.corp.checkfree.com <unknown@kiln.example.com>
25-
Vijay Santhanam <vijay.santhanam@gmail.com> vijay.santhanam <unknown@kiln.example.com>
25+
Vijay Santhanam <vijay.santhanam@gmail.com> vijay.santhanam <unknown@kiln.example.com>

.markdownlint.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"MD013": false
3+
}

0 commit comments

Comments
 (0)