Add DocFX #83
Workflow file for this run
This file contains hidden or 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 and Test | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: windows-latest | |
timeout-minutes: 10 | |
outputs: | |
VERSION: ${{ steps.get_version.outputs.VERSION }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Set version | |
id: get_version | |
shell: pwsh | |
run: | | |
$TAG = if ($env:GITHUB_REF -like "refs/tags/v*") { | |
$env:GITHUB_REF -replace 'refs/tags/v', '' | |
} else { | |
"" | |
} | |
if ($TAG -ne "") { | |
$VERSION = $TAG | |
} else { | |
# Fallback to commit hash if no tag | |
$COMMIT_HASH = git rev-parse --short HEAD | |
$VERSION = "0.0.1-$COMMIT_HASH" | |
} | |
Write-Output "::set-output name=VERSION::$VERSION" | |
- name: Build AggregateConfigBuildTask solution in Release mode | |
run: dotnet build src/AggregateConfigBuildTask.sln --configuration Release -warnaserror -p:Version=${{ steps.get_version.outputs.VERSION }} | |
- name: Run tests for AggregateConfigBuildTask solution | |
run: dotnet test src/AggregateConfigBuildTask.sln --configuration Release -warnaserror -p:Version=${{ steps.get_version.outputs.VERSION }} -p:CollectCoverage=true | |
- name: Upload NuGetPackage artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: NuGetPackage | |
path: | | |
src/Task/bin/Release/AggregateConfigBuildTask.${{ steps.get_version.outputs.VERSION }}.nupkg | |
src/Task/bin/Release/AggregateConfigBuildTask.${{ steps.get_version.outputs.VERSION }}.snupkg | |
- name: Setup DocFX | |
uses: crazy-max/ghaction-chocolatey@v1 | |
with: | |
args: install docfx | |
- name: Build documentation | |
run: docfx docfx.json | |
- name: Upload documentation | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Documentation | |
path: | | |
_site/ | |
integration_tests: | |
needs: build | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Download NuGetPackage artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: NuGetPackage | |
path: ./nuget/local | |
- name: Add local NuGet source | |
run: dotnet nuget add source ${{ github.workspace }}/nuget/local --name AggregateConfigBuildTask | |
- name: Build IntegrationTests in Release mode | |
run: dotnet build test/IntegrationTests.sln --configuration Release -warnaserror -p:Version=${{ needs.build.outputs.VERSION }} | |
- name: Run IntegrationTests | |
run: dotnet test test/IntegrationTests.sln --configuration Release -warnaserror -p:Version=${{ needs.build.outputs.VERSION }} -p:CollectCoverage=true | |
- name: Upload integration results artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: IntegrationTestResults-${{ matrix.os }} | |
path: test/IntegrationTests/out/ |