Skip to content

Commit ea45498

Browse files
egilactions-user
andauthored
enabled multi-targeting of both .net 5 and .net standard 2.1
* Multi target frameworks support, many nullable warnings and errors removed * updated build script * Update .github/workflows/CI-PR.yml * Update .github/workflows/CI-PR.yml * updated build script * updated build script * updated build script * updated build script 2 * updated nerdbank gitversioning in bunit.csproj * update to template build params * update to template build * update to template build * update to template install * update to version setting * workflow cleanup * new pr checks * update to pr * update to checkout depth * update to step order * added test step * run dotnet format manually * run dotnet format commit changes * run dotnet format commit changes * run dotnet format commit changes * tweaks * tweaks 2 * Automated dotnet-format update * workflow reorg * added missing checkout depth * added coveralls * tweaks to coveralls upload * exclude assets from coverage * exclude assets from coverage * Automated dotnet-format update * coveralls version * coveralls version * added changed to changelog Co-authored-by: Github Actions <actions@github.com>
1 parent d376013 commit ea45498

File tree

80 files changed

+798
-500
lines changed

Some content is hidden

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

80 files changed

+798
-500
lines changed

.github/codeql/codeql-config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
queries:
2+
- uses: security-and-quality
3+
4+
paths:
5+
- src

.github/workflows/CI-PR.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

.github/workflows/CI.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

.github/workflows/codeql.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: "CodeQL Scanning"
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
- main
8+
paths:
9+
- 'src/**'
10+
schedule:
11+
- cron: '0 0 * * 0'
12+
13+
jobs:
14+
code-scan:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v2
19+
with:
20+
# We must fetch at least the immediate parents so that if this is
21+
# a pull request then we can checkout the head.
22+
fetch-depth: 0
23+
24+
# If this run was triggered by a pull request event, then checkout
25+
# the head of the pull request instead of the merge commit.
26+
- run: git checkout HEAD^2
27+
if: ${{ github.event_name == 'pull_request' }}
28+
29+
- uses: actions/setup-dotnet@v1
30+
with:
31+
dotnet-version: '3.1.x'
32+
- uses: actions/setup-dotnet@v1
33+
with:
34+
dotnet-version: '5.0.100-preview.7.20366.6'
35+
- name: Move .net SDK's to shared folder (hack)
36+
shell: pwsh
37+
run: |
38+
$version = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Leaf;
39+
$root = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Parent;
40+
$directories = Get-ChildItem $root | Where-Object { $_.Name -ne $version };
41+
foreach ($dir in $directories) {
42+
$from = $dir.FullName;
43+
$to = "$root/$version";
44+
Write-Host Copying from $from to $to;
45+
Copy-Item "$from\*" $to -Recurse -Force;
46+
}
47+
48+
- name: Initialize CodeQL
49+
uses: github/codeql-action/init@v1
50+
with:
51+
languages: csharp
52+
config-file: ./.github/codeql/codeql-config.yml
53+
54+
- name: Building library
55+
run: dotnet build src -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
56+
57+
- name: Perform CodeQL Analysis
58+
uses: github/codeql-action/analyze@v1
Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Deploy Docs
1+
name: "Build and Deploy Docs"
22

33
on:
44
push:
@@ -15,34 +15,49 @@ jobs:
1515
- uses: actions/checkout@v2
1616
with:
1717
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
18+
1819
- uses: dotnet/nbgv@master
1920
with:
2021
setAllVars: true
22+
2123
- name: Setting VERSION
2224
run: echo "::set-env name=VERSION::$NBGV_NuGetPackageVersion"
25+
2326
- name: Update tokens in project files
2427
uses: cschleiden/replace-tokens@v1
2528
with:
2629
files: '["docs/site/*.md", "docs/**/*.md", "docs/**/*.tmpl.partial", "*.csproj", "**/*.csproj"]'
30+
2731
- uses: actions/setup-dotnet@v1
2832
with:
29-
dotnet-version: '3.1.202'
30-
- name: Building library
33+
dotnet-version: '3.1.x'
34+
- uses: actions/setup-dotnet@v1
35+
with:
36+
dotnet-version: '5.0.100-preview.7.20366.6'
37+
- name: DOTNET HACK
38+
shell: pwsh
3139
run: |
32-
dotnet restore src
33-
dotnet build src/bunit.core/ --no-restore -p:version=$VERSION
34-
dotnet build src/bunit.web/ --no-restore -p:version=$VERSION
35-
dotnet build src/bunit.xunit/ --no-restore -p:version=$VERSION
40+
$version = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Leaf;
41+
$root = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Parent;
42+
$directories = Get-ChildItem $root | Where-Object { $_.Name -ne $version };
43+
foreach ($dir in $directories) {
44+
$from = $dir.FullName;
45+
$to = "$root/$version";
46+
Write-Host Copying from $from to $to;
47+
Copy-Item "$from\*" $to -Recurse -Force;
48+
}
49+
50+
- name: Building library
51+
run: dotnet build src -p:version=$VERSION
52+
3653
- name: Verfiy docs samples
37-
run: |
38-
dotnet test docs/samples/tests/mstest
39-
dotnet test docs/samples/tests/nunit
40-
dotnet test docs/samples/tests/razor
41-
dotnet test docs/samples/tests/xunit
54+
run: dotnet test docs/samples
55+
4256
- name: Building docs
4357
run: |
4458
dotnet build docs/site/
4559
dotnet build docs/site/
60+
4661
- name: Deploy to GitHub Pages
4762
if: success()
4863
uses: crazy-max/ghaction-github-pages@v2

.github/workflows/DEV-GPR-PUSH.yml renamed to .github/workflows/publish-nightly-to-gpr.yml

Lines changed: 70 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: DEV-GPR-PUSH
1+
name: Push nightly to GPR
22

33
on:
44
push:
@@ -8,51 +8,67 @@ on:
88
- 'src/bunit.core/**'
99
- 'src/bunit.web/**'
1010
- 'src/bunit.xunit/**'
11+
- 'src/bunit.template/**'
1112

1213
env:
1314
VERSION: ''
1415
BRANCH: ''
1516

1617
jobs:
17-
build:
18-
name: Build and verify library
18+
push-to-gpr:
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: actions/checkout@v2
21+
- name: Checkout Repository
22+
uses: actions/checkout@v2
2223
with:
2324
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
25+
2426
- uses: dotnet/nbgv@master
2527
with:
2628
setAllVars: true
29+
2730
- name: Setting VERSION and BRANCH env
2831
run: |
2932
echo "::set-env name=VERSION::$NBGV_NuGetPackageVersion"
3033
echo "::set-env name=BRANCH::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')"
34+
3135
- name: Update tokens in project files
3236
uses: cschleiden/replace-tokens@v1
3337
with:
3438
files: '["*.csproj", "**/*.csproj"]'
39+
3540
- uses: actions/setup-dotnet@v1
3641
with:
37-
dotnet-version: '3.1.202'
38-
- name: Building library
42+
dotnet-version: '3.1.x'
43+
- uses: actions/setup-dotnet@v1
44+
with:
45+
dotnet-version: '5.0.100-preview.7.20366.6'
46+
- name: DOTNET HACK
47+
shell: pwsh
3948
run: |
40-
dotnet restore src
41-
dotnet build src/bunit.core/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
42-
dotnet build src/bunit.web/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
43-
dotnet build src/bunit.xunit/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
44-
dotnet build src/bunit.testassets/ -c Release --no-restore
49+
$version = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Leaf;
50+
$root = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Parent;
51+
$directories = Get-ChildItem $root | Where-Object { $_.Name -ne $version };
52+
foreach ($dir in $directories) {
53+
$from = $dir.FullName;
54+
$to = "$root/$version";
55+
Write-Host Copying from $from to $to;
56+
Copy-Item "$from\*" $to -Recurse -Force;
57+
}
58+
59+
- name: Building library
60+
run: dotnet build src -c Release -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
61+
4562
- name: Running unit tests
46-
run: |
47-
dotnet test src/bunit.core.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591
48-
dotnet test src/bunit.web.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591
49-
dotnet test src/bunit.xunit.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591
63+
run: dotnet test src --verbosity normal /nowarn:CS1591 /p:CollectCoverage=true /p:CoverletOutput=./coverage/ /p:CoverletOutputFormat=lcov
64+
5065
- name: Creating library package
5166
run: |
5267
dotnet pack src/bunit.core/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
5368
dotnet pack src/bunit.web/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
5469
dotnet pack src/bunit.xunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
5570
dotnet pack src/bunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
71+
5672
- name: Buidling template package
5773
run: dotnet pack src/bunit.template/ -c Release -o ${GITHUB_WORKSPACE}/packages
5874
- name: Verifying template
@@ -61,6 +77,45 @@ jobs:
6177
dotnet new bunit --no-restore -o ${GITHUB_WORKSPACE}/Test
6278
dotnet restore ${GITHUB_WORKSPACE}/Test/Test.csproj --source ${GITHUB_WORKSPACE}/packages
6379
dotnet test ${GITHUB_WORKSPACE}/Test
80+
81+
- uses: coverallsapp/github-action@v1.1.1
82+
with:
83+
github-token: ${{ secrets.GITHUB_TOKEN }}
84+
path-to-lcov: src/bunit.core.tests/coverage/coverage.net5.0.info
85+
parallel: true
86+
- uses: coverallsapp/github-action@v1.1.1
87+
with:
88+
github-token: ${{ secrets.GITHUB_TOKEN }}
89+
path-to-lcov: src/bunit.core.tests/coverage/coverage.netcoreapp3.1.info
90+
parallel: true
91+
92+
- uses: coverallsapp/github-action@v1.1.1
93+
with:
94+
github-token: ${{ secrets.GITHUB_TOKEN }}
95+
path-to-lcov: src/bunit.web.tests/coverage/coverage.net5.0.info
96+
parallel: true
97+
- uses: coverallsapp/github-action@v1.1.1
98+
with:
99+
github-token: ${{ secrets.GITHUB_TOKEN }}
100+
path-to-lcov: src/bunit.web.tests/coverage/coverage.netcoreapp3.1.info
101+
parallel: true
102+
103+
- uses: coverallsapp/github-action@v1.1.1
104+
with:
105+
github-token: ${{ secrets.GITHUB_TOKEN }}
106+
path-to-lcov: src/bunit.xunit.tests/coverage/coverage.net5.0.info
107+
parallel: true
108+
- uses: coverallsapp/github-action@v1.1.1
109+
with:
110+
github-token: ${{ secrets.GITHUB_TOKEN }}
111+
path-to-lcov: src/bunit.xunit.tests/coverage/coverage.netcoreapp3.1.info
112+
parallel: true
113+
114+
- uses: coverallsapp/github-action@v1.1.1
115+
with:
116+
github-token: ${{ secrets.github_token }}
117+
parallel-finished: true
118+
64119
- name: Push packages to GitHub Package Registry
65120
run: |
66121
for f in ${GITHUB_WORKSPACE}/packages/*.nupkg

0 commit comments

Comments
 (0)