Skip to content

Commit

Permalink
build: create verification workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
egil committed Apr 19, 2021
1 parent cc77af9 commit ffb3d92
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions .github/workflows/verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- 'release/**'
pull_request:
types:
- opened
Expand All @@ -14,7 +13,7 @@ on:
workflow_dispatch:

jobs:
verify:
verify-bunit:
strategy:
fail-fast: false
matrix:
Expand All @@ -26,7 +25,7 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: ⚙️ Setup dotnet 3.1.x
uses: actions/setup-dotnet@v1
with:
Expand All @@ -36,40 +35,44 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.x'

- name: ⚙️ Setup GIT versioning
uses: dotnet/nbgv@v0.4.0
with:
setAllVars: true

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

- name: 🐜 Ensure nuget.org source on Windows
if: matrix.os == 'windows-latest'
run: dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org --configfile $env:APPDATA\NuGet\NuGet.Config
continue-on-error: true

- name: 🔁 Restore packages
run: dotnet restore

- name: 🛠️ Building library in release mode
run: dotnet build -c release --no-restore -p:ContinuousIntegrationBuild=true
run: dotnet build -c release -p:ContinuousIntegrationBuild=true

- name: 🧪 Run unit tests
run: dotnet test -c release --no-build

- name: 🗳️ Create library packages
run: dotnet pack -c release --no-build -o ${GITHUB_WORKSPACE}/packages

run: |
dotnet pack src/bunit/ -c release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
dotnet pack -c release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
dotnet pack src/bunit.template/ -c release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true
# Excluding windows because the restore step doesnt seem to work correct.
- name: ✔ Verify template
if: matrix.os != 'windows-latest'
run: |
dotnet new --install ${GITHUB_WORKSPACE}/packages/bunit.template.$NBGV_NuGetPackageVersion.nupkg
dotnet new --install bunit.template --nuget-source ${GITHUB_WORKSPACE}/packages
dotnet new bunit --no-restore -o ${GITHUB_WORKSPACE}/TemplateTest
dotnet restore ${GITHUB_WORKSPACE}/TemplateTest --source ${GITHUB_WORKSPACE}/packages --source https://api.nuget.org/v3/index.json
dotnet test ${GITHUB_WORKSPACE}/TemplateTest
# DocFx only works well on Windows currently
- name: 📄 Build documentation
if: matrix.os == 'windows-latest'
run: dotnet build docs/site/

0 comments on commit ffb3d92

Please sign in to comment.