Update xunit-dotnet monorepo #3059
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: Build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
env: | |
# Disable the .NET logo in the console output. | |
DOTNET_NOLOGO: true | |
# Disable the .NET first time experience to skip caching NuGet packages and speed up the build. | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
# Disable sending .NET CLI telemetry to Microsoft. | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
# Set the build number in MinVer. | |
MINVERBUILDMETADATA: build.${{github.run_number}} | |
jobs: | |
build: | |
name: Build-${{matrix.os}} | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4.0.0 | |
with: | |
lfs: true | |
fetch-depth: 0 | |
- name: "Install .NET SDK" | |
uses: actions/setup-dotnet@v3.2.0 | |
with: | |
dotnet-version: | | |
3.1.x | |
5.0.x | |
global-json-file: "./global.json" | |
- name: "Dotnet Tool Restore" | |
run: dotnet tool restore | |
shell: pwsh | |
- name: "Dotnet Cake Build" | |
run: dotnet cake --target=Build | |
shell: pwsh | |
- name: "Dotnet Cake Pack" | |
run: dotnet cake --target=Pack | |
shell: pwsh | |
- name: "Publish Artefacts" | |
uses: actions/upload-artifact@v3.1.3 | |
with: | |
name: ${{matrix.os}} | |
path: "./Artefacts" | |
test: | |
name: Test-${{matrix.template}}-${{matrix.os}} | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
template: ["API", "GraphQL", "Orleans", "NuGet"] | |
os: [ubuntu-latest, windows-latest] | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4.0.0 | |
with: | |
lfs: true | |
fetch-depth: 0 | |
- name: "Install .NET SDK" | |
uses: actions/setup-dotnet@v3.2.0 | |
with: | |
dotnet-version: | | |
3.1.x | |
5.0.x | |
global-json-file: "./global.json" | |
- name: "Dotnet Tool Restore" | |
run: dotnet tool restore | |
shell: pwsh | |
- name: "Dotnet Cake Build" | |
run: dotnet cake --target=Build | |
shell: pwsh | |
- name: "Dotnet Cake InstallDeveloperCertificate" | |
run: dotnet cake --target=InstallDeveloperCertificate | |
shell: pwsh | |
- name: "Dotnet Cake Test" | |
run: dotnet cake --target=Test --template=${{matrix.template}} | |
shell: pwsh | |
publish-test-results: | |
name: "Publish Tests Results" | |
needs: build | |
if: always() | |
permissions: | |
checks: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Download Artefact" | |
uses: actions/download-artifact@v3.0.2 | |
with: | |
path: "./Artefacts" | |
- name: "Publish Test Summary" | |
uses: test-summary/action@v2 | |
if: always() | |
with: | |
paths: "./Artefacts/*/*.xml" | |
push-github-packages: | |
name: "Push GitHub Packages" | |
needs: [build, test] | |
if: github.ref == 'refs/heads/main' || github.event_name == 'release' | |
environment: | |
name: "GitHub Packages" | |
url: https://github.com/orgs/Dotnet-Boxed/packages | |
permissions: | |
packages: write | |
runs-on: windows-latest | |
steps: | |
- name: "Download Artefact" | |
uses: actions/download-artifact@v3.0.2 | |
with: | |
name: "windows-latest" | |
- name: "Dotnet NuGet Add Source" | |
run: dotnet nuget add source https://nuget.pkg.github.com/Dotnet-Boxed/index.json --name GitHub --username RehanSaeed --password ${{secrets.GITHUB_TOKEN}} | |
shell: pwsh | |
- name: "Dotnet NuGet Push" | |
run: dotnet nuget push .\*.nupkg --api-key ${{ github.token }} --source GitHub --skip-duplicate | |
shell: pwsh | |
push-nuget: | |
name: "Push NuGet Packages" | |
needs: [build, test] | |
if: github.event_name == 'release' | |
environment: | |
name: "NuGet" | |
url: https://www.nuget.org/packages/Boxed.Templates/ | |
runs-on: windows-latest | |
steps: | |
- name: "Download Artefact" | |
uses: actions/download-artifact@v3.0.2 | |
with: | |
name: "windows-latest" | |
- name: "Dotnet NuGet Push" | |
run: | | |
Get-ChildItem .\ -Filter *.nupkg | | |
Where-Object { !$_.Name.Contains('preview') } | | |
ForEach-Object { dotnet nuget push $_ --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} } | |
shell: pwsh |