Skip to content

KX-11806 - Create a GH test pipeline #31

KX-11806 - Create a GH test pipeline

KX-11806 - Create a GH test pipeline #31

Workflow file for this run

name: "CI: Build validation"
env:
working-directory: ./src
on:
push:
branches: [main]
paths:
- "**.cs"
- "**.tsx"
- "**.js"
- "**.csproj"
- "**.props"
- "**.targets"
- "**.sln"
- "**/Client/**/*.json"
- "**/ci.yml"
pull_request:
branches: [main]
paths:
- "**.cs"
- "**.tsx"
- "**.js"
- "**.csproj"
- "**.props"
- "**.targets"
- "**.sln"
- "**/Client/**/*.json"
- "**/ci.yml"
jobs:
dotnet-format:
name: Code Style Validation
runs-on: ubuntu-latest
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
run: |
$CHANGED_FILES = (git diff --name-only ${{ github.event.before }} ${{ github.sha }}) -replace '\n',' '
echo "CHANGED_FILES=$CHANGED_FILES" | Out-File -FilePath $Env:GITHUB_ENV -Append
- name: Run dotnet format
run: |
$files = $Env:CHANGED_FILES -split ' '
if ($files.Length -eq 0) {
Write-Host "No relevant files have changed."
} else {
dotnet format --include $files
}
build-and-test:
name: Build and test
runs-on: windows-latest
defaults:
run:
shell: pwsh
working-directory: ${{ env.working-directory }}
steps:
- uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Restore Packages
run: nuget restore WebApp.sln
- name: Build Solution
run: msbuild.exe WebApp.sln /p:platform="Any CPU" /p:configuration="Release"
- name: Test Solution
run: dotnet test Kentico.Xperience.OpenAI.Azure.Tests\bin\Release\net48\Kentico.Xperience.OpenAI.Azure.Tests.dll