|
1 | | -name: Validate content |
| 1 | +name: Validate |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | branches: [main] |
6 | 6 | pull_request: |
7 | 7 |
|
| 8 | +concurrency: |
| 9 | + group: validate-${{ github.workflow }}-${{ github.ref }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
8 | 12 | permissions: |
9 | 13 | contents: read |
10 | 14 |
|
11 | 15 | jobs: |
12 | 16 | validate: |
13 | 17 | runs-on: ubuntu-latest |
| 18 | + timeout-minutes: 10 |
| 19 | + outputs: |
| 20 | + installer_changed: ${{ steps.changes.outputs.installer_changed }} |
14 | 21 | steps: |
15 | 22 | - uses: actions/checkout@v6 |
| 23 | + with: |
| 24 | + fetch-depth: 0 |
| 25 | + - name: Detect installer changes |
| 26 | + id: changes |
| 27 | + env: |
| 28 | + EVENT_NAME: ${{ github.event_name }} |
| 29 | + EVENT_PATH: ${{ github.event_path }} |
| 30 | + run: | |
| 31 | + python3 - <<'PY' |
| 32 | + import json |
| 33 | + import os |
| 34 | + import subprocess |
| 35 | +
|
| 36 | + with open(os.environ["EVENT_PATH"], encoding="utf-8") as handle: |
| 37 | + event = json.load(handle) |
| 38 | + base = ( |
| 39 | + event["pull_request"]["base"]["sha"] |
| 40 | + if os.environ["EVENT_NAME"] == "pull_request" |
| 41 | + else event.get("before", "") |
| 42 | + ) |
| 43 | + installer_paths = { |
| 44 | + ".github/workflows/install-smoke.yml", |
| 45 | + ".github/workflows/validate.yml", |
| 46 | + "package.json", |
| 47 | + "scripts/build_cursor_rules.py", |
| 48 | + "scripts/check_install.py", |
| 49 | + "scripts/cli.js", |
| 50 | + "scripts/install.py", |
| 51 | + "scripts/install.ps1", |
| 52 | + "scripts/install.sh", |
| 53 | + "tests/test_build_cursor_rules.py", |
| 54 | + "tests/test_cli.py", |
| 55 | + "tests/test_install.py", |
| 56 | + } |
| 57 | + changed = True |
| 58 | + if base and set(base) != {"0"}: |
| 59 | + result = subprocess.run( |
| 60 | + ["git", "diff", "--name-only", base, "HEAD"], |
| 61 | + check=True, |
| 62 | + capture_output=True, |
| 63 | + text=True, |
| 64 | + ) |
| 65 | + changed = bool(installer_paths.intersection(result.stdout.splitlines())) |
| 66 | + with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as output: |
| 67 | + output.write(f"installer_changed={str(changed).lower()}\n") |
| 68 | + PY |
16 | 69 | - name: Validate skills and subagents |
17 | 70 | run: python3 scripts/validate_content.py |
18 | 71 | - name: Validate handoff templates |
|
25 | 78 | run: python3 scripts/list_content.py --format markdown |
26 | 79 | - name: Run tests |
27 | 80 | run: python3 -m unittest discover -s tests -v |
| 81 | + bash: |
| 82 | + needs: validate |
| 83 | + if: needs.validate.outputs.installer_changed == 'true' |
| 84 | + runs-on: ubuntu-latest |
| 85 | + timeout-minutes: 5 |
| 86 | + steps: |
| 87 | + - uses: actions/checkout@v6 |
| 88 | + - name: Smoke-test Bash installer |
| 89 | + run: | |
| 90 | + install_test_root="$(mktemp -d)" |
| 91 | + install_test_home="$install_test_root/home" |
| 92 | + install_test_project="$install_test_root/project" |
| 93 | + mkdir -p "$install_test_home" "$install_test_project" |
| 94 | + env HOME="$install_test_home" bash scripts/install.sh "$install_test_project" codex |
| 95 | + python3 scripts/check_install.py \ |
| 96 | + --project "$install_test_project" \ |
| 97 | + --target codex \ |
| 98 | + --mode link |
| 99 | + test ! -e "$install_test_home/.claude" |
| 100 | + test ! -e "$install_test_home/.codex" |
| 101 | +
|
| 102 | + powershell: |
| 103 | + needs: validate |
| 104 | + if: needs.validate.outputs.installer_changed == 'true' |
| 105 | + runs-on: windows-latest |
| 106 | + timeout-minutes: 10 |
| 107 | + steps: |
| 108 | + - uses: actions/checkout@v6 |
| 109 | + - name: Smoke-test PowerShell installer |
| 110 | + shell: powershell |
| 111 | + run: | |
| 112 | + $installTestRoot = Join-Path $env:RUNNER_TEMP "indium-agentkit-install-smoke" |
| 113 | + $installTestHome = Join-Path $installTestRoot "home" |
| 114 | + $installTestProject = Join-Path $installTestRoot "project" |
| 115 | + New-Item -ItemType Directory -Force -Path $installTestHome, $installTestProject | Out-Null |
| 116 | + $originalUserProfile = $env:USERPROFILE |
| 117 | + try { |
| 118 | + $env:USERPROFILE = $installTestHome |
| 119 | + .\scripts\install.ps1 -ProjectDir $installTestProject -TargetIde codex |
| 120 | + python scripts/check_install.py ` |
| 121 | + --project $installTestProject ` |
| 122 | + --target codex ` |
| 123 | + --mode link |
| 124 | + if (Test-Path (Join-Path $installTestHome ".claude")) { throw "unexpected user-scope write" } |
| 125 | + if (Test-Path (Join-Path $installTestHome ".codex")) { throw "unexpected user-scope write" } |
| 126 | + } |
| 127 | + finally { |
| 128 | + $env:USERPROFILE = $originalUserProfile |
| 129 | + } |
0 commit comments