Skip to content

Upgrade to net10

Upgrade to net10 #296

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET Build and Deploy
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
ci: # .NET CI: build, test, check formatting, generate docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -warnaserror
- name: Unit tests
run: dotnet test ./tests/RefDocGen.UnitTests --no-build --verbosity normal
- name: Integration tests
run: dotnet test ./tests/RefDocGen.IntegrationTests --no-build --verbosity normal
- name: Check formatting
run: dotnet format style --verify-no-changes --exclude tests/RefDocGen.ExampleLibrary tests/RefDocGen.ExampleFSharpLibrary tests/RefDocGen.ExampleVbLibrary # exclude test libraries
- name: Generate reference docs of 'RefDocGen' project
run: dotnet run --project ./src/RefDocGen/ -- refdocgen.yaml
- name: Upload reference docs of 'RefDocGen' project
uses: actions/upload-artifact@v4
with:
name: refdocgen-docs
path: ./reference-docs
- name: Generate reference docs for e2e tests
run: |
dotnet run --project ./src/RefDocGen/ -- tests/RefDocGen.ExampleLibrary/RefDocGen.ExampleLibrary.csproj \
--static-pages-dir tests/RefDocGen.ExampleLibrary/static-pages --doc-version v1.0 -o e2e-tests-docs
dotnet run --project ./src/RefDocGen/ -- tests/RefDocGen.ExampleLibrary/RefDocGen.ExampleLibrary.csproj \
--static-pages-dir tests/RefDocGen.ExampleLibrary/static-pages --doc-version v1.1 -o e2e-tests-docs
- name: Upload reference docs for e2e tests
uses: actions/upload-artifact@v4
with:
name: e2e-tests-docs
path: ./e2e-tests-docs
e2e-tests: # Run end-to-end tests using Playwright
needs: ci
timeout-minutes: 10
runs-on: ubuntu-latest
defaults:
run:
working-directory: tests/RefDocGen.EndToEndTests
env:
BASE_URL: http://127.0.0.1:3000 # set the env variable
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version-file: tests/RefDocGen.EndToEndTests/.node-version
- name: Download the reference docs artifact
uses: actions/download-artifact@v5
with:
name: e2e-tests-docs
path: tests/RefDocGen.EndToEndTests/e2e-tests-docs
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Start HTTP server
run: npx http-server e2e-tests-docs -p 3000 &
- name: Run Playwright tests
run: npx playwright test --reporter=list
# - uses: actions/upload-artifact@v4
# if: ${{ !cancelled() }}
# with:
# name: playwright-report
# path: playwright-report/
# retention-days: 30
deploy: # Deploy the documentation to GitHub Pages (only from master branch)
needs: ci
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# only deploy from master on push events
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
steps:
- name: Download the reference docs artifact
uses: actions/download-artifact@v5
with:
name: refdocgen-docs
path: ./reference-docs
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./reference-docs
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4