57 lines
1.5 KiB
YAML
57 lines
1.5 KiB
YAML
name: API Pull Request
|
|
defaults:
|
|
run:
|
|
working-directory: ./src
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
paths:
|
|
- src/AltGen.API/**
|
|
- src/AltGen.API.Tests/**
|
|
branches:
|
|
- main
|
|
jobs:
|
|
format:
|
|
name: Run dotnet format
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: 9.x.x
|
|
- name: Format project
|
|
run: dotnet format --verbosity normal
|
|
- name: Commit Changes
|
|
run: |
|
|
git config user.name "GitHub Actions"
|
|
git config user.email "<>"
|
|
if [[ $(git status --porcelain) ]]; then
|
|
git add .
|
|
git commit -m "chore: format fixes [skip ci]"
|
|
git fetch origin
|
|
git pull --rebase origin ${{ github.head_ref }}
|
|
git push origin HEAD:${{ github.head_ref }}
|
|
fi
|
|
build_and_test:
|
|
name: Run tests
|
|
needs: format
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: 9.x.x
|
|
- name: Restore dependencies
|
|
run: dotnet restore
|
|
- name: Build project
|
|
run: dotnet build --no-restore
|
|
- name: Test project
|
|
run: dotnet test --filter FullyQualifiedName!~PromptEvaluation
|
|
|