-
Notifications
You must be signed in to change notification settings - Fork 2
104 lines (91 loc) · 3.09 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: ci
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
push:
branches:
- main
- v*
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for PRs
pull_request:
env:
VAULT_ADDR: https://vault.eng.aserto.com/
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
cfg:
- { project: Aserto.AspNetCore.Middleware, dotnet: 6.x}
- { project: Aserto.AspNetCore.Middleware, dotnet: 7.x}
- { project: Aserto.AspNetCore.Middleware, dotnet: 8.x}
- { project: Aserto.Clients, dotnet: 6.x }
- { project: Aserto.Clients, dotnet: 7.x }
- { project: Aserto.Clients, dotnet: 8.x }
name: Build ${{ matrix.cfg.project }} on ${{ matrix.cfg.dotnet }}
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.cfg.dotnet }}
- name: Build ${{ matrix.cfg.project }}
run: |
dotnet build src/${{ matrix.cfg.project }}
test:
runs-on: windows-latest
strategy:
matrix:
cfg:
- { project: Aserto.AspNetCore.Middleware.Tests }
name: Test ${{ matrix.cfg.project }} test.
steps:
- uses: actions/checkout@v2
- name: Setup dotnet 7.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.x
7.x
8.x
- name: Test Aserto.AspNetCore.Middleware
run: |
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info tests/${{ matrix.cfg.project }}
- name: Coveralls
continue-on-error: true
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: tests\${{ matrix.cfg.project }}\lcov.net7.info
release:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Read Configuration
uses: hashicorp/vault-action@v3
id: vault
with:
url: ${{ env.VAULT_ADDR }}
token: ${{ secrets.VAULT_TOKEN }}
secrets: |
kv/data/nuget "NUGET_API_KEY" | NUGET_API_KEY;
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.x
7.x
8.x
- name: Build
run: dotnet build --configuration Release src/Aserto.AspNetCore.Middleware/Aserto.AspNetCore.Middleware.csproj
- name: Build clients
run: dotnet build --configuration Release src/Aserto.Clients/Aserto.Clients.csproj
- name: Publish to NuGet.org
run: |
dotnet nuget push ./src/Aserto.AspNetCore.Middleware/bin/Release/*.nupkg --api-key ${NUGET_API_KEY} --source https://api.nuget.org/v3/index.json
dotnet nuget push ./src/Aserto.Clients/bin/Release/*.nupkg --api-key ${NUGET_API_KEY} --source https://api.nuget.org/v3/index.json