Bump xunit.core from 2.5.0 to 2.5.1 in /src #122
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
workflow_dispatch: | |
inputs: | |
buildAutoMoq: | |
description: "Build AutoMoq" | |
required: true | |
type: boolean | |
default: true | |
buildAutoNSubstitute: | |
description: "Build AutoNSubstitute" | |
required: true | |
type: boolean | |
default: true | |
buildAutoFakeItEasy: | |
description: "Build AutoFakeItEasy" | |
required: true | |
type: boolean | |
default: true | |
environment: | |
description: "Environment" | |
type: environment | |
required: true | |
default: prod | |
push: | |
branches: | |
- "master" # Run the workflow when pushing to the master branch | |
pull_request: | |
branches: | |
- "*" # Run the workflow for all pull requests | |
paths-ignore: | |
- "**.md" | |
- "**.png" | |
types: [opened, synchronize, reopened] | |
env: | |
DOTNET_NOLOGO: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
Configuration: Release | |
Namespace: Objectivity.AutoFixture.XUnit2 | |
StrongNameKeyName: key.snk | |
CoverageDirectory: ${{ github.workspace }}\src\opencover | |
defaults: | |
run: | |
shell: pwsh | |
jobs: | |
init: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.MATRIX }} | |
Version: ${{ steps.gitversion.outputs.MajorMinorPatch }} | |
steps: | |
- name: 🎰 prepare strategy matrix | |
id: set-matrix | |
run: | | |
$allModules = @{ | |
AutoMoq=if ('${{inputs.buildAutoMoq}}') { $${{inputs.buildAutoMoq}} } else { $true }; | |
AutoNSubstitute=if ('${{inputs.buildAutoNSubstitute}}') { $${{inputs.buildAutoNSubstitute}} } else { $true }; | |
AutoFakeItEasy=if ('${{inputs.buildAutoFakeItEasy}}') { $${{inputs.buildAutoFakeItEasy}} } else { $true } | |
} | |
$matrix = @{ | |
package_module = @(Foreach ($module in ($allModules.GetEnumerator() | Where-Object { $_.Value })) {$module.Name}) | |
} | |
"MATRIX=$($matrix | ConvertTo-JSON -Compress)" >> $env:GITHUB_OUTPUT | |
- name: 📥 checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: 🗜️ install GitVersion | |
uses: gittools/actions/gitversion/setup@v0 | |
with: | |
versionSpec: "5.x" | |
- name: 🎱 determine version | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0 | |
with: | |
useConfigFile: true | |
build: | |
needs: init | |
runs-on: windows-latest # We are using windows instead of ubuntu becaus it provides support for net472 & net48. | |
timeout-minutes: 15 | |
env: | |
Version: ${{ needs.init.outputs.Version }} | |
strategy: | |
matrix: ${{ fromJSON(needs.init.outputs.matrix) }} | |
steps: | |
- name: 📥 checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: 🖊️ materialize signing key | |
id: signing-key | |
run: | | |
$path = [IO.Path]::Combine("${{ github.workspace }}","src","${{ env.StrongNameKeyName }}") | |
[IO.File]::WriteAllBytes($path, [Convert]::FromBase64String("$env:StrongNameKey")) | |
"PATH=$path" >> $env:GITHUB_OUTPUT | |
env: | |
StrongNameKey: ${{ secrets.SIGNING_KEY }} | |
- name: 🏗️ build | |
run: dotnet build ./src/${{ env.Namespace }}.${{ matrix.package_module }}.sln | |
env: | |
CI: true | |
StrongNameKey: ${{ secrets.SIGNING_KEY }} | |
StrongNameKeyPath: ${{ steps.signing-key.outputs.PATH }} | |
- name: 🧪 test Core in net7.0 & collect coverage | |
id: core-code-coverage | |
run: | | |
$path = [IO.Path]::Combine("$env:CoverageDirectory","$env:CoverageFileName.xml") | |
dotnet test ./src/${{ env.Namespace }}.Core.Tests/ --no-build -f $env:TargetFramework -e:CollectCoverage=true -e:CoverletOutputFormat=opencover -e:Exclude="[xunit*]*" -e:CoverletOutput=$path | |
"FILE=$env:CoverageFileName.$env:TargetFramework.xml" >> $env:GITHUB_OUTPUT | |
env: | |
CoverageFileName: ${{ env.Namespace }}.Core | |
TargetFramework: net7.0 | |
- name: 🧪 test Core in net472 | |
run: dotnet test ./src/${{ env.Namespace }}.Core.Tests/ --no-build -f net472 | |
- name: 🧪 test Core in net48 | |
run: dotnet test ./src/${{ env.Namespace }}.Core.Tests/ --no-build -f net48 | |
- name: 🧪 test ${{ matrix.package_module }} in net7.0 & collect coverage | |
id: module-code-coverage | |
run: | | |
$path = [IO.Path]::Combine("$env:CoverageDirectory","$env:CoverageFileName.xml") | |
dotnet test ./src/${{ env.Namespace }}.${{ matrix.package_module }}.Tests/ --no-build -f $env:TargetFramework -e:CollectCoverage=true -e:CoverletOutputFormat=opencover -e:Exclude="[xunit*]*" -e:CoverletOutput=$path | |
"FILE=$env:CoverageFileName.$env:TargetFramework.xml" >> $env:GITHUB_OUTPUT | |
env: | |
CoverageFileName: ${{ env.Namespace }}.${{ matrix.package_module }} | |
TargetFramework: net7.0 | |
- name: 🧪 test ${{ matrix.package_module }} in net472 | |
run: dotnet test ./src/${{ env.Namespace }}.${{ matrix.package_module }}.Tests/ --no-build -f net472 | |
- name: 🧪 test ${{ matrix.package_module }} in net48 | |
run: dotnet test ./src/${{ env.Namespace }}.${{ matrix.package_module }}.Tests/ --no-build -f net48 | |
- name: 📤 upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ${{ steps.core-code-coverage.outputs.FILE }},${{ steps.module-code-coverage.outputs.FILE }} | |
directory: ${{ env.CoverageDirectory }} | |
flags: unittests | |
- name: 📦 pack | |
run: dotnet pack ./src/${{ env.Namespace }}.${{ matrix.package_module }} --no-restore | |
env: | |
CI: true | |
StrongNameKey: ${{ secrets.SIGNING_KEY }} | |
StrongNameKeyPath: ${{ steps.signing-key.outputs.PATH }} | |
- name: 🔼 upload packages | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages | |
path: ./src/**/*.nupkg | |
publish: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
needs: [build] | |
environment: ${{ inputs.environment }} | |
if: ${{ inputs.environment != null }} | |
steps: | |
- name: 🔽 download packages | |
uses: actions/download-artifact@v3 | |
with: | |
name: packages | |
- name: 📤 push | |
run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source "nuget.org" --skip-duplicate | |
add-tags: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
needs: [publish, init] | |
# Allow tagging only on the master branch | |
if: ${{ github.ref_name == 'master' }} | |
steps: | |
- name: 📥 checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: 🏷️ tag version | |
run: | | |
git tag "${{ needs.init.outputs.Version }}" | |
git push origin "${{ needs.init.outputs.Version }}" |