fix #13
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: | |
- '**' | |
# paths: | |
# - 'src/**' | |
permissions: | |
actions: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: build-${{ github.head_ref || github.ref }} | |
cancel-in-progress: false | |
env: | |
dotnet-sdk-version: '9.x' | |
build-configuration: 'Release' | |
build-platform: 'Any CPU' | |
git-version: '6.0.x' | |
test-result-directory: 'test-results' | |
nuget-packages-directory: 'nuget-packages' | |
jobs: | |
global-variables: | |
name: 'Global variables' | |
runs-on: ubuntu-latest | |
outputs: | |
github-run-id: ${{ github.run_id }} | |
github-run-number: ${{ github.run_number }} | |
is-release: ${{ startsWith(github.ref_name, 'release') }} | |
is-preview: ${{ startsWith(github.ref_name, 'preview') }} | |
steps: | |
- name: 'Global variables' | |
id: github | |
run: | | |
echo "github-run-id:${{ github.run_id }}" | |
echo "github-run-number:${{ github.run_number }}" | |
echo "is-release:${{ startsWith(github.ref_name, 'release') }}" | |
echo "is-preview:${{ startsWith(github.ref_name, 'preview') }}" | |
versioning: | |
name: Versioning with GitVersion | |
needs: [global-variables] | |
uses: ./.github/workflows/determine-version.yml | |
with: | |
config-file-path: './.gitversion/version.yml' | |
run-number: ${{ needs.global-variables.outputs.github-run-number }} | |
build: | |
name: Build with .NET | |
needs: [versioning] | |
runs-on: ubuntu-latest | |
env: | |
assembly-version: ${{ needs.versioning.outputs.assembly-version }} | |
assembly-informational-version: ${{ needs.versioning.outputs.assembly-informational-version }} | |
file-version: ${{ needs.versioning.outputs.file-version }} | |
steps: | |
- name: 'Checkout ${{ github.head_ref || github.ref }}' | |
uses: actions/checkout@v4 | |
- uses: ./.github/actions/build | |
with: | |
assembly-version: ${{ env.assembly-version }} | |
assembly-informational-version: ${{ env.assembly-informational-version }} | |
file-version: ${{ env.file-version }} | |
treat-warnins-as-error: ${{ env.is-release }} | |
search-glob-pattern: ${{ vars.SRC_DEFAULT_GLOB_PATTERN }} | |
test: | |
name: Test with .NET | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout ${{ github.head_ref || github.ref }}' | |
uses: actions/checkout@v4 | |
- name: 'Setup .NET' | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.dotnet-sdk-version }} | |
- uses: ./.github/actions/test | |
with: | |
test-project-glob-pattern: ${{ vars.TEST_DEFAULT_GLOB_PATTERN }} | |
test-results-directory: '${{ runner.temp }}/${{ env.test-result-directory }}/' | |
code-coverage-settings-file: '${{ github.workspace}}/code-coverage-settings.xml' | |
- uses: ./.github/actions/test-report | |
id: test-report | |
with: | |
test-result-folder: '${{ runner.temp }}/${{ env.test-result-directory }}/' | |
- name: Write test report summary | |
run: cat ${{ steps.test-report.outputs.test-report-file }} >> $GITHUB_STEP_SUMMARY | |
- uses: ./.github/actions/code-coverage | |
id: code-coverage-report | |
with: | |
test-result-folder: '${{ runner.temp }}/${{ env.test-result-directory }}/' | |
- name: Write code coverage report summary | |
run: cat ${{ steps.code-coverage-report.outputs.code-coverage-report-file }} >> $GITHUB_STEP_SUMMARY | |
pack: | |
name: Pack with .NET | |
needs: [versioning, build] | |
runs-on: ubuntu-latest | |
env: | |
assembly-version: ${{ needs.versioning.outputs.assembly-version }} | |
assembly-informational-version: ${{ needs.versioning.outputs.assembly-informational-version }} | |
file-version: ${{ needs.versioning.outputs.file-version }} | |
package-version: ${{ needs.versioning.outputs.package-version }} | |
package-artifact-name: package | |
outputs: | |
package-artifact-name: ${{ env.package-artifact-name }} | |
steps: | |
- name: 'Checkout ${{ github.head_ref || github.ref }}' | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.dotnet-sdk-version }} | |
- name: Download Build | |
uses: actions/download-artifact@v4 | |
with: | |
name: build | |
- name: Pack with .NET | |
run: | | |
dotnet pack ${{ vars.SRC_DEFAULT_GLOB_PATTERN }} --configuration ${{ env.build-configuration }} /p:Platform="${{ env.build-platform }}" /p:PackageVersion=${{ env.package-version }} /p:Version=${{ env.assembly-version }} /p:AssemblyInformationalVersion=${{ env.assembly-informational-version }} /p:FileVersion=${{ env.file-version }} --output ${{ runner.temp }}/${{ env.nuget-packages-directory }} | |
- name: Upload Package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.package-artifact-name }} | |
path: | | |
${{ runner.temp }}/${{ env.nuget-packages-directory }}/**/*.nupkg | |
${{ runner.temp }}/${{ env.nuget-packages-directory }}/**/*.snupkg | |
publish-dev-package: | |
name: 'Publish' | |
uses: ./.github/workflows/release-nuget-package.yml | |
needs: [global-variables, pack] | |
secrets: inherit | |
with: | |
artifact-run-id: ${{ needs.global-variables.outputs.github-run-id }} | |
artifact-name: ${{ needs.pack.outputs.package-artifact-name }} | |
nuget-feed-server: 'AzureArtifacts' | |
environment: 'Development' | |
publish-production-package: | |
if: ${{ needs.global-variables.outputs.is-release == 'true' || needs.global-variables.outputs.is-preview == 'true' }} | |
name: 'Publish' | |
uses: ./.github/workflows/release-nuget-package.yml | |
needs: [global-variables, pack] | |
secrets: inherit | |
with: | |
artifact-run-id: ${{ needs.global-variables.outputs.github-run-id }} | |
artifact-name: ${{ needs.pack.outputs.package-artifact-name }} | |
nuget-feed-server: 'NuGet' | |
environment: 'NuGet' | |
# benchmark: | |
# if: ${{ github.env.is_release || vars.BENCHMARKDOTNET_RUN_OVERRIDE == 'true' }} | |
# name: Benchmark with .NET CLI on ${{ matrix.os }} | |
# needs: [build] | |
# strategy: | |
# matrix: | |
# os: [ubuntu-latest, windows-latest, macos-latest] | |
# runs-on: ${{ matrix.os }} | |
# steps: | |
# - name: 'Checkout ${{ github.head_ref || github.ref }}' | |
# uses: actions/checkout@v4 | |
# - name: Install .NET SDK | |
# uses: actions/setup-dotnet@v4 | |
# with: | |
# dotnet-version: | | |
# 6.x | |
# 8.x | |
# 9.x | |
# - name: Download Build | |
# uses: actions/download-artifact@v4 | |
# with: | |
# name: build | |
# - name: Benchmark | |
# working-directory: ${{ vars.BENCHMARKDOTNET_WORKING_DIRECTORY }} | |
# run: dotnet run --configuration ${{ env.build-configuration }} /p:Platform=${{ env.build-platform }} --framework ${{ vars.DEFAULT_BUILD_FRAMEWORK }} --runtimes ${{ vars.BENCHMARKDOTNET_RUNTIMES }} --filter ${{ vars.BENCHMARKDOTNET_FILTER }} --exporters GitHub --memory --artifacts ${{ runner.temp }}/benchmarks/ --join | |
# - name: Upload Benchmark Results | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: benchmark-${{ matrix.os }} | |
# path: | | |
# ${{ runner.temp }}/benchmarks/**/*-report-github.md | |
# - name: Write Benchmark Summary | |
# shell: bash | |
# run: cat **/*-report-github.md > $GITHUB_STEP_SUMMARY | |
# working-directory: ${{ runner.temp }}/benchmarks/ | |
# publish-docs: | |
# if: ${{ github.env.is_release && !github.env.is_preview }} | |
# name: Docs with docfx | |
# needs: [benchmark, test] | |
# environment: | |
# name: github-pages | |
# url: ${{ steps.deployment.outputs.page_url }} | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: 'Checkout ${{ github.head_ref || github.ref }}' | |
# uses: actions/checkout@v4 | |
# - name: Dotnet Setup | |
# uses: actions/setup-dotnet@v4 | |
# with: | |
# dotnet-version: ${{ env.dotnet-sdk-version }} | |
# - name: Download Benchmarks | |
# uses: actions/download-artifact@v4 | |
# with: | |
# pattern: benchmark-* | |
# path: ${{ runner.temp }}/benchmarks/ | |
# merge-multiple: false | |
# - run: | | |
# echo -e '\n## Windows' >> ${{ github.workspace}}/docfx/benchmarks/index.md | |
# cat benchmark-windows-latest/**/*.md >> ${{ github.workspace}}/docfx/benchmarks/index.md | |
# echo -e '\n## Linux' >> ${{ github.workspace}}/docfx/benchmarks/index.md | |
# cat benchmark-ubuntu-latest/**/*.md >> ${{ github.workspace}}/docfx/benchmarks/index.md | |
# echo -e '\n## macOS' >> ${{ github.workspace}}/docfx/benchmarks/index.md | |
# cat benchmark-macos-latest/**/*.md >> ${{ github.workspace}}/docfx/benchmarks/index.md | |
# working-directory: ${{ runner.temp }}/benchmarks/ | |
# - run: dotnet tool update -g docfx | |
# - run: docfx ./docfx/docfx.json | |
# - name: Upload artifact | |
# uses: actions/upload-pages-artifact@v4 | |
# with: | |
# path: './docs' | |
# - name: Deploy to GitHub Pages | |
# id: deployment | |
# uses: actions/deploy-pages@v4 | |
# publish-package-internal: | |
# if: ${{ !github.env.is_release }} | |
# name: Publish package with .NET CLI | |
# needs: [pack] | |
# environment: | |
# name: private-nuget-feed | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: 'Checkout ${{ github.head_ref || github.ref }}' | |
# uses: actions/checkout@v4 | |
# - name: Dotnet Setup | |
# uses: actions/setup-dotnet@v4 | |
# with: | |
# dotnet-version: ${{ env.dotnet-sdk-version }} | |
# - name: Download Packages | |
# uses: actions/download-artifact@v4 | |
# with: | |
# name: package | |
# path: ${{ runner.temp }}/packages/ | |
# - run: | | |
# dotnet nuget add source ${{ secrets.PRIVATE_NUGET_PACKAGE_FEED_URL }} --name private-feed --username username --password ${{ secrets.PRIVATE_NUGET_PACKAGE_FEED_API_KEY }} --store-password-in-clear-text | |
# dotnet nuget push **/*.nupkg --source private-feed --api-key ${{ secrets.PRIVATE_NUGET_PACKAGE_FEED_API_KEY }} | |
# working-directory: ${{ runner.temp }}/packages/ | |
# release-package: | |
# if: ${{ github.env.is_release }} | |
# name: Release package with .NET CLI | |
# needs: [pack, test] | |
# environment: | |
# name: public-nuget-feed | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: 'Checkout ${{ github.head_ref || github.ref }}' | |
# uses: actions/checkout@v4 | |
# - name: Dotnet Setup | |
# uses: actions/setup-dotnet@v4 | |
# with: | |
# dotnet-version: ${{ env.dotnet-sdk-version }} | |
# - name: Download Packages | |
# uses: actions/download-artifact@v4 | |
# with: | |
# name: package | |
# path: ${{ runner.temp }}/packages/ | |
# - run: | | |
# dotnet nuget push **/*.nupkg --source ${{ vars.PUBLIC_NUGET_PACKAGE_FEED_URL }} --api-key ${{ secrets.PUBLIC_NUGET_PACKAGE_FEED_API_KEY }} | |
# working-directory: ${{ runner.temp }}/packages/ |