Skip to content

Commit

Permalink
enabled multi-targeting of both .net 5 and .net standard 2.1
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
egil and actions-user authored Aug 13, 2020
1 parent d376013 commit ea45498
Show file tree
Hide file tree
Showing 80 changed files with 798 additions and 500 deletions.
5 changes: 5 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
queries:
- uses: security-and-quality

paths:
- src
62 changes: 0 additions & 62 deletions .github/workflows/CI-PR.yml

This file was deleted.

62 changes: 0 additions & 62 deletions .github/workflows/CI.yml

This file was deleted.

58 changes: 58 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "CodeQL Scanning"

on:
push:
branches:
- dev
- main
paths:
- 'src/**'
schedule:
- cron: '0 0 * * 0'

jobs:
code-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 0

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.100-preview.7.20366.6'
- name: Move .net SDK's to shared folder (hack)
shell: pwsh
run: |
$version = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Leaf;
$root = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Parent;
$directories = Get-ChildItem $root | Where-Object { $_.Name -ne $version };
foreach ($dir in $directories) {
$from = $dir.FullName;
$to = "$root/$version";
Write-Host Copying from $from to $to;
Copy-Item "$from\*" $to -Recurse -Force;
}
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: csharp
config-file: ./.github/codeql/codeql-config.yml

- name: Building library
run: dotnet build src -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Deploy Docs
name: "Build and Deploy Docs"

on:
push:
Expand All @@ -15,34 +15,49 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.

- uses: dotnet/nbgv@master
with:
setAllVars: true

- name: Setting VERSION
run: echo "::set-env name=VERSION::$NBGV_NuGetPackageVersion"

- name: Update tokens in project files
uses: cschleiden/replace-tokens@v1
with:
files: '["docs/site/*.md", "docs/**/*.md", "docs/**/*.tmpl.partial", "*.csproj", "**/*.csproj"]'

- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.202'
- name: Building library
dotnet-version: '3.1.x'
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.100-preview.7.20366.6'
- name: DOTNET HACK
shell: pwsh
run: |
dotnet restore src
dotnet build src/bunit.core/ --no-restore -p:version=$VERSION
dotnet build src/bunit.web/ --no-restore -p:version=$VERSION
dotnet build src/bunit.xunit/ --no-restore -p:version=$VERSION
$version = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Leaf;
$root = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Parent;
$directories = Get-ChildItem $root | Where-Object { $_.Name -ne $version };
foreach ($dir in $directories) {
$from = $dir.FullName;
$to = "$root/$version";
Write-Host Copying from $from to $to;
Copy-Item "$from\*" $to -Recurse -Force;
}
- name: Building library
run: dotnet build src -p:version=$VERSION

- name: Verfiy docs samples
run: |
dotnet test docs/samples/tests/mstest
dotnet test docs/samples/tests/nunit
dotnet test docs/samples/tests/razor
dotnet test docs/samples/tests/xunit
run: dotnet test docs/samples

- name: Building docs
run: |
dotnet build docs/site/
dotnet build docs/site/
- name: Deploy to GitHub Pages
if: success()
uses: crazy-max/ghaction-github-pages@v2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: DEV-GPR-PUSH
name: Push nightly to GPR

on:
push:
Expand All @@ -8,51 +8,67 @@ on:
- 'src/bunit.core/**'
- 'src/bunit.web/**'
- 'src/bunit.xunit/**'
- 'src/bunit.template/**'

env:
VERSION: ''
BRANCH: ''

jobs:
build:
name: Build and verify library
push-to-gpr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.

- uses: dotnet/nbgv@master
with:
setAllVars: true

- name: Setting VERSION and BRANCH env
run: |
echo "::set-env name=VERSION::$NBGV_NuGetPackageVersion"
echo "::set-env name=BRANCH::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')"
- name: Update tokens in project files
uses: cschleiden/replace-tokens@v1
with:
files: '["*.csproj", "**/*.csproj"]'

- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.202'
- name: Building library
dotnet-version: '3.1.x'
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.100-preview.7.20366.6'
- name: DOTNET HACK
shell: pwsh
run: |
dotnet restore src
dotnet build src/bunit.core/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
dotnet build src/bunit.web/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
dotnet build src/bunit.xunit/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
dotnet build src/bunit.testassets/ -c Release --no-restore
$version = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Leaf;
$root = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Parent;
$directories = Get-ChildItem $root | Where-Object { $_.Name -ne $version };
foreach ($dir in $directories) {
$from = $dir.FullName;
$to = "$root/$version";
Write-Host Copying from $from to $to;
Copy-Item "$from\*" $to -Recurse -Force;
}
- name: Building library
run: dotnet build src -c Release -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true

- name: Running unit tests
run: |
dotnet test src/bunit.core.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591
dotnet test src/bunit.web.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591
dotnet test src/bunit.xunit.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591
run: dotnet test src --verbosity normal /nowarn:CS1591 /p:CollectCoverage=true /p:CoverletOutput=./coverage/ /p:CoverletOutputFormat=lcov

- name: Creating library package
run: |
dotnet pack src/bunit.core/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
dotnet pack src/bunit.web/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
dotnet pack src/bunit.xunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
dotnet pack src/bunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
- name: Buidling template package
run: dotnet pack src/bunit.template/ -c Release -o ${GITHUB_WORKSPACE}/packages
- name: Verifying template
Expand All @@ -61,6 +77,45 @@ jobs:
dotnet new bunit --no-restore -o ${GITHUB_WORKSPACE}/Test
dotnet restore ${GITHUB_WORKSPACE}/Test/Test.csproj --source ${GITHUB_WORKSPACE}/packages
dotnet test ${GITHUB_WORKSPACE}/Test
- uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: src/bunit.core.tests/coverage/coverage.net5.0.info
parallel: true
- uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: src/bunit.core.tests/coverage/coverage.netcoreapp3.1.info
parallel: true

- uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: src/bunit.web.tests/coverage/coverage.net5.0.info
parallel: true
- uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: src/bunit.web.tests/coverage/coverage.netcoreapp3.1.info
parallel: true

- uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: src/bunit.xunit.tests/coverage/coverage.net5.0.info
parallel: true
- uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: src/bunit.xunit.tests/coverage/coverage.netcoreapp3.1.info
parallel: true

- uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true

- name: Push packages to GitHub Package Registry
run: |
for f in ${GITHUB_WORKSPACE}/packages/*.nupkg
Expand Down
Loading

0 comments on commit ea45498

Please sign in to comment.