mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
149 lines
3.6 KiB
YAML
149 lines
3.6 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main, dev]
|
|
types: [labeled]
|
|
pull_request_review:
|
|
types: [submitted]
|
|
|
|
jobs:
|
|
check-ready:
|
|
name: Check if Ready for CI
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
should-run: ${{ steps.check.outputs.run }}
|
|
steps:
|
|
- name: Check trigger conditions
|
|
id: check
|
|
run: |
|
|
if [[ "${{ github.event_name }}" == "pull_request_review" && "${{ github.event.review.state }}" == "approved" ]]; then
|
|
echo "Triggered by PR approval"
|
|
echo "run=true" >> $GITHUB_OUTPUT
|
|
elif [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.label.name }}" == "ready-for-ci" ]]; then
|
|
echo "Triggered by ready-for-ci label"
|
|
echo "run=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "Conditions not met, skipping CI"
|
|
echo "run=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
lint:
|
|
name: Lint
|
|
needs: check-ready
|
|
if: needs.check-ready.outputs.should-run == 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10.28.1
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "24"
|
|
cache: "pnpm"
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Run linter
|
|
run: pnpm lint
|
|
|
|
typecheck:
|
|
name: Type Check
|
|
needs: check-ready
|
|
if: needs.check-ready.outputs.should-run == 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10.28.1
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "24"
|
|
cache: "pnpm"
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Run type check
|
|
run: pnpm typecheck
|
|
|
|
test:
|
|
name: Test
|
|
needs: check-ready
|
|
if: needs.check-ready.outputs.should-run == 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: oven-sh/setup-bun@v2
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10.28.1
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "24"
|
|
cache: "pnpm"
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Run tests
|
|
run: pnpm test
|
|
|
|
e2e:
|
|
name: E2E
|
|
needs: check-ready
|
|
if: needs.check-ready.outputs.should-run == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: oven-sh/setup-bun@v2
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10.28.1
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "24"
|
|
cache: "pnpm"
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Install OpenCode CLI
|
|
run: |
|
|
source scripts/lib/opencode-release.sh
|
|
download_opencode_to 2.0.24 "$RUNNER_TEMP/opencode/bin/opencode"
|
|
echo "$RUNNER_TEMP/opencode/bin" >> "$GITHUB_PATH"
|
|
|
|
- name: Verify OpenCode CLI
|
|
run: opencode --version
|
|
|
|
- name: Install Playwright browsers
|
|
run: pnpm exec playwright install --with-deps chromium
|
|
|
|
- name: Run end-to-end tests
|
|
run: pnpm test:e2e
|
|
|
|
- name: Upload Playwright artifacts
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-artifacts
|
|
path: |
|
|
playwright-report/
|
|
test-results/
|
|
retention-days: 7
|