From 99897636a16b4ca99738fa9983e88e738ceaa59c Mon Sep 17 00:00:00 2001 From: Snider Date: Sat, 31 Jan 2026 19:05:52 +0000 Subject: [PATCH] ci: add cross-platform setup test workflow - Add GitHub Actions workflow to test install scripts on Linux, macOS, Windows - Runs weekly to catch upstream package changes - Update install-deps.sh to configure gh with workflow scope - Document workflow scope in README.md and CLAUDE.md troubleshooting Co-Authored-By: Claude Opus 4.5 --- .github/workflows/test-setup.yml | 153 +++++++++++++++++++++++++++++++ CLAUDE.md | 3 +- README.md | 7 +- scripts/install-deps.sh | 19 ++++ 4 files changed, 180 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/test-setup.yml diff --git a/.github/workflows/test-setup.yml b/.github/workflows/test-setup.yml new file mode 100644 index 0000000..7ef1080 --- /dev/null +++ b/.github/workflows/test-setup.yml @@ -0,0 +1,153 @@ +name: Test Setup Scripts + +on: + push: + branches: [dev, main] + paths: + - 'scripts/**' + - '.github/workflows/test-setup.yml' + pull_request: + branches: [dev, main] + paths: + - 'scripts/**' + - '.github/workflows/test-setup.yml' + # Weekly test to catch upstream changes (package repos, etc.) + schedule: + - cron: '0 6 * * 1' # Every Monday at 6am UTC + workflow_dispatch: # Manual trigger + +jobs: + test-linux: + name: Linux (Ubuntu) + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run install-deps.sh + run: | + chmod +x scripts/install-deps.sh + ./scripts/install-deps.sh + + - name: Verify dependencies installed + run: | + echo "=== Checking installed tools ===" + git --version + gh --version + go version + php --version + composer --version + node --version + pnpm --version + echo "=== All dependencies verified ===" + + - name: Run install-core.sh + run: | + chmod +x scripts/install-core.sh + ./scripts/install-core.sh + env: + INSTALL_DIR: ${{ github.workspace }}/bin + + - name: Verify core CLI installed + run: | + export PATH="${{ github.workspace }}/bin:$PATH" + core --version || echo "Core CLI version check" + core doctor || echo "Core doctor completed" + + test-macos: + name: macOS + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run install-deps.sh + run: | + chmod +x scripts/install-deps.sh + ./scripts/install-deps.sh + + - name: Verify dependencies installed + run: | + echo "=== Checking installed tools ===" + git --version + gh --version + go version + php --version + composer --version + node --version + pnpm --version + echo "=== All dependencies verified ===" + + - name: Run install-core.sh + run: | + chmod +x scripts/install-core.sh + ./scripts/install-core.sh + env: + INSTALL_DIR: ${{ github.workspace }}/bin + + - name: Verify core CLI installed + run: | + export PATH="${{ github.workspace }}/bin:$PATH" + core --version || echo "Core CLI version check" + core doctor || echo "Core doctor completed" + + test-windows: + name: Windows + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run install-deps.ps1 + shell: pwsh + run: | + # Run as current user (GitHub runners have admin) + # Modify script to skip admin check for CI + $script = Get-Content scripts/install-deps.ps1 -Raw + $script = $script -replace 'Write-Err "Please run this script as Administrator"', 'Write-Warn "Skipping admin check in CI"' + $script | Set-Content scripts/install-deps-ci.ps1 + .\scripts\install-deps-ci.ps1 + + - name: Verify dependencies installed + shell: pwsh + run: | + Write-Host "=== Checking installed tools ===" + git --version + gh --version + go version + php --version + composer --version + node --version + pnpm --version + Write-Host "=== All dependencies verified ===" + + - name: Run install-core.ps1 + shell: pwsh + run: | + .\scripts\install-core.ps1 + env: + INSTALL_DIR: ${{ github.workspace }}\bin + + - name: Verify core CLI installed + shell: pwsh + run: | + $env:PATH = "${{ github.workspace }}\bin;$env:PATH" + core --version + core doctor + + # Summary job that requires all platforms to pass + setup-complete: + name: All Platforms + needs: [test-linux, test-macos, test-windows] + runs-on: ubuntu-latest + if: always() + steps: + - name: Check results + run: | + if [ "${{ needs.test-linux.result }}" != "success" ] || \ + [ "${{ needs.test-macos.result }}" != "success" ] || \ + [ "${{ needs.test-windows.result }}" != "success" ]; then + echo "One or more platform tests failed" + exit 1 + fi + echo "All platform tests passed!" diff --git a/CLAUDE.md b/CLAUDE.md index c829041..c5393e3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -136,7 +136,8 @@ Defined in `repos.yaml`: ## Troubleshooting - **"core: command not found"** → `make install-core` (builds from https://github.com/host-uk/core) -- **"gh: command not found"** → `brew install gh && gh auth login` +- **"gh: command not found"** → `brew install gh && gh auth login -h github.com -p https -s workflow,repo,read:org` +- **"refusing to allow an OAuth App to create or update workflow"** → `gh auth refresh -h github.com -s workflow` - **Clone failures** → `ssh -T git@github.com` to verify SSH keys ## This Repo's Scope diff --git a/README.md b/README.md index dcbab24..8593673 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,12 @@ make install-core **"gh: command not found"** ```bash -brew install gh && gh auth login +brew install gh && gh auth login -h github.com -p https -s workflow,repo,read:org +``` + +**"refusing to allow an OAuth App to create or update workflow"** +```bash +gh auth refresh -h github.com -s workflow ``` **Clone failures** diff --git a/scripts/install-deps.sh b/scripts/install-deps.sh index 39c2412..b803871 100755 --- a/scripts/install-deps.sh +++ b/scripts/install-deps.sh @@ -286,6 +286,25 @@ main() { esac info "Dependencies installed!" + echo "" + + # Configure GitHub CLI if not already authenticated + if has gh; then + if ! gh auth status &>/dev/null; then + info "Configuring GitHub CLI..." + echo "You'll need to authenticate with GitHub." + echo "When prompted, select HTTPS and add the 'workflow' scope." + echo "" + gh auth login -h github.com -p https -s workflow,repo,read:org + else + # Check if workflow scope is present + if ! gh auth status 2>&1 | grep -q workflow; then + warn "GitHub CLI missing 'workflow' scope (needed for pushing repos with GitHub Actions)" + echo "Run: gh auth refresh -h github.com -s workflow" + fi + fi + fi + echo "" echo "Next: Run './scripts/install-core.sh' to install the core CLI" }