shoc-backend/.github/workflows/architecture-quality.yml

51 lines
1.2 KiB
YAML

name: Architecture and changed-file quality
on:
pull_request:
branches: [main, dev]
permissions:
contents: read
jobs:
architecture:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Restore
run: dotnet restore SeaHavenIndustries.sln
- name: Verify architecture boundaries
run: >-
dotnet test
Api.SeaHavenIndustries.Tests/Api.SeaHavenIndustries.Tests.csproj
--no-restore
--filter FullyQualifiedName~ArchitectureTests
- name: Verify formatting of changed C# files
shell: bash
run: |
mapfile -t files < <(
git diff --name-only --diff-filter=ACMR \
"${{ github.event.pull_request.base.sha }}" \
"${{ github.event.pull_request.head.sha }}" \
-- '*.cs'
)
if (( ${#files[@]} == 0 )); then
exit 0
fi
dotnet format SeaHavenIndustries.sln \
--no-restore \
--verify-no-changes \
--include "${files[@]}"