Skip to content

Commit 31b2b6c

Browse files
committed
new push workflow to nuget
1 parent d777bd7 commit 31b2b6c

3 files changed

Lines changed: 77 additions & 0 deletions

File tree

.github/.force-nuget-push

Whitespace-only changes.

.github/workflows/NUGET-PUSH.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: RELEASE
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- '.github/.force-nuget-push'
9+
10+
env:
11+
VERSION: 0.0.0
12+
BRANCH: ''
13+
14+
jobs:
15+
build:
16+
name: Build and verify library
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v2
20+
with:
21+
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
22+
- uses: dotnet/nbgv@master
23+
with:
24+
setAllVars: true
25+
- name: Setting VERSION and BRANCH env
26+
run: |
27+
echo "::set-env name=VERSION::$NBGV_NuGetPackageVersion"
28+
echo "::set-env name=BRANCH::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')"
29+
- name: Update tokens in project files
30+
uses: cschleiden/replace-tokens@v1
31+
with:
32+
files: '["*.csproj", "**/*.csproj"]'
33+
- uses: actions/setup-dotnet@v1
34+
with:
35+
dotnet-version: '3.1.202'
36+
- name: Building library
37+
run: |
38+
dotnet restore src
39+
dotnet build src/bunit.core/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
40+
dotnet build src/bunit.web/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
41+
dotnet build src/bunit.xunit/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
42+
dotnet build src/bunit.testassets/ -c Release --no-restore
43+
- name: Running unit tests
44+
run: |
45+
dotnet test src/bunit.core.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591
46+
dotnet test src/bunit.web.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591
47+
dotnet test src/bunit.xunit.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591
48+
- name: Creating library package
49+
run: |
50+
dotnet pack src/bunit.core/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
51+
dotnet pack src/bunit.web/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
52+
dotnet pack src/bunit.xunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
53+
dotnet pack src/bunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
54+
- name: Buidling template package
55+
run: dotnet pack src/bunit.template/ -c Release -o ${GITHUB_WORKSPACE}/packages
56+
- name: Verifying template
57+
run: |
58+
dotnet new --install ${GITHUB_WORKSPACE}/packages/bunit.template.$VERSION.nupkg
59+
dotnet new bunit --no-restore -o ${GITHUB_WORKSPACE}/Test
60+
dotnet restore ${GITHUB_WORKSPACE}/Test/Test.csproj --source ${GITHUB_WORKSPACE}/packages
61+
dotnet test ${GITHUB_WORKSPACE}/Test
62+
#- name: Push packages to GitHub Packages
63+
# run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/'*.nupkg' -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ The library's goal is to make it easy to write _comprehensive, stable unit tests
2323

2424
**Go to [bUnit.egilhansen.com](https://bunit.egilhansen.com) to learn more.**
2525

26+
### NuGet downloads
27+
28+
bUnit is available on NuGet in various incarnations. If you are using xUnit as your general purpose testing framework, you can use `bunit`, which includes everything in one package. If you want to use NUnit or MStest, then pick `bunit.core` and `bunit.web`:
29+
30+
| Name | Type | NuGet Download Link |
31+
| ----- | ----- | ---- |
32+
| bUnit | Library, includes core, web, and xUnit | [![Nuget](https://img.shields.io/nuget/dt/bunit?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit/) |
33+
| bUnit.core | Library, only core | [![Nuget](https://img.shields.io/nuget/dt/bunit.core?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit.core/) |
34+
| bUnit.web | Library, web and core | [![Nuget](https://img.shields.io/nuget/dt/bunit.web?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit.web/) |
35+
| bUnit.xUnit |Library, xUnit and core | [![Nuget](https://img.shields.io/nuget/dt/bunit.xunit?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit.xunit/) |
36+
| bUnit.template | Template, which currently creates an xUnit based bUnit test projects only | [![Nuget](https://img.shields.io/nuget/dt/bunit.template?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit.template/) |
37+
38+
To get started, head to the documentation on [bUnit.egilhansen.com/docs](https://bunit.egilhansen.com/docs) to learn more.
39+
2640
## Milestones to v1.0.0
2741

2842
These are the current goals that should be reached before v1.0.0 is ready:

0 commit comments

Comments
 (0)