Skip to content

docs(readme): add discord community widget and badges #29

docs(readme): add discord community widget and badges

docs(readme): add discord community widget and badges #29

Workflow file for this run

name: PR Check
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-linux:
name: Build and Test (Linux)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Verify version sync
run: |
chmod +x scripts/sync-version.sh
./scripts/sync-version.sh --check
- name: Verify version sync write idempotency
run: |
VERSION="$(tr -d '\r\n[:space:]' < VERSION)" ./scripts/sync-version.sh --write
git diff --exit-code -- scripts/packaging/arch/PKGBUILD scripts/msix/AppxManifest.xml flatpak/io.github.alper_han.crossmacro.flathub.yml
- name: Validate man page source
run: |
man -l docs/man/crossmacro.1 > /dev/null
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Debug --no-restore
- name: Smoke Publish (Linux)
run: dotnet publish src/CrossMacro.UI.Linux/CrossMacro.UI.Linux.csproj --configuration Debug --no-restore -r linux-x64 --self-contained false -o publish-smoke
- name: CLI Smoke (Linux)
run: |
set -euo pipefail
PROJECT="src/CrossMacro.UI.Linux/CrossMacro.UI.Linux.csproj"
help_output="$(dotnet run --no-build --project "$PROJECT" -- --help 2>&1)"
echo "$help_output"
echo "$help_output" | grep -F "Usage:"
set +e
json_parse_output="$(dotnet run --no-build --project "$PROJECT" -- --json 2>&1)"
json_parse_code=$?
set -e
echo "$json_parse_output"
test "$json_parse_code" -eq 2
echo "$json_parse_output" | grep -F '"status": "error"'
echo "$json_parse_output" | grep -F '"code": 2'
set +e
dry_run_output="$(dotnet run --no-build --project "$PROJECT" -- run --step "move abs 10 10" --dry-run --json 2>&1)"
dry_run_code=$?
set -e
echo "$dry_run_output"
echo "$dry_run_output" | grep -F '"status":'
echo "$dry_run_output" | grep -F "\"code\": $dry_run_code"
- name: CLI Daemon Smoke (Linux, env-gated)
if: ${{ vars.CROSSMACRO_LINUX_DAEMON_SMOKE == '1' }}
run: |
set -euo pipefail
UI_PROJECT="src/CrossMacro.UI.Linux/CrossMacro.UI.Linux.csproj"
DAEMON_PROJECT="src/CrossMacro.Daemon/CrossMacro.Daemon.csproj"
dotnet run --no-build --project "$DAEMON_PROJECT" > daemon-smoke.log 2>&1 &
daemon_pid=$!
cleanup() {
kill "$daemon_pid" 2>/dev/null || true
wait "$daemon_pid" 2>/dev/null || true
}
trap cleanup EXIT
for i in $(seq 1 30); do
if [ -S "/run/crossmacro/crossmacro.sock" ] || [ -S "/tmp/crossmacro.sock" ]; then
break
fi
sleep 1
done
if ! [ -S "/run/crossmacro/crossmacro.sock" ] && ! [ -S "/tmp/crossmacro.sock" ]; then
echo "Daemon socket was not created."
cat daemon-smoke.log || true
exit 1
fi
set +e
doctor_output="$(dotnet run --no-build --project "$UI_PROJECT" -- doctor --json --verbose 2>&1)"
doctor_code=$?
set -e
echo "$doctor_output"
echo "doctor exit code: $doctor_code"
echo "$doctor_output" | grep -F '"name": "linux-daemon-handshake"'
echo "$doctor_output" | grep -F 'Daemon handshake probe succeeded.'
- name: Run Tests (Linux-compatible suites)
run: |
dotnet test tests/CrossMacro.Core.Tests/CrossMacro.Core.Tests.csproj --configuration Debug --no-build --verbosity normal
dotnet test tests/CrossMacro.Cli.Tests/CrossMacro.Cli.Tests.csproj --configuration Debug --no-build --verbosity normal
dotnet test tests/CrossMacro.Daemon.Tests/CrossMacro.Daemon.Tests.csproj --configuration Debug --no-build --verbosity normal
dotnet test tests/CrossMacro.Infrastructure.Tests/CrossMacro.Infrastructure.Tests.csproj --configuration Debug --no-build --verbosity normal
dotnet test tests/CrossMacro.Platform.Linux.Tests/CrossMacro.Platform.Linux.Tests.csproj --configuration Debug --no-build --verbosity normal
dotnet test tests/CrossMacro.UI.Tests/CrossMacro.UI.Tests.csproj --configuration Debug --no-build --verbosity normal
build-windows:
name: Build (Windows)
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Debug --no-restore
- name: Validate MSIX prepare script idempotency
shell: pwsh
run: |
$version = (Get-Content VERSION -Raw).Trim()
$outputDir = Join-Path $env:RUNNER_TEMP "msix-prepare-test"
Remove-Item -LiteralPath $outputDir -Recurse -Force -ErrorAction SilentlyContinue
./scripts/msix/prepare-msix.ps1 -Version $version -OutputDir $outputDir
./scripts/msix/prepare-msix.ps1 -Version $version -OutputDir $outputDir
[xml]$manifest = Get-Content -LiteralPath (Join-Path $outputDir "AppxManifest.xml") -Raw
$namespaceManager = New-Object System.Xml.XmlNamespaceManager($manifest.NameTable)
$namespaceManager.AddNamespace("appx", "http://schemas.microsoft.com/appx/manifest/foundation/windows10")
$identity = $manifest.SelectSingleNode("/appx:Package/appx:Identity", $namespaceManager)
if ($null -eq $identity) {
throw "Prepared manifest does not contain Identity node."
}
if ($identity.Version -ne "$version.0") {
throw "Prepared manifest version '$($identity.Version)' does not match expected '$version.0'."
}
- name: CLI Smoke (Windows)
shell: pwsh
run: |
$project = "src/CrossMacro.UI.Windows/CrossMacro.UI.Windows.csproj"
$helpOutput = (& dotnet run --no-build --project $project -- --help 2>&1 | Out-String)
if (-not ($helpOutput -match "Usage:")) {
throw "Top-level help output does not contain Usage."
}
$jsonParseOutput = (& dotnet run --no-build --project $project -- --json 2>&1 | Out-String)
$jsonParseCode = $LASTEXITCODE
if ($jsonParseCode -ne 2) {
throw "Expected exit code 2 for standalone --json, got $jsonParseCode."
}
if (-not ($jsonParseOutput -match '"status":\s*"error"')) {
throw "Standalone --json output is not JSON error envelope."
}
if (-not ($jsonParseOutput -match '"code":\s*2')) {
throw "Standalone --json output code is not 2."
}
$dryRunOutput = (& dotnet run --no-build --project $project -- run --step "move abs 10 10" --dry-run --json 2>&1 | Out-String)
$dryRunCode = $LASTEXITCODE
if (-not ($dryRunOutput -match '"status":\s*"(ok|error)"')) {
throw "Dry-run output missing JSON status envelope."
}
if (-not ($dryRunOutput -match ('"code":\s*{0}' -f $dryRunCode))) {
throw "Dry-run output code does not match process exit code ($dryRunCode)."
}
- name: Run Tests (Windows-compatible suites)
run: |
dotnet test tests/CrossMacro.Core.Tests/CrossMacro.Core.Tests.csproj --configuration Debug --no-build --verbosity normal
dotnet test tests/CrossMacro.Cli.Tests/CrossMacro.Cli.Tests.csproj --configuration Debug --no-build --verbosity normal
dotnet test tests/CrossMacro.Daemon.Tests/CrossMacro.Daemon.Tests.csproj --configuration Debug --no-build --verbosity normal
dotnet test tests/CrossMacro.Infrastructure.Tests/CrossMacro.Infrastructure.Tests.csproj --configuration Debug --no-build --verbosity normal
dotnet test tests/CrossMacro.Platform.Windows.Tests/CrossMacro.Platform.Windows.Tests.csproj --configuration Debug --no-build --verbosity normal
dotnet test tests/CrossMacro.UI.Tests/CrossMacro.UI.Tests.csproj --configuration Debug --no-build --verbosity normal
build-macos:
name: Build (macOS)
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Debug --no-restore
- name: CLI Smoke (macOS)
run: |
set -euo pipefail
PROJECT="src/CrossMacro.UI.MacOS/CrossMacro.UI.MacOS.csproj"
help_output="$(dotnet run --no-build --project "$PROJECT" -- --help 2>&1)"
echo "$help_output"
echo "$help_output" | grep -F "Usage:"
set +e
json_parse_output="$(dotnet run --no-build --project "$PROJECT" -- --json 2>&1)"
json_parse_code=$?
set -e
echo "$json_parse_output"
test "$json_parse_code" -eq 2
echo "$json_parse_output" | grep -F '"status": "error"'
echo "$json_parse_output" | grep -F '"code": 2'
set +e
dry_run_output="$(dotnet run --no-build --project "$PROJECT" -- run --step "move abs 10 10" --dry-run --json 2>&1)"
dry_run_code=$?
set -e
echo "$dry_run_output"
echo "$dry_run_output" | grep -F '"status":'
echo "$dry_run_output" | grep -F "\"code\": $dry_run_code"
- name: Run Tests (macOS-compatible suites)
run: |
dotnet test tests/CrossMacro.Core.Tests/CrossMacro.Core.Tests.csproj --configuration Debug --no-build --verbosity normal
dotnet test tests/CrossMacro.Cli.Tests/CrossMacro.Cli.Tests.csproj --configuration Debug --no-build --verbosity normal
dotnet test tests/CrossMacro.Daemon.Tests/CrossMacro.Daemon.Tests.csproj --configuration Debug --no-build --verbosity normal
dotnet test tests/CrossMacro.Infrastructure.Tests/CrossMacro.Infrastructure.Tests.csproj --configuration Debug --no-build --verbosity normal
dotnet test tests/CrossMacro.Platform.MacOS.Tests/CrossMacro.Platform.MacOS.Tests.csproj --configuration Debug --no-build --verbosity normal
dotnet test tests/CrossMacro.UI.Tests/CrossMacro.UI.Tests.csproj --configuration Debug --no-build --verbosity normal