LANCommander/.github/workflows/LANCommander.PR.yml
Pat Hartl 97c899f6f2 Generate PowerShell completions in ui_tests CI job
The Monaco editor's PowerShellCompletions.g.ts is gitignored and required
by the frontend webpack build. The in-build MSBuild target uses Windows
path separators that don't resolve on the Linux runner, so the ui_tests
job must generate the file explicitly first — mirroring the server build
jobs which already do this.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-23 22:26:42 -05:00

229 lines
8.8 KiB
YAML

name: LANCommander Pull Request
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch:
permissions:
contents: write
packages: read
checks: write
pull-requests: write
jobs:
prep:
runs-on: ubuntu-latest
outputs:
version_semver: ${{ steps.set_version.outputs.version_semver }}
version_tag: ${{ steps.set_version.outputs.version_tag }}
build_dotnet_version: 9.0.102
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine build metadata
id: set_version
shell: bash
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
RUN_NUMBER: ${{ github.run_number }}
run: |
TIMESTAMP=$(date -u +"%Y%m%d%H%M")
TIME_COMPONENT=$(date -u +"%H%M")
TIME_COMPONENT=$((10#$TIME_COMPONENT))
if [ -n "$PR_NUMBER" ]; then
BUILD_COMPONENT=$((PR_NUMBER % 65535))
if [ "$BUILD_COMPONENT" -eq 0 ]; then
BUILD_COMPONENT=1
fi
VERSION_SEMVER="0.0.${BUILD_COMPONENT}.${TIME_COMPONENT}"
VERSION_TAG="0.0.${BUILD_COMPONENT}-pr.${PR_NUMBER}.${TIMESTAMP}"
else
BUILD_COMPONENT=$((RUN_NUMBER % 65535))
if [ "$BUILD_COMPONENT" -eq 0 ]; then
BUILD_COMPONENT=1
fi
VERSION_SEMVER="0.0.${BUILD_COMPONENT}.${TIME_COMPONENT}"
VERSION_TAG="0.0.${BUILD_COMPONENT}-ci.${RUN_NUMBER}.${TIMESTAMP}"
fi
echo "version_semver=$VERSION_SEMVER" >> $GITHUB_OUTPUT
echo "version_tag=$VERSION_TAG" >> $GITHUB_OUTPUT
ui_tests:
needs: [prep]
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ needs.prep.outputs.build_dotnet_version }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Node packages
run: |
npm install --prefix ./LANCommander.UI
npm install --prefix ./LANCommander.Server
# The Monaco editor's PowerShell completions are generated (gitignored) and
# required by the frontend webpack build. The in-build MSBuild target uses
# Windows-style paths, so generate explicitly here for the Linux runner.
- name: Generate PowerShell Completions
run: dotnet run --project ./LANCommander.CompletionGenerator/LANCommander.CompletionGenerator.csproj -- ./LANCommander.UI/Components/MonacoCodeEditor/PowerShellCompletions.g.ts
- name: Restore dependencies
run: dotnet restore LANCommander.Server.UI.Tests
- name: Build test project
run: dotnet build LANCommander.Server.UI.Tests --no-restore --configuration Release
- name: Install Playwright browsers
run: pwsh LANCommander.Server.UI.Tests/bin/Release/net10.0/playwright.ps1 install --with-deps chromium
- name: Run UI tests
run: dotnet test LANCommander.Server.UI.Tests --no-build --configuration Release --logger "trx;LogFileName=ui-test-results.trx" --results-directory ./TestResults
env:
SCREENSHOT_DIR: ${{ github.workspace }}/TestResults/Screenshots
- name: Test report
if: always()
uses: dorny/test-reporter@v1
with:
name: UI Test Results
path: ./TestResults/ui-test-results.trx
reporter: dotnet-trx
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: ui-test-results
path: ./TestResults
retention-days: 7
build_server_linux_arm64:
needs: [prep]
uses: ./.github/workflows/LANCommander.Server.yml
with:
build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }}
version_semver: ${{ needs.prep.outputs.version_semver }}
version_tag: ${{ needs.prep.outputs.version_tag }}
build_runtime: linux-arm64
build_arch: arm64
build_platform: Linux
build_configuration: Debug
build_server_linux_x64:
needs: [prep]
uses: ./.github/workflows/LANCommander.Server.yml
with:
build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }}
version_semver: ${{ needs.prep.outputs.version_semver }}
version_tag: ${{ needs.prep.outputs.version_tag }}
build_runtime: linux-x64
build_arch: x64
build_platform: Linux
build_configuration: Debug
build_server_osx_arm64:
needs: [prep]
uses: ./.github/workflows/LANCommander.Server.yml
with:
build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }}
version_semver: ${{ needs.prep.outputs.version_semver }}
version_tag: ${{ needs.prep.outputs.version_tag }}
build_runtime: osx-arm64
build_arch: arm64
build_platform: macOS
build_configuration: Debug
build_server_osx_x64:
needs: [prep]
uses: ./.github/workflows/LANCommander.Server.yml
with:
build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }}
version_semver: ${{ needs.prep.outputs.version_semver }}
version_tag: ${{ needs.prep.outputs.version_tag }}
build_runtime: osx-x64
build_arch: x64
build_platform: macOS
build_configuration: Debug
build_server_win_arm64:
needs: [prep]
uses: ./.github/workflows/LANCommander.Server.yml
with:
build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }}
version_semver: ${{ needs.prep.outputs.version_semver }}
version_tag: ${{ needs.prep.outputs.version_tag }}
build_runtime: win-arm64
build_arch: arm64
build_platform: Windows
build_configuration: Debug
build_server_win_x64:
needs: [prep]
uses: ./.github/workflows/LANCommander.Server.yml
with:
build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }}
version_semver: ${{ needs.prep.outputs.version_semver }}
version_tag: ${{ needs.prep.outputs.version_tag }}
build_runtime: win-x64
build_arch: x64
build_platform: Windows
build_configuration: Debug
build_launcher_linux_x64:
needs: [prep]
uses: ./.github/workflows/LANCommander.Launcher.yml
with:
build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }}
version_semver: ${{ needs.prep.outputs.version_semver }}
version_tag: ${{ needs.prep.outputs.version_tag }}
build_runtime: linux-x64
build_arch: x64
build_platform: Linux
build_configuration: Debug
build_launcher_win_x64:
needs: [prep]
uses: ./.github/workflows/LANCommander.Launcher.yml
with:
build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }}
version_semver: ${{ needs.prep.outputs.version_semver }}
version_tag: ${{ needs.prep.outputs.version_tag }}
build_runtime: win-x64
build_arch: x64
build_platform: Windows
build_configuration: Debug
launcher_tests:
needs: [prep]
uses: ./.github/workflows/LANCommander.Launcher.Tests.yml
with:
build_dotnet_version: ${{ needs.prep.outputs.build_dotnet_version }}
launcher_tests_pr_comment:
# Always run after the test job — even on failure — so visual regressions
# show up as a PR comment instead of being buried in the artifact.
needs: [launcher_tests]
if: always() && needs.launcher_tests.result != 'cancelled' && github.event.pull_request.number != null
uses: ./.github/workflows/LANCommander.Launcher.Tests.PRComment.yml
with:
pr_number: ${{ github.event.pull_request.number }}
artifact_run_id: ${{ github.run_id }}