Skip to content

fix: Keep dynamic code valid in Windows PowerShell 5.1 #3178

fix: Keep dynamic code valid in Windows PowerShell 5.1

fix: Keep dynamic code valid in Windows PowerShell 5.1 #3178

Workflow file for this run

name: Build and Test Unity CLI Loop
on:
push:
tags: ["v*", "uloop-project-runner-v*", "dispatcher-v*"]
pull_request:
branches: [main, v3-beta]
workflow_dispatch:
permissions:
contents: read
jobs:
build-cli:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
pull-requests: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c
with:
go-version-file: cli/.go-version
cache: false
- name: Test release automation shell helpers
run: |
sh -n cli/dispatcher/internal/install/scripts/install_darwin.sh
sh -n cli/dispatcher/internal/uninstall/scripts/uninstall_darwin.sh
scripts/test-go-cli-toolchain.sh
scripts/test-resolve-native-cli-release-target.sh
scripts/test-resolve-dispatcher-release-target.sh
scripts/test-is-release-please-release-commit.sh
scripts/test-release-please-config.sh
scripts/test-protocol-minimum-version-workflow.sh
scripts/test-security-scan-workflow.sh
scripts/test-verify-native-cli-release-assets.sh
scripts/test-verify-dispatcher-release-assets.sh
scripts/test-mark-release-pr-tagged.sh
scripts/test-sync-published-release-pr-labels.sh
scripts/test-sync-release-please-package-releases.sh
scripts/test-notify-release-workflow-failure.sh
scripts/test-native-cli-publish-workflow.sh
scripts/test-dispatcher-publish-workflow.sh
scripts/test-distribute-attestation-bundles.sh
scripts/test-install-release-filter.sh
scripts/test-bootstrap-manifest-from-bundle.sh
- name: Check IPC protocol reminder
if: github.event_name == 'pull_request'
working-directory: cli/release-automation
run: go run ./cmd/check-ipc-protocol-reminder --base "origin/${{ github.base_ref }}" --head HEAD
- name: Check protocol minimum version bump
if: github.event_name == 'pull_request' && !(startsWith(github.head_ref, 'release-please--branches--') && (github.event.pull_request.user.login == 'github-actions[bot]' || github.event.pull_request.user.login == 'release-please[bot]'))
working-directory: cli/release-automation
env:
GH_TOKEN: ${{ github.token }}
run: go run ./cmd/check-protocol-minimum-version --base "origin/${{ github.base_ref }}" --head HEAD
- name: Check dispatcher minimum version
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
working-directory: cli/release-automation
run: go run ./cmd/check-dispatcher-minimum-version
- name: Check dispatcher pin
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
working-directory: cli/release-automation
run: go run ./cmd/check-dispatcher-pin
- name: Verify published dispatcher pin subjects
if: github.event_name == 'pull_request'
working-directory: cli/release-automation
env:
GITHUB_TOKEN: ${{ github.token }}
run: go run ./cmd/check-dispatcher-pin --base "origin/${{ github.base_ref }}" --head HEAD
- name: Verify published dispatcher pin subjects without a pull request diff
if: github.event_name != 'pull_request'
working-directory: cli/release-automation
env:
GITHUB_TOKEN: ${{ github.token }}
run: go run ./cmd/check-dispatcher-pin --network
- name: Check release triggers
if: github.event_name == 'pull_request'
working-directory: cli/release-automation
run: go run ./cmd/check-release-triggers --base "origin/${{ github.base_ref }}" --head HEAD
- name: Install golangci-lint
run: |
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.0
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
- name: Check native Go CLI
run: scripts/check-go-cli.sh
- name: Package native Go CLI installers
run: scripts/package-go-cli.sh
test-windows-installers:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c
with:
go-version-file: cli/.go-version
cache: false
# Windows-only code paths (named pipe transport, winio deadlines, typed error
# classification, process management) are otherwise never executed by CI.
# Runs every go.work module: the formerly Windows-incompatible tests (POSIX-only
# fake executables, TCP-only fixtures, shell-script git/gh mocks) now install
# portable fixtures on Windows.
- name: Test native Go CLI on Windows
shell: bash
run: |
for module in common dispatcher project-runner release-automation; do
(cd "cli/$module" && go test ./...)
done
- name: Test install release filter in Git Bash
shell: bash
run: sh scripts/test-install-release-filter.sh
- name: Parse PowerShell installer in Windows PowerShell
shell: powershell
run: |
$null = [scriptblock]::Create((Get-Content -Raw -Encoding UTF8 cli/dispatcher/internal/install/scripts/install_windows.ps1))
$null = [scriptblock]::Create((Get-Content -Raw -Encoding UTF8 cli/dispatcher/internal/uninstall/scripts/uninstall_windows_delete.ps1))
$null = [scriptblock]::Create((Get-Content -Raw -Encoding UTF8 cli/dispatcher/internal/uninstall/scripts/uninstall_windows_launch.ps1))
$null = [scriptblock]::Create((Get-Content -Raw -Encoding UTF8 scripts/install.ps1))
$null = [scriptblock]::Create((Get-Content -Raw -Encoding UTF8 scripts/check-release-installer.ps1))
$null = [scriptblock]::Create((Get-Content -Raw -Encoding UTF8 scripts/test-check-release-installer.ps1))
$null = [scriptblock]::Create((Get-Content -Raw -Encoding UTF8 scripts/run-windows-e2e.ps1))
$null = [scriptblock]::Create((Get-Content -Raw -Encoding UTF8 scripts/test-simulate-mouse-demo.ps1))
$null = [scriptblock]::Create((Get-Content -Raw -Encoding UTF8 Assets/Tests/Demo/scripts/verify-replay-via-cli.ps1))
$null = [scriptblock]::Create((Get-Content -Raw -Encoding UTF8 scripts/test-powershell51-native-argument-escaping.ps1))
- name: Test release installer smoke helper
shell: powershell
run: .\scripts\test-check-release-installer.ps1
- name: Test Windows PowerShell native argument escaping
shell: powershell
run: .\scripts\test-powershell51-native-argument-escaping.ps1
test-unity-package:
runs-on: ubuntu-latest
needs: build-cli
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Validate Unity Package structure
run: |
echo "Validating Unity Package structure..."
test -f "Packages/src/package.json" || exit 1
test -d "Packages/src/Editor" || exit 1
test ! -d "Packages/src/Cli~" || exit 1
test -d "Packages/src/Editor/CliOnlyTools~" || exit 1
test -d "cli/project-runner" || exit 1
test -f "cli/project-runner/go.mod" || exit 1
test -d "cli/project-runner/cmd" || exit 1
test -d "cli/project-runner/internal" || exit 1
echo "✅ Unity Package structure is valid"
- name: Validate package.json
working-directory: Packages/src
run: |
echo "Validating package.json syntax..."
jq empty package.json
echo "✅ package.json is valid"