ci: add concurrency groups to cancel superseded PR runs (#54) #100
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Monorepo CI | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [master] | |
| paths: | |
| - "engine/**" | |
| - "desktop/**" | |
| - "website/**" | |
| - "orchestration/**" | |
| - "vscode-extension/**" | |
| - ".github/workflows/monorepo-ci.yml" | |
| pull_request: | |
| branches: [master] | |
| paths: | |
| - "engine/**" | |
| - "desktop/**" | |
| - "website/**" | |
| - "orchestration/**" | |
| - "vscode-extension/**" | |
| - ".github/workflows/monorepo-ci.yml" | |
| concurrency: | |
| group: monorepo-ci-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| engine: ${{ steps.filter.outputs.engine }} | |
| desktop: ${{ steps.filter.outputs.desktop }} | |
| website: ${{ steps.filter.outputs.website }} | |
| orchestration_utils: ${{ steps.filter.outputs.orchestration_utils }} | |
| vscode_extension: ${{ steps.filter.outputs.vscode_extension }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Detect changed components | |
| id: filter | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| engine: | |
| - 'engine/**' | |
| - '.github/workflows/monorepo-ci.yml' | |
| desktop: | |
| - 'desktop/**' | |
| - '.github/workflows/monorepo-ci.yml' | |
| website: | |
| - 'website/**' | |
| - '.github/workflows/monorepo-ci.yml' | |
| orchestration_utils: | |
| - 'orchestration/packages/@codeflow/utils/**' | |
| - '.github/workflows/monorepo-ci.yml' | |
| vscode_extension: | |
| - 'vscode-extension/**' | |
| - '.github/workflows/monorepo-ci.yml' | |
| engine: | |
| runs-on: ubuntu-latest | |
| needs: changes | |
| if: needs.changes.outputs.engine == 'true' || github.event_name == 'workflow_dispatch' | |
| defaults: | |
| run: | |
| working-directory: engine | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Poetry | |
| run: python -m pip install poetry | |
| - name: Install engine dependencies | |
| run: poetry install --with dev --no-interaction | |
| - name: Validate engine package | |
| run: poetry run python -m compileall codeflow_engine | |
| desktop: | |
| runs-on: ubuntu-latest | |
| needs: changes | |
| if: needs.changes.outputs.desktop == 'true' || github.event_name == 'workflow_dispatch' | |
| defaults: | |
| run: | |
| working-directory: desktop | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.33.0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "pnpm" | |
| cache-dependency-path: desktop/pnpm-lock.yaml | |
| - name: Install desktop dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build desktop frontend | |
| run: pnpm run build | |
| website: | |
| runs-on: ubuntu-latest | |
| needs: changes | |
| if: needs.changes.outputs.website == 'true' || github.event_name == 'workflow_dispatch' | |
| defaults: | |
| run: | |
| working-directory: website | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.33.0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "pnpm" | |
| cache-dependency-path: website/pnpm-lock.yaml | |
| - name: Install website dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Lint website | |
| run: pnpm run lint | |
| - name: Test website | |
| run: pnpm test | |
| - name: Build website | |
| run: pnpm run build | |
| orchestration-utils: | |
| runs-on: ubuntu-latest | |
| needs: changes | |
| if: needs.changes.outputs.orchestration_utils == 'true' || github.event_name == 'workflow_dispatch' | |
| defaults: | |
| run: | |
| working-directory: orchestration/packages/@codeflow/utils | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.33.0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "pnpm" | |
| cache-dependency-path: orchestration/packages/@codeflow/utils/pnpm-lock.yaml | |
| - name: Install orchestration utility dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build orchestration utilities | |
| run: pnpm run build | |
| vscode-extension: | |
| runs-on: ubuntu-latest | |
| needs: changes | |
| if: needs.changes.outputs.vscode_extension == 'true' || github.event_name == 'workflow_dispatch' | |
| defaults: | |
| run: | |
| working-directory: vscode-extension | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.33.0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "pnpm" | |
| cache-dependency-path: vscode-extension/pnpm-lock.yaml | |
| - name: Install extension dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build extension | |
| run: pnpm run build |