Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

ci: run the Instant reliability job on its own edits from this repository, and on fork changes only when they touch Instant code

Richie McIlroyb6c35c5ed2fc
diff --git a/.github/workflows/instant-reliability.yml b/.github/workflows/instant-reliability.yml
index 9153e6215..137864ea6 100644
--- a/.github/workflows/instant-reliability.yml
+++ b/.github/workflows/instant-reliability.yml
@@ -25,20 +25,55 @@ on:
- "crates/recording/src/recovery.rs"
- "crates/enc-ffmpeg/src/mux/segmented_stream.rs"
- "crates/enc-ffmpeg/src/mux/dash_audio.rs"
+ - ".github/workflows/instant-reliability.yml"
schedule:
- cron: "40 4 * * *"
workflow_dispatch:
permissions:
contents: read
+ pull-requests: read
concurrency:
group: instant-reliability-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
+ # A pull request from a fork that changes only this workflow does not queue
+ # the macOS job; one that also changes Instant code does, and so does any
+ # change from this repository.
+ scope:
+ name: Scope
+ runs-on: blacksmith-2vcpu-ubuntu-2404
+ timeout-minutes: 5
+ outputs:
+ run: ${{ steps.scope.outputs.run }}
+ steps:
+ - name: Scope
+ id: scope
+ env:
+ GH_TOKEN: ${{ github.token }}
+ EVENT: ${{ github.event_name }}
+ PR: ${{ github.event.pull_request.number }}
+ SAME_REPO: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
+ run: |
+ set -euo pipefail
+ if [[ "$EVENT" != pull_request || "$SAME_REPO" == true ]]; then
+ echo "run=true" >> "$GITHUB_OUTPUT"; exit 0
+ fi
+ gh api "repos/$GITHUB_REPOSITORY/pulls/$PR/files" --paginate --jq '.[].filename' > "$RUNNER_TEMP/changed.txt"
+ instant='^(apps/desktop-gpui/src/(upload\.rs|upload/.*|recording\.rs|session\.rs|library\.rs|main_window\.rs|auth\.rs|store\.rs)|crates/recording/src/(upload_resume|upload_verification|instant_recording|recovery)\.rs|crates/enc-ffmpeg/src/mux/(segmented_stream|dash_audio)\.rs)$'
+ if grep -qE "$instant" "$RUNNER_TEMP/changed.txt"; then
+ echo "run=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "run=false" >> "$GITHUB_OUTPUT"
+ echo "A fork pull request that changes no Instant code does not run the real-app suite." | tee -a "$GITHUB_STEP_SUMMARY"
+ fi
+
real-app:
name: Instant crash, cancel and recovery (real app)
+ needs: scope
+ if: needs.scope.outputs.run == 'true'
runs-on: blacksmith-6vcpu-macos-15
timeout-minutes: 60
env: