Skip to content

Add CSharpier to CI build #838

Add CSharpier to CI build

Add CSharpier to CI build #838

Workflow file for this run

name: ci
on:
push:
branches:
- '*'
tags:
- v*
paths-ignore:
- docs/**
- LICENSE
- '**.md'
pull_request:
branches:
- dev
- main
- v1.0
paths-ignore:
- docs/**
- LICENSE
- '**.md'
jobs:
build:
name: "Build & package"
runs-on: ubuntu-latest
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
- name: Install tools
run: |
dotnet tool restore --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json
- name: Clean
run: |
dotnet clean --configuration Release
dotnet nuget locals all --clear
- name: Restore
run: dotnet restore
- name: Format
run: |
PATH="$PATH:~/.dotnet/tools"
dotnet dotnet-format style --verify-no-changes
dotnet dotnet-format analyzers --verify-no-changes
dotnet dotnet-csharpier . --check
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Install Playwright
run: pwsh ./tests/GovUk.Frontend.AspNetCore.IntegrationTests/bin/Release/net8.0/playwright.ps1 install
- name: Test
run: |
dotnet test tests/GovUk.Frontend.AspNetCore.Tests/ --configuration Release --no-build
dotnet test tests/GovUk.Frontend.AspNetCore.ConformanceTests/ --configuration Release --no-build
dotnet test tests/GovUk.Frontend.AspNetCore.IntegrationTests/ --configuration Release --no-build
- name: Package
run: dotnet pack src/GovUk.Frontend.AspNetCore/ --configuration Release --no-build
env:
MINVERBUILDMETADATA: ${{ env.GITHUB_RUN_NUMBER }}
- name: Publish package artifact
uses: actions/upload-artifact@v4
with:
name: GovUk.Frontend.AspNetCore.nupkg
path: src/GovUk.Frontend.AspNetCore/bin/Release/*.nupkg
release:
name: "Release"
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download package artifact
uses: actions/download-artifact@v4
with:
name: GovUk.Frontend.AspNetCore.nupkg
- name: Publish package to NuGet
run: dotnet nuget push **/*.nupkg --api-key $NUGET_TOKEN --source https://api.nuget.org/v3/index.json --skip-duplicate
env:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}