diff --git a/.github/actions/bootstrap/action.yml b/.github/actions/bootstrap/action.yml index b061361fd..80306471a 100644 --- a/.github/actions/bootstrap/action.yml +++ b/.github/actions/bootstrap/action.yml @@ -15,14 +15,14 @@ inputs: runs: using: composite steps: - - name: Install Flutter - uses: subosito/flutter-action@v2 + - name: ๐Ÿฆ Install Flutter + uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0 with: cache: true cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }} channel: ${{ inputs.flutter-channel }} - - name: Install Melos + - name: ๐Ÿ“ฆ Install Melos shell: bash working-directory: ${{ github.workspace }} run: flutter pub global activate melos @@ -35,7 +35,7 @@ runs: # Invoked through `pub global run` rather than as a bare `melos`, so it does # not depend on the pub-cache bin directory being on PATH โ€” that differs # between the ubuntu, macos and windows runners this action is used from. - - name: Bootstrap Workspace + - name: ๐Ÿงฉ Bootstrap Workspace shell: bash working-directory: ${{ github.workspace }} run: flutter pub global run melos bootstrap diff --git a/.github/actions/bot-commit/action.yml b/.github/actions/bot-commit/action.yml index 3efe8f42b..58f2824c0 100644 --- a/.github/actions/bot-commit/action.yml +++ b/.github/actions/bot-commit/action.yml @@ -4,6 +4,9 @@ description: > signed by GitHub and attributed to the app whose token is used. The commit is refused if the branch moved past `expected-head-sha`. +# The job needs a runner in the static-IP group: the org IP allow list refuses +# its API calls from standard runners. + inputs: files: description: > @@ -52,7 +55,7 @@ runs: steps: - name: ๐Ÿ“ค Commit through the API id: commit - uses: actions/github-script@v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: FILES: ${{ inputs.files }} MESSAGE: ${{ inputs.message }} diff --git a/.github/actions/flutter-web-deploy/action.yml b/.github/actions/flutter-web-deploy/action.yml index eb1a25f9f..7df88260d 100644 --- a/.github/actions/flutter-web-deploy/action.yml +++ b/.github/actions/flutter-web-deploy/action.yml @@ -8,7 +8,8 @@ description: > # flutter-web-target names for the account: the identity provider only admits # runs in it. Fork pull requests can't deploy: their runs get no identity token. # It needs a Linux runner: the cleanup of old pull request builds uses GNU -# `date -d`. +# `date -d`. It makes no GitHub API call, so a standard runner such as +# `ubuntu-latest` works. inputs: path: @@ -35,13 +36,13 @@ runs: fi - name: ๐Ÿ”‘ Authenticate to Google Cloud - uses: google-github-actions/auth@v3 + uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0 with: workload_identity_provider: projects/675676272957/locations/global/workloadIdentityPools/github-actions/providers/github-flutter service_account: ${{ inputs.service-account }} - name: โ˜๏ธ Setup gcloud - uses: google-github-actions/setup-gcloud@v3 + uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db # v3.0.1 # A prod folder holds the beta build in beta/ and the pull request builds # in pr/, so the sync leaves those alone. diff --git a/.github/actions/flutter-web-pr-comment/action.yml b/.github/actions/flutter-web-pr-comment/action.yml index 9355c6923..ca991f91d 100644 --- a/.github/actions/flutter-web-pr-comment/action.yml +++ b/.github/actions/flutter-web-pr-comment/action.yml @@ -3,7 +3,8 @@ description: > Comments the link to a pull request's web build on the pull request, or updates that comment when the build is removed. One comment per app. -# The job needs `pull-requests: write`. +# The job needs `pull-requests: write`, and a runner in the static-IP group: +# the org IP allow list refuses its API calls from standard runners. inputs: app: @@ -22,7 +23,7 @@ runs: using: composite steps: - name: ๐Ÿ’ฌ Comment the Link - uses: actions/github-script@v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: APP: ${{ inputs.app }} URL: ${{ inputs.url }} diff --git a/.github/actions/flutter-web-remove/action.yml b/.github/actions/flutter-web-remove/action.yml index cec1e9a03..62a08b3bd 100644 --- a/.github/actions/flutter-web-remove/action.yml +++ b/.github/actions/flutter-web-remove/action.yml @@ -5,7 +5,8 @@ description: > when there is no build. # The job needs `id-token: write` and the GitHub environment `flutter-web-pr`: -# the identity provider only admits runs in it. +# the identity provider only admits runs in it. It makes no GitHub API call, so +# a standard runner such as `ubuntu-latest` works. inputs: path: @@ -29,13 +30,13 @@ runs: fi - name: ๐Ÿ”‘ Authenticate to Google Cloud - uses: google-github-actions/auth@v3 + uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0 with: workload_identity_provider: projects/675676272957/locations/global/workloadIdentityPools/github-actions/providers/github-flutter service_account: ${{ inputs.service-account }} - name: โ˜๏ธ Setup gcloud - uses: google-github-actions/setup-gcloud@v3 + uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db # v3.0.1 # Syncing an empty folder deletes every object of the build, and passes # when there is none. diff --git a/.github/actions/flutter-web-target/action.yml b/.github/actions/flutter-web-target/action.yml index 24214a72e..7b8287a68 100644 --- a/.github/actions/flutter-web-target/action.yml +++ b/.github/actions/flutter-web-target/action.yml @@ -23,6 +23,8 @@ description: > # unset otherwise. Nothing removes a build's browser # storage, so an app can skip storing what grows, such as # an offline cache, in pull request builds. +# +# It makes no network call, so it runs on any runner. inputs: app: diff --git a/.github/actions/package_analysis/action.yml b/.github/actions/package_analysis/action.yml index 388694167..0615b9099 100644 --- a/.github/actions/package_analysis/action.yml +++ b/.github/actions/package_analysis/action.yml @@ -3,11 +3,11 @@ name: Package Analysis runs: using: "composite" steps: - - name: "Install Tools" + - name: ๐Ÿ“ฆ Install Tools shell: bash run: flutter pub global activate melos - - name: "Bootstrap Workspace" + - name: ๐Ÿงฉ Bootstrap Workspace shell: bash run: melos bootstrap --verbose env: @@ -15,6 +15,6 @@ runs: # Only analyze lib/; non-client code doesn't need to work on # all supported legacy version. - - name: "Stream Core Analyze" + - name: ๐Ÿ” Analyze stream_core shell: bash run: cd packages/stream_core/lib && dart analyze --fatal-warnings . && cd .. && flutter test --exclude-tags golden diff --git a/.github/actions/pana/action.yml b/.github/actions/pana/action.yml index 7de52eec1..00daf6410 100644 --- a/.github/actions/pana/action.yml +++ b/.github/actions/pana/action.yml @@ -22,26 +22,26 @@ runs: steps: # Pana resolves the package on its own, so a dependency on a sibling package would come from pub.dev and miss # the changes in this checkout. Point it at the sibling's directory instead. - - name: Resolve Sibling Packages From The Checkout - uses: mikefarah/yq@v4 + - name: ๐Ÿ”— Resolve Sibling Packages From The Checkout + uses: mikefarah/yq@f2944b823f84906a127dbd29e4c2a3e60c4e550e # v4.54.3 with: cmd: | yq eval '(.dependencies | select(has("stream_core")) | .stream_core) = {"path": "../stream_core"}' -i packages/stream_core_flutter/pubspec.yaml - - name: Install Flutter - uses: subosito/flutter-action@v2 + - name: ๐Ÿฆ Install Flutter + uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0 with: cache: true channel: stable flutter-version: "3.x" cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }} - - name: Install Pana + - name: ๐Ÿ“ฆ Install Pana working-directory: ${{ inputs.working_directory }} shell: bash run: flutter pub global activate pana ${{inputs.pana_version}} - - name: Verify Pana Score + - name: ๐Ÿ“Š Verify Pana Score working-directory: ${{ inputs.working_directory }} shell: bash run: | diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..99fae81a2 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,20 @@ +# Keeps the SHA-pinned actions in workflows and local composite actions current. +# See https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "github-actions" + # "/" covers only .github/workflows; the composite actions need their own entry. + directories: + - "/" + - "/.github/actions/*" + schedule: + interval: "weekly" + # A release must be a week old before it is proposed, so a compromised one has time to be caught. + cooldown: + default-days: 7 + groups: + all-actions: + patterns: ["*"] + commit-message: + prefix: "chore(deps)" diff --git a/.github/workflows/beta_version_analyze.yml b/.github/workflows/beta_version_analyze.yml index b1465587f..310573987 100644 --- a/.github/workflows/beta_version_analyze.yml +++ b/.github/workflows/beta_version_analyze.yml @@ -12,17 +12,17 @@ permissions: jobs: # Does a sanity check on packages for the next beta version so we are not surprised by any breaking changes. analyze_beta_versions: + name: Analyze on Flutter Beta timeout-minutes: 15 - runs-on: - group: github-public-amd64 + runs-on: ubuntu-latest steps: - - name: "Git Checkout" - uses: actions/checkout@v4 + - name: ๐Ÿ“š Checkout + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: - fetch-depth: 0 + persist-credentials: false - - name: "Install Flutter" - uses: subosito/flutter-action@v2 + - name: ๐Ÿฆ Install Flutter + uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0 with: channel: beta cache: true @@ -38,7 +38,8 @@ jobs: needs: [analyze_beta_versions] if: failure() && github.event_name == 'schedule' steps: - - uses: 8398a7/action-slack@v3 + - name: ๐Ÿ“ฃ Report to Slack + uses: 8398a7/action-slack@77eaa4f1c608a7d68b38af4e3f739dcd8cba273e # v3.19.0 with: status: failure text: "<@U08BMRSM8G5> & <@U05UCQ2B0CT>: The beta build for Flutter Video failed. Please check the logs." diff --git a/.github/workflows/detect_changes.yml b/.github/workflows/detect_changes.yml new file mode 100644 index 000000000..5946a1c1a --- /dev/null +++ b/.github/workflows/detect_changes.yml @@ -0,0 +1,103 @@ +name: detect_changes + +# Tells whether a pull request or push changes any of the given paths, for a +# gate job that decides whether heavier jobs run. Diffs with git on a free +# runner, so it needs no token: the GitHub API that dorny/paths-filter calls +# on pull requests is refused from standard runners by the org IP allow list. +# +# gate: +# uses: GetStream/stream-core-flutter/.github/workflows/detect_changes.yml@ +# with: +# paths: | +# packages/** +# .github/workflows/my_workflow.yml +# +# analyze: +# needs: gate +# # Runs when the gate fails too: a skipped required check passes, so +# # skipping then would let a broken gate wave every change through. +# if: ${{ !cancelled() && (needs.gate.result != 'success' || needs.gate.outputs.changed == 'true') }} +# +# A pull request is compared with its base branch, a push with the commit +# before it. A new branch, a push whose previous commit is gone, and any other +# event count as changed. + +on: + workflow_call: + inputs: + paths: + description: > + Glob patterns, one per line, such as `packages/**`. `*` stays within + a directory and `**` crosses them, as in git's `:(glob)` pathspecs. + type: string + required: true + outputs: + changed: + description: "`true` when a matching file was added, changed, deleted or moved." + value: ${{ jobs.detect.outputs.changed }} + +permissions: + contents: read + +jobs: + detect: + name: Detect Changes + runs-on: ubuntu-latest + timeout-minutes: 5 + outputs: + changed: ${{ steps.detect.outputs.changed }} + steps: + # A pull request checks out its test merge commit, whose first parent is + # the base branch. + - name: ๐Ÿ“š Checkout + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + fetch-depth: 2 + persist-credentials: false + + # --no-renames lists a moved file under both paths, so moving one out of + # a watched directory still counts. + - name: ๐Ÿ” Detect Changes + id: detect + env: + EVENT: ${{ github.event_name }} + BEFORE: ${{ github.event.before }} + PATHS: ${{ inputs.paths }} + run: | + set -euo pipefail + specs=() + while IFS= read -r line; do + line="${line#"${line%%[![:space:]]*}"}" + line="${line%"${line##*[![:space:]]}"}" + if [ -n "$line" ]; then specs+=(":(glob)$line"); fi + done <<< "$PATHS" + if [ ${#specs[@]} -eq 0 ]; then + echo "::error::paths is empty" + exit 1 + fi + + base= + case "$EVENT" in + pull_request) base=HEAD^1 ;; + push) + if [[ ! $BEFORE =~ ^0+$ ]] && git fetch -q --depth=1 origin "$BEFORE"; then + base=$BEFORE + fi + ;; + esac + + if [ -z "$base" ]; then + echo "No commit to compare with on $EVENT, so everything counts as changed." + changed=true + else + files=$(git diff --name-only --no-renames "$base" HEAD -- "${specs[@]}") + if [ -n "$files" ]; then + echo "Changed files matching paths:" + echo "$files" + changed=true + else + echo "No changed file matches paths." + changed=false + fi + fi + echo "changed=$changed" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/legacy_version_analyze.yml b/.github/workflows/legacy_version_analyze.yml index 86ccf4198..73ab07188 100644 --- a/.github/workflows/legacy_version_analyze.yml +++ b/.github/workflows/legacy_version_analyze.yml @@ -11,6 +11,9 @@ on: - main - develop pull_request: + # ready_for_review: a draft's skipped check stays green otherwise, so a + # draft marked ready would merge unanalyzed until its next push. + types: [opened, synchronize, reopened, ready_for_review] branches: - main - develop @@ -21,7 +24,6 @@ concurrency: permissions: contents: read - pull-requests: read jobs: # Decides whether the analysis runs: on every push, and on a pull request @@ -30,44 +32,34 @@ jobs: # never reports and leaves a required check waiting forever. See # https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks gate: - runs-on: - group: github-public-amd64 - outputs: - should_run: ${{ github.event_name == 'push' || (steps.filter.outputs.packages == 'true' && github.event.pull_request.draft != true) }} - steps: - # paths-filter diffs against git history on push events, so it needs a - # checkout there. On pull requests it uses the API instead. - - name: "Git Checkout" - uses: actions/checkout@v4 - - - name: "Detect Path Changes" - uses: dorny/paths-filter@v4 - id: filter - with: - filters: | - packages: - - 'packages/**' - - '.github/workflows/legacy_version_analyze.yml' + name: Check Package Changes + uses: ./.github/workflows/detect_changes.yml + with: + paths: | + packages/** + .github/workflows/legacy_version_analyze.yml # Does a sanity check that packages at least pass analysis on the N-1 # versions of Flutter stable if the package claims to support that version. # This is to minimize accidentally making changes that break old versions # (which we don't commit to supporting, but don't want to actively break) # without updating the constraints. + # No `name:`: the ruleset requires this check by its job ID. Runs when the + # gate fails too: a skipped required check passes, so skipping then would + # let a broken gate wave every pull request through. analyze_legacy_version: needs: gate - if: needs.gate.outputs.should_run == 'true' + if: ${{ !cancelled() && (github.event_name == 'push' || needs.gate.result != 'success' || (needs.gate.outputs.changed == 'true' && github.event.pull_request.draft != true)) }} timeout-minutes: 15 - runs-on: - group: github-public-amd64 + runs-on: ubuntu-latest steps: - - name: "Git Checkout" - uses: actions/checkout@v3 + - name: ๐Ÿ“š Checkout + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: - fetch-depth: 0 + persist-credentials: false - - name: "Install Flutter" - uses: subosito/flutter-action@v2 + - name: ๐Ÿฆ Install Flutter + uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0 with: cache: true flutter-version: ${{ env.flutter_version }} diff --git a/.github/workflows/pana.yml b/.github/workflows/pana.yml index b042e5ea3..368170ede 100644 --- a/.github/workflows/pana.yml +++ b/.github/workflows/pana.yml @@ -14,15 +14,15 @@ concurrency: permissions: contents: read - pull-requests: read jobs: stream_core: - runs-on: - group: github-public-amd64 + runs-on: ubuntu-latest steps: - name: ๐Ÿ“š Git Checkout - uses: actions/checkout@v4 + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false - name: ๐Ÿ“Š Verify Pana Score uses: ./.github/actions/pana with: @@ -30,11 +30,12 @@ jobs: min_score: 120 # Missing 10 points for no example, 10 points for no license, 10 points for static analysis issues, and 10 points for outdated dependencies (cross_file 0.4.0 requires Flutter). stream_core_flutter: - runs-on: - group: github-public-amd64 + runs-on: ubuntu-latest steps: - name: ๐Ÿ“š Git Checkout - uses: actions/checkout@v4 + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false - name: ๐Ÿ“Š Verify Pana Score uses: ./.github/actions/pana with: @@ -42,11 +43,12 @@ jobs: min_score: 110 # Missing 10 points for no license, 10 points for no example, 20 points for static analysis issues (including the path dependency on stream_core that the pana action sets up), and 10 points for outdated dependencies (shimmer 4.0.0). stream_thumbnail: - runs-on: - group: github-public-amd64 + runs-on: ubuntu-latest steps: - name: ๐Ÿ“š Git Checkout - uses: actions/checkout@v4 + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false - name: ๐Ÿ“Š Verify Pana Score uses: ./.github/actions/pana with: diff --git a/.github/workflows/pr_labels.yml b/.github/workflows/pr_labels.yml index 28d30b1f7..56b49a994 100644 --- a/.github/workflows/pr_labels.yml +++ b/.github/workflows/pr_labels.yml @@ -22,4 +22,5 @@ permissions: jobs: review_labels: + name: Review Labels uses: ./.github/workflows/pr_review_labels.yml diff --git a/.github/workflows/pr_review_labels.yml b/.github/workflows/pr_review_labels.yml index 4bdb44321..e61239906 100644 --- a/.github/workflows/pr_review_labels.yml +++ b/.github/workflows/pr_review_labels.yml @@ -29,6 +29,7 @@ on: jobs: # The author marked the pull request "ready" again, so review feedback is addressed. drop_pending: + name: Drop the Pending Label if: >- github.event.pull_request.head.repo.full_name == github.repository && github.event.action == 'labeled' && github.event.label.name == 'ready' @@ -40,7 +41,7 @@ jobs: timeout-minutes: 5 steps: - name: ๐Ÿท๏ธ Remove Pending - uses: actions/github-script@v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | const { owner, repo } = context.repo; @@ -63,6 +64,7 @@ jobs: } sync_labels: + name: Sync Review Labels # Reviews by the pull request author or by bots never change the labels, # so they're skipped here and can't cancel a run that does. if: >- @@ -88,7 +90,7 @@ jobs: timeout-minutes: 5 steps: - name: ๐Ÿท๏ธ Sync Review Labels - uses: actions/github-script@v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | const READY = 'ready'; diff --git a/.github/workflows/pr_title.yml b/.github/workflows/pr_title.yml index 523faeebe..a5c044206 100644 --- a/.github/workflows/pr_title.yml +++ b/.github/workflows/pr_title.yml @@ -25,7 +25,8 @@ jobs: runs-on: group: github-public-amd64 steps: - - uses: amannn/action-semantic-pull-request@v5.5.3 + - name: ๐Ÿท๏ธ Check PR Title + uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3 with: scopes: | llc @@ -41,7 +42,8 @@ jobs: runs-on: group: github-public-amd64 steps: - - uses: GetStream/verify-semantic-changelog-update@v1.1.0 + - name: ๐Ÿ“ Check Changelog Update + uses: GetStream/verify-semantic-changelog-update@566b49e5ce5f180280336053428f7e2338a4d496 # v1.1.0 with: scopes: | { @@ -56,7 +58,9 @@ jobs: # checks that the entries went under `## Upcoming` rather than into a section # for a version that is already published. changelog_placement: + name: Check Changelog Placement runs-on: group: github-public-amd64 steps: - - uses: GetStream/verify-semantic-changelog-update/placement@v1.1.0 + - name: ๐Ÿ“ Check Changelog Placement + uses: GetStream/verify-semantic-changelog-update/placement@566b49e5ce5f180280336053428f7e2338a4d496 # v1.1.0 diff --git a/.github/workflows/pr_version_labels.yml b/.github/workflows/pr_version_labels.yml index 05443dfb4..32cd6a0da 100644 --- a/.github/workflows/pr_version_labels.yml +++ b/.github/workflows/pr_version_labels.yml @@ -24,6 +24,7 @@ on: jobs: version_label: + name: Label the Version Bump # Runs when a pull request opens or changes base; other events are ignored, # so it can share a caller with workflows triggered by more events. if: >- @@ -43,7 +44,7 @@ jobs: timeout-minutes: 5 steps: - name: ๐Ÿท๏ธ Label Version - uses: actions/github-script@v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: VERSION_FILE: ${{ inputs.version-file }} with: diff --git a/.github/workflows/pr_web_build.yml b/.github/workflows/pr_web_build.yml index df83a2960..2a78632f5 100644 --- a/.github/workflows/pr_web_build.yml +++ b/.github/workflows/pr_web_build.yml @@ -6,6 +6,10 @@ name: pr_web_build # request removes the build. Builds left behind are removed after 30 days by # the next prod or beta deploy. Fork pull requests are skipped: their runs get # no identity token. +# +# Building and deploying make no GitHub API call, so they run on free +# runners; only the comment jobs call the API, which the org IP allow list +# permits from the static-IP runners alone. on: pull_request: @@ -32,8 +36,7 @@ jobs: github.event.action != 'unlabeled' && contains(github.event.pull_request.labels.*.name, 'build') && (github.event.action != 'labeled' || github.event.label.name == 'build') - runs-on: - group: github-public-amd64 + runs-on: ubuntu-latest timeout-minutes: 20 # On the jobs rather than the workflow, so a run that skips both (another # label added) leaves a running deploy alone. @@ -43,13 +46,16 @@ jobs: environment: name: flutter-web-pr url: ${{ steps.target.outputs.url }} + outputs: + url: ${{ steps.target.outputs.url }} permissions: contents: read id-token: write - pull-requests: write steps: - name: ๐Ÿ“š Checkout - uses: actions/checkout@v6 + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false - name: ๐Ÿงฉ Bootstrap Workspace uses: ./.github/actions/bootstrap @@ -76,11 +82,33 @@ jobs: service-account: ${{ steps.target.outputs.service-account }} build-dir: apps/design_system_gallery/build/web + comment: + name: Comment the Link + needs: deploy + # Shared with remove_comment and queued, not cancelled, so a late link + # comment can't overwrite "removed" for a build that is already gone. + concurrency: + group: pr-web-comment-${{ github.event.pull_request.number }} + cancel-in-progress: false + runs-on: + group: github-public-amd64 + timeout-minutes: 5 + permissions: + contents: read + pull-requests: write + steps: + # Only for the local action; other repositories use it without a checkout. + - name: ๐Ÿ“š Checkout + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false + sparse-checkout: .github/actions + - name: ๐Ÿ’ฌ Comment the Link uses: ./.github/actions/flutter-web-pr-comment with: app: design-system - url: ${{ steps.target.outputs.url }} + url: ${{ needs.deploy.outputs.url }} remove: name: Remove Build @@ -88,8 +116,7 @@ jobs: github.event.pull_request.head.repo.full_name == github.repository && ((github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'build')) || (github.event.action == 'unlabeled' && github.event.label.name == 'build')) - runs-on: - group: github-public-amd64 + runs-on: ubuntu-latest timeout-minutes: 5 # Shares the deploy's group, so it stops a deploy that is still running. concurrency: @@ -100,13 +127,13 @@ jobs: permissions: contents: read id-token: write - pull-requests: write steps: # Only for the local actions; other repositories use them without a # checkout. - name: ๐Ÿ“š Checkout - uses: actions/checkout@v6 + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: + persist-credentials: false sparse-checkout: .github/actions - name: ๐ŸŽฏ Target @@ -122,6 +149,26 @@ jobs: path: ${{ steps.target.outputs.path }} service-account: ${{ steps.target.outputs.service-account }} + remove_comment: + name: Update the Comment + needs: remove + concurrency: + group: pr-web-comment-${{ github.event.pull_request.number }} + cancel-in-progress: false + runs-on: + group: github-public-amd64 + timeout-minutes: 5 + permissions: + contents: read + pull-requests: write + steps: + # Only for the local action; other repositories use it without a checkout. + - name: ๐Ÿ“š Checkout + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false + sparse-checkout: .github/actions + - name: ๐Ÿ’ฌ Update the Comment uses: ./.github/actions/flutter-web-pr-comment with: diff --git a/.github/workflows/publish_gallery.yml b/.github/workflows/publish_gallery.yml index 8e4beb778..784739fe6 100644 --- a/.github/workflows/publish_gallery.yml +++ b/.github/workflows/publish_gallery.yml @@ -1,8 +1,8 @@ name: Publish Design System Gallery # Deploys the gallery to https://flutter.getstream.io/design-system/beta/ on -# every push to main, and publishes it to GitHub Pages. A manual run on main -# deploys beta again; flutter-web refuses other branches. +# every push to main. A manual run on main deploys beta again; flutter-web +# refuses other branches. # # Prod (https://flutter.getstream.io/design-system/) is deployed by # release_publish.yml, once a stream_core_flutter release is on pub.dev. @@ -13,9 +13,6 @@ on: - main workflow_dispatch: -env: - FLUTTER_CHANNEL: stable - concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -24,46 +21,9 @@ permissions: contents: read jobs: - build_and_deploy_gallery: - if: github.ref == 'refs/heads/main' - runs-on: - group: github-public-amd64 - timeout-minutes: 10 - permissions: - contents: write - steps: - - name: Checkout code - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: config git - run: | - git config --global user.email "$(git log --format='%ae' HEAD^!)" - git config --global user.name "$(git log --format='%an' HEAD^!)" - - - name: Setup Flutter - uses: subosito/flutter-action@v2 - with: - channel: ${{ env.FLUTTER_CHANNEL }} - flutter-version: ${{ env.FLUTTER_VERSION }} - - - name: Install Tools - run: flutter pub global activate melos - - - name: Bootstrap Workspace - run: melos bootstrap - - - name: Build and Deploy - uses: bluefireteam/flutter-gh-pages@v9 - with: - baseHref: /stream-core-flutter/ - workingDir: apps/design_system_gallery - deploy_hosted: name: Deploy to flutter.getstream.io - runs-on: - group: github-public-amd64 + runs-on: ubuntu-latest timeout-minutes: 20 concurrency: group: web-deploy-design-system-beta @@ -76,7 +36,9 @@ jobs: id-token: write steps: - name: ๐Ÿ“š Checkout - uses: actions/checkout@v6 + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false - name: ๐Ÿงฉ Bootstrap Workspace uses: ./.github/actions/bootstrap diff --git a/.github/workflows/release_publish.yml b/.github/workflows/release_publish.yml index 9ca76f57c..9cf41ddbb 100644 --- a/.github/workflows/release_publish.yml +++ b/.github/workflows/release_publish.yml @@ -15,6 +15,7 @@ concurrency: jobs: release: + name: Publish to pub.dev # Publishing waits for a flutter-developers approval, and pub.dev only # accepts uploads from this environment. environment: pub.dev @@ -30,8 +31,9 @@ jobs: - name: ๐Ÿ“š Checkout branch # Default GITHUB_TOKEN: this job never pushes to git (the release step # passes its own token), so no bot PAT sits in git config during setup. - uses: actions/checkout@v6 + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: + persist-credentials: false fetch-depth: 0 - name: ๐Ÿท๏ธ Parse package and version from tag @@ -78,10 +80,10 @@ jobs: - name: ๐ŸŽฏ Setup Dart # Before Flutter: provides the pub.dev OIDC token. - uses: dart-lang/setup-dart@v1 + uses: dart-lang/setup-dart@2286a0c042b44434fe26d292bbce8d34f7ec662b # v1.8.2 - name: ๐Ÿฆ Install Flutter - uses: subosito/flutter-action@v2 + uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0 with: channel: stable @@ -204,13 +206,13 @@ jobs: - name: ๐Ÿ”‘ Mint CI Bot Token id: ci-bot-token - uses: actions/create-github-app-token@v3 + uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0 with: client-id: ${{ vars.FLUTTER_CI_BOT_CLIENT_ID }} private-key: ${{ secrets.FLUTTER_CI_BOT_PRIVATE_KEY }} - name: ๐Ÿš€ Create GitHub Release - uses: softprops/action-gh-release@v3 + uses: softprops/action-gh-release@8a0cd651e5b2365bd640854a3fa5dfc70e4875f3 # v3.0.4 with: tag_name: ${{ github.ref_name }} name: ${{ steps.parse.outputs.package }} v${{ steps.parse.outputs.version }} @@ -227,8 +229,8 @@ jobs: name: Deploy the Gallery to flutter.getstream.io needs: release if: needs.release.outputs.package == 'stream_core_flutter' && needs.release.outputs.prerelease == 'false' - runs-on: - group: github-public-amd64 + # Builds and deploys to Google Cloud without a GitHub API call, so a free runner works. + runs-on: ubuntu-latest timeout-minutes: 20 concurrency: group: web-deploy-design-system-prod @@ -241,7 +243,9 @@ jobs: id-token: write steps: - name: ๐Ÿ“š Checkout - uses: actions/checkout@v6 + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false - name: ๐Ÿงฉ Bootstrap Workspace uses: ./.github/actions/bootstrap diff --git a/.github/workflows/release_tag.yml b/.github/workflows/release_tag.yml index 734fd6cb1..c6f87baac 100644 --- a/.github/workflows/release_tag.yml +++ b/.github/workflows/release_tag.yml @@ -12,6 +12,7 @@ concurrency: jobs: release: + name: Tag Unpublished Packages # Manual dispatch, or a commit whose message starts `chore(): release` # (no regex in GH expressions). A manual run tags whatever is unpublished. if: "${{ github.event_name == 'workflow_dispatch' || (startsWith(github.event.head_commit.message, 'chore(') && contains(github.event.head_commit.message, '): release')) }}" @@ -22,20 +23,20 @@ jobs: steps: - name: ๐Ÿ”‘ Mint CI Bot Token id: ci-bot-token - uses: actions/create-github-app-token@v3 + uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0 with: client-id: ${{ vars.FLUTTER_CI_BOT_CLIENT_ID }} private-key: ${{ secrets.FLUTTER_CI_BOT_PRIVATE_KEY }} - name: ๐Ÿ“š Checkout branch # CI bot app token: GITHUB_TOKEN tag pushes don't trigger the publish workflow. - uses: actions/checkout@v6 + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: fetch-depth: 0 token: ${{ steps.ci-bot-token.outputs.token }} - name: ๐Ÿฆ Install Flutter - uses: subosito/flutter-action@v2 + uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0 with: channel: stable diff --git a/.github/workflows/stream_core_flutter_workflow.yml b/.github/workflows/stream_core_flutter_workflow.yml index ff64a9f0e..3c6862f90 100644 --- a/.github/workflows/stream_core_flutter_workflow.yml +++ b/.github/workflows/stream_core_flutter_workflow.yml @@ -21,89 +21,89 @@ concurrency: permissions: contents: read - pull-requests: read jobs: analyze: timeout-minutes: 15 - runs-on: - group: github-public-amd64 + runs-on: ubuntu-latest env: IS_CI: 'true' steps: - - name: Git Checkout - uses: actions/checkout@v6 + - name: ๐Ÿ“š Checkout + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: - fetch-depth: 0 + persist-credentials: false - - name: Install Flutter - uses: subosito/flutter-action@v2 + - name: ๐Ÿฆ Install Flutter + uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0 with: cache: true cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }} channel: ${{ env.FLUTTER_CHANNEL }} - - name: Install Tools + - name: ๐Ÿ“ฆ Install Tools run: | flutter pub global activate melos - - name: Bootstrap Workspace + - name: ๐Ÿงฉ Bootstrap Workspace run: melos bootstrap --verbose - - name: Dart Analyze + - name: ๐Ÿ” Dart Analyze run: | melos run analyze - - name: Check barrels and tokens + - name: ๐Ÿงฑ Check Barrels and Tokens run: | melos run check:barrels melos run check:tokens - - name: Check formatting + - name: ๐ŸŽจ Check Formatting run: | melos run format:verify test: needs: analyze timeout-minutes: 15 - runs-on: - group: github-public-amd64 + # The runner update_goldens renders on (its `render` job), so a golden that + # renders differently on another image can still be regenerated to match. + # Change both together. + runs-on: ubuntu-latest permissions: contents: read - pull-requests: read # Codecov authenticates the coverage upload with a GitHub OIDC token. id-token: write env: IS_CI: 'true' steps: - - name: Git Checkout - uses: actions/checkout@v6 + - name: ๐Ÿ“š Checkout + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: - fetch-depth: 0 + persist-credentials: false - - name: Install Flutter - uses: subosito/flutter-action@v2 + - name: ๐Ÿฆ Install Flutter + uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0 with: cache: true cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }} channel: ${{ env.FLUTTER_CHANNEL }} - - name: Install Tools + - name: ๐Ÿ“ฆ Install Tools run: | flutter pub global activate melos flutter pub global activate remove_from_coverage - - name: Bootstrap Workspace + - name: ๐Ÿงฉ Bootstrap Workspace run: melos bootstrap --verbose - - name: Flutter Test + - name: ๐Ÿงช Flutter Test run: melos run test:all - - name: Collect Coverage + - name: ๐Ÿ“Š Collect Coverage run: melos run coverage:ignore-file --no-select - - name: Upload Coverage - uses: codecov/codecov-action@v5 + - name: ๐Ÿ“ค Upload Coverage + uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac # v5.5.5 with: use_oidc: true files: packages/*/coverage/lcov.info + disable_search: true diff --git a/.github/workflows/stream_thumbnail_native_builds.yml b/.github/workflows/stream_thumbnail_native_builds.yml index 7b9bfdfe9..4a839e0df 100644 --- a/.github/workflows/stream_thumbnail_native_builds.yml +++ b/.github/workflows/stream_thumbnail_native_builds.yml @@ -28,121 +28,135 @@ concurrency: permissions: contents: read - pull-requests: read jobs: android: + name: Build Android timeout-minutes: 20 - runs-on: - group: github-public-amd64 + runs-on: ubuntu-latest defaults: run: working-directory: packages/stream_thumbnail/example steps: - - name: Git Checkout - uses: actions/checkout@v6 + - name: ๐Ÿ“š Checkout + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false - - name: Bootstrap Workspace + - name: ๐Ÿงฉ Bootstrap Workspace uses: ./.github/actions/bootstrap with: flutter-channel: ${{ env.FLUTTER_CHANNEL }} - - name: Build APK + - name: ๐Ÿ—๏ธ Build APK run: flutter build apk --debug ios: + name: Build iOS timeout-minutes: 20 - runs-on: { group: scaleway-macos } + runs-on: macos-latest defaults: run: working-directory: packages/stream_thumbnail/example steps: - - name: Git Checkout - uses: actions/checkout@v6 + - name: ๐Ÿ“š Checkout + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false - - name: Bootstrap Workspace + - name: ๐Ÿงฉ Bootstrap Workspace uses: ./.github/actions/bootstrap with: flutter-channel: ${{ env.FLUTTER_CHANNEL }} - - name: Build iOS (no codesign) + - name: ๐Ÿ—๏ธ Build iOS (no codesign) run: flutter build ios --debug --no-codesign macos: + name: Build macOS timeout-minutes: 20 - runs-on: { group: scaleway-macos } + runs-on: macos-latest defaults: run: working-directory: packages/stream_thumbnail/example steps: - - name: Git Checkout - uses: actions/checkout@v6 + - name: ๐Ÿ“š Checkout + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false - - name: Bootstrap Workspace + - name: ๐Ÿงฉ Bootstrap Workspace uses: ./.github/actions/bootstrap with: flutter-channel: ${{ env.FLUTTER_CHANNEL }} - - name: Build macOS + - name: ๐Ÿ—๏ธ Build macOS run: flutter build macos --debug windows: + name: Build Windows timeout-minutes: 20 runs-on: windows-latest defaults: run: working-directory: packages/stream_thumbnail/example steps: - - name: Git Checkout - uses: actions/checkout@v6 + - name: ๐Ÿ“š Checkout + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false - - name: Bootstrap Workspace + - name: ๐Ÿงฉ Bootstrap Workspace uses: ./.github/actions/bootstrap with: flutter-channel: ${{ env.FLUTTER_CHANNEL }} - - name: Build Windows + - name: ๐Ÿ—๏ธ Build Windows run: flutter build windows --debug linux: + name: Build Linux timeout-minutes: 20 - runs-on: - group: github-public-amd64 + runs-on: ubuntu-latest defaults: run: working-directory: packages/stream_thumbnail/example steps: - - name: Git Checkout - uses: actions/checkout@v6 + - name: ๐Ÿ“š Checkout + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false - - name: Install Linux Build Dependencies + - name: ๐Ÿ“ฆ Install Linux Build Dependencies run: | sudo apt-get update sudo apt-get install -y ninja-build libgtk-3-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libwebp-dev - - name: Bootstrap Workspace + - name: ๐Ÿงฉ Bootstrap Workspace uses: ./.github/actions/bootstrap with: flutter-channel: ${{ env.FLUTTER_CHANNEL }} - - name: Build Linux + - name: ๐Ÿ—๏ธ Build Linux run: flutter build linux --debug web: + name: Build Web timeout-minutes: 20 - runs-on: - group: github-public-amd64 + runs-on: ubuntu-latest defaults: run: working-directory: packages/stream_thumbnail/example steps: - - name: Git Checkout - uses: actions/checkout@v6 + - name: ๐Ÿ“š Checkout + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false - - name: Bootstrap Workspace + - name: ๐Ÿงฉ Bootstrap Workspace uses: ./.github/actions/bootstrap with: flutter-channel: ${{ env.FLUTTER_CHANNEL }} - - name: Build Web + - name: ๐Ÿ—๏ธ Build Web run: flutter build web diff --git a/.github/workflows/sync_style_guides.yml b/.github/workflows/sync_style_guides.yml index 69c9fca53..d091cb949 100644 --- a/.github/workflows/sync_style_guides.yml +++ b/.github/workflows/sync_style_guides.yml @@ -30,14 +30,16 @@ jobs: # The guides are copied into repositories that have none of this repo's # other files, so a link out of `style_guides/` must fail before merge. check: - runs-on: - group: github-public-amd64 + name: Check Guide Links + runs-on: ubuntu-latest steps: - name: ๐Ÿ“š Git Checkout - uses: actions/checkout@v6 + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false - name: ๐ŸŽฏ Install Dart - uses: dart-lang/setup-dart@v1 + uses: dart-lang/setup-dart@2286a0c042b44434fe26d292bbce8d34f7ec662b # v1.8.2 - name: ๐Ÿ”— Check Guide Links run: dart run scripts/sync_style_guides.dart --check @@ -45,6 +47,7 @@ jobs: # Only `main` syncs, so a manual run on another branch cannot push its # unreviewed guides into the other repositories with the CI bot's token. sync: + name: Sync to ${{ matrix.repository }} if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' needs: check runs-on: @@ -61,13 +64,15 @@ jobs: branch: main steps: - name: ๐Ÿ“š Git Checkout - uses: actions/checkout@v6 + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false # An app token covers only the repositories it is minted for, so each # job asks for its own target rather than this repository. - name: ๐Ÿ”‘ Mint CI Bot Token id: ci-bot-token - uses: actions/create-github-app-token@v3 + uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0 with: client-id: ${{ vars.FLUTTER_CI_BOT_CLIENT_ID }} private-key: ${{ secrets.FLUTTER_CI_BOT_PRIVATE_KEY }} @@ -75,15 +80,16 @@ jobs: repositories: ${{ matrix.repository }} - name: ๐Ÿ“š Checkout ${{ matrix.repository }} - uses: actions/checkout@v6 + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: + persist-credentials: false repository: ${{ github.repository_owner }}/${{ matrix.repository }} ref: ${{ matrix.branch }} path: target token: ${{ steps.ci-bot-token.outputs.token }} - name: ๐ŸŽฏ Install Dart - uses: dart-lang/setup-dart@v1 + uses: dart-lang/setup-dart@2286a0c042b44434fe26d292bbce8d34f7ec662b # v1.8.2 - name: ๐Ÿ“ Copy Style Guides run: dart run scripts/sync_style_guides.dart target @@ -93,7 +99,7 @@ jobs: # opened when the copy is already up to date, and an open sync PR is # updated in place rather than duplicated. - name: ๐Ÿ“ค Open Pull Request - uses: peter-evans/create-pull-request@v7 + uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7.0.11 with: path: target token: ${{ steps.ci-bot-token.outputs.token }} diff --git a/.github/workflows/update_goldens.yml b/.github/workflows/update_goldens.yml index 5c3c42f3a..6320c7281 100644 --- a/.github/workflows/update_goldens.yml +++ b/.github/workflows/update_goldens.yml @@ -6,24 +6,19 @@ permissions: contents: read jobs: - update_goldens: - runs-on: - group: github-public-amd64 + # Renders on a free runner, the one `test` in stream_core_flutter_workflow.yml + # compares on; change both together. + render: + name: Render Goldens + runs-on: ubuntu-latest steps: - - name: ๐Ÿ”‘ Mint CI Bot Token - id: ci-bot-token - uses: actions/create-github-app-token@v3 - with: - client-id: ${{ vars.FLUTTER_CI_BOT_CLIENT_ID }} - private-key: ${{ secrets.FLUTTER_CI_BOT_PRIVATE_KEY }} - - name: ๐Ÿ“š Checkout branch - uses: actions/checkout@v6 + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: persist-credentials: false - name: ๐Ÿฆ Install Flutter - uses: subosito/flutter-action@v2 + uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0 with: flutter-version: "3.x" channel: stable @@ -40,9 +35,45 @@ jobs: continue-on-error: true run: melos run update:goldens + - name: ๐Ÿ“ค Upload Goldens + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: goldens + path: "**/test/**/goldens/**/*.png" + if-no-files-found: error + retention-days: 1 + + # Committing calls the GitHub API, which the org IP allow list only permits + # from the static-IP runners. + commit: + name: Commit Goldens + needs: render + runs-on: + group: github-public-amd64 + steps: + - name: ๐Ÿ”‘ Mint CI Bot Token + id: ci-bot-token + uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0 + with: + client-id: ${{ vars.FLUTTER_CI_BOT_CLIENT_ID }} + private-key: ${{ secrets.FLUTTER_CI_BOT_PRIVATE_KEY }} + + # Only for the local bot-commit action. + - name: ๐Ÿ“š Checkout actions + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false + sparse-checkout: .github/actions + + - name: ๐Ÿ“ฅ Download Goldens + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: goldens + - name: ๐Ÿ“ค Commit Changes - uses: GetStream/stream-core-flutter/.github/actions/bot-commit@68fdf0bf3c779f640dbb10a1ecf7945d872408f7 + uses: ./.github/actions/bot-commit with: files: "**/test/**/goldens/**/*.png" message: "chore: Update Goldens" token: ${{ steps.ci-bot-token.outputs.token }} + detect-changes: "false" diff --git a/.github/workflows/update_top_level_domains.yml b/.github/workflows/update_top_level_domains.yml index a3df8a002..fe80474e3 100644 --- a/.github/workflows/update_top_level_domains.yml +++ b/.github/workflows/update_top_level_domains.yml @@ -11,14 +11,17 @@ permissions: jobs: update_top_level_domains: + name: Update Top-Level Domains runs-on: group: github-public-amd64 steps: - name: ๐Ÿ“š Git Checkout - uses: actions/checkout@v6 + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false - name: ๐ŸŽฏ Install Dart - uses: dart-lang/setup-dart@v1 + uses: dart-lang/setup-dart@2286a0c042b44434fe26d292bbce8d34f7ec662b # v1.8.2 # Leaves the file as it is when the list of domains has not changed, so # no pull request is opened then. @@ -27,7 +30,7 @@ jobs: - name: ๐Ÿ”‘ Mint CI Bot Token id: ci-bot-token - uses: actions/create-github-app-token@v3 + uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0 with: client-id: ${{ vars.FLUTTER_CI_BOT_CLIENT_ID }} private-key: ${{ secrets.FLUTTER_CI_BOT_PRIVATE_KEY }} @@ -35,7 +38,7 @@ jobs: # Opened with the CI bot's app token so the pull request's checks run, which # they don't for one opened with the workflow's own token. - name: ๐Ÿ“ค Open Pull Request - uses: peter-evans/create-pull-request@v7 + uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7.0.11 with: token: ${{ steps.ci-bot-token.outputs.token }} branch: chore/update-top-level-domains diff --git a/CLAUDE.md b/CLAUDE.md index a0aa838df..f03c5f73b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -63,6 +63,16 @@ file-type assets. `style_guides/` holds the guides every Stream Flutter SDK follows (today `API_DESIGN.md`). The other SDKs carry a copy: on every change to `main`, the `sync_style_guides` workflow runs `scripts/sync_style_guides.dart` against stream-chat-flutter (`master`), stream-video-flutter (`v2`) and stream-feeds-flutter (`main`), and opens a PR in each whose copy changed. Edit the guides here only. They are self-contained: `STYLE_GUIDE.md` points at them, never the reverse, and a relative link out of `style_guides/` fails the workflow's PR check. A new file in the folder is synced automatically; a new target repository is a new entry in the workflow's matrix. +### CI runners + +The `GetStream` organization has an IP allow list, and it refuses every GitHub API call made with a token from GitHub's standard runners (`ubuntu-latest`, `macos-latest`), reads included; pushing with git is refused too. Checking out (a git read) and OIDC sign-in (Codecov, the Google Cloud deploys) work there. So: + +- A job that only checks out, builds, tests or deploys outside GitHub runs on a free standard runner. +- A job that calls the GitHub API, or pushes, runs on the static-IP group (`runs-on: { group: github-public-amd64 }`), which is billed per minute. Keep it small: do the heavy work in a free job and hand the result over, as `update_goldens.yml` and `pr_web_build.yml` do. `bot-commit` and `flutter-web-pr-comment` are such calls. +- To skip work for unrelated changes, use the reusable `detect_changes.yml`, which diffs with git, not `dorny/paths-filter`, which calls the API on pull requests. A gate's dependent job should still run when the gate fails, since a skipped required check passes; see the example in its header. + +Pin every action to a full commit SHA with its version in a comment; Dependabot (`.github/dependabot.yml`) bumps them weekly. + ### Web deploys The Flutter web demos are hosted at `https://flutter.getstream.io//`, set up in `GetStream/chat` under `infra/flutter-web`: prod at `//`, beta at `//beta/`, and pull requests labeled `build` at `//pr//`. Four composite actions in `.github/actions/` hold what every repository must do the same way, for this repository and for the other SDKs: