fix: scalable process lifecycle via PGID-based cleanup #505
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: Integration | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: integration-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: true | |
| jobs: | |
| docs-scope: | |
| runs-on: &default-runner ubuntu-latest | |
| outputs: | |
| docs_only: ${{ steps.check.outputs.docs_only }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Detect docs-only changes | |
| id: check | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if [ "${{ github.event_name }}" = "push" ]; then | |
| BASE="${{ github.event.before }}" | |
| else | |
| BASE="${{ github.event.pull_request.base.sha }}" | |
| fi | |
| CHANGED="$(git diff --name-only "$BASE" HEAD 2>/dev/null || echo "UNKNOWN")" | |
| if [ "$CHANGED" = "UNKNOWN" ] || [ -z "$CHANGED" ]; then | |
| echo "docs_only=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| docs_only=true | |
| while IFS= read -r path; do | |
| [ -z "$path" ] && continue | |
| case "$path" in | |
| docs/*|*.md|*.mdx|LICENSE) | |
| continue | |
| ;; | |
| *) | |
| docs_only=false | |
| break | |
| ;; | |
| esac | |
| done <<< "$CHANGED" | |
| echo "docs_only=$docs_only" >> "$GITHUB_OUTPUT" | |
| integration: | |
| needs: [docs-scope] | |
| if: needs.docs-scope.outputs.docs_only != 'true' | |
| runs-on: *default-runner | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - distro: ubuntu | |
| image: ubuntu-24-04-x64 | |
| setup_script: bin/ci/setup-ubuntu.sh | |
| - distro: arch | |
| image: "217410218" | |
| setup_script: bin/ci/setup-arch.sh | |
| name: ${{ matrix.distro }} | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Generate ephemeral SSH key | |
| run: | | |
| mkdir -p ~/.ssh | |
| ssh-keygen -t ed25519 -f ~/.ssh/ci_key -N "" -q | |
| - name: Create droplet | |
| id: droplet | |
| env: | |
| DO_API_TOKEN: ${{ secrets.DO_API_TOKEN }} | |
| run: | | |
| output=$(bash bin/ci/droplet.sh create \ | |
| "ci-${{ matrix.distro }}-${{ github.run_id }}" \ | |
| "${{ matrix.image }}" \ | |
| ~/.ssh/ci_key.pub) | |
| echo "$output" >> "$GITHUB_OUTPUT" | |
| echo "$output" | |
| - name: Wait for SSH | |
| env: | |
| DO_API_TOKEN: ${{ secrets.DO_API_TOKEN }} | |
| run: | | |
| bash bin/ci/droplet.sh wait-ssh \ | |
| "${{ steps.droplet.outputs.DROPLET_IP }}" \ | |
| ~/.ssh/ci_key | |
| - name: Upload source | |
| run: | | |
| tar czf /tmp/baudbot-src.tar.gz \ | |
| --exclude=node_modules --exclude=.git . | |
| scp -o StrictHostKeyChecking=no -o BatchMode=yes \ | |
| -i ~/.ssh/ci_key \ | |
| /tmp/baudbot-src.tar.gz \ | |
| "root@${{ steps.droplet.outputs.DROPLET_IP }}:/tmp/baudbot-src.tar.gz" | |
| - name: Setup and test | |
| run: | | |
| bash bin/ci/droplet.sh run \ | |
| "${{ steps.droplet.outputs.DROPLET_IP }}" \ | |
| ~/.ssh/ci_key \ | |
| "${{ matrix.setup_script }}" \ | |
| "CI_ANTHROPIC_API_KEY=${{ secrets.CI_ANTHROPIC_API_KEY }}" | |
| - name: Cleanup | |
| if: always() | |
| env: | |
| DO_API_TOKEN: ${{ secrets.DO_API_TOKEN }} | |
| run: | | |
| bash bin/ci/droplet.sh destroy \ | |
| "${{ steps.droplet.outputs.DROPLET_ID }}" \ | |
| "${{ steps.droplet.outputs.SSH_KEY_ID }}" \ | |
| "ci-${{ matrix.distro }}-${{ github.run_id }}" |