ci: skip unused work and cancel old PR runs

- iOS tests: turn off coverage and the index store, and skip the
  benchmarks. No step reads them; the SwiftPM job gates the benchmarks.
- SwiftPM: remove the .build cache. A cache hit still recompiled every
  module, and restoring and saving it took about 35 s per app job.
- Cancel the older Build & Test and Dead Code runs of a PR on a new push.
- validate_georelays.yml: remove the note that the other PR workflows
  do not cancel old runs.
This commit is contained in:
Jozef Koval 2026-11-02 12:20:55 +01:00
parent 04995f68e4
commit d968e63280
3 changed files with 24 additions and 16 deletions

View File

@ -6,6 +6,12 @@ on:
- main
pull_request:
# A new push to a PR cancels the PR's older run. Other events get the run id
# as a unique group, so a run on main is never cancelled.
concurrency:
group: dead-code-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
periphery:
name: Periphery scan

View File

@ -6,6 +6,12 @@ on:
- main
pull_request:
# A new push to a PR cancels the PR's older run. Other events get the run id
# as a unique group, so a run on main is never cancelled.
concurrency:
group: build-and-test-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
test:
name: Run Swift Tests (${{ matrix.name }})
@ -36,24 +42,16 @@ jobs:
# the runner image. A standalone swift.org toolchain (setup-swift) broke
# whenever the image's Xcode moved ahead of it ("this SDK is not
# supported by the compiler").
- name: Note toolchain version (cache key)
id: swift-version
run: echo "version=$(swift --version 2>/dev/null | head -1 | shasum | cut -c1-12)" >> "$GITHUB_OUTPUT"
- name: Cache build artifacts
uses: actions/cache@v4
with:
path: ${{ matrix.path }}/.build
key: ${{ runner.os }}-${{ steps.swift-version.outputs.version }}-${{ matrix.name }}-${{ hashFiles(format('{0}/**/*.swift', matrix.path), format('{0}/**/Package.resolved', matrix.path)) }}
restore-keys: |
${{ runner.os }}-${{ steps.swift-version.outputs.version }}-${{ matrix.name }}-${{ hashFiles(format('{0}/**/Package.resolved', matrix.path)) }}
${{ runner.os }}-${{ steps.swift-version.outputs.version }}-${{ matrix.name }}-
- name: Show toolchain version
run: swift --version
# No .build cache: on a hit, SwiftPM still recompiled every module, and
# restoring and saving the cache took about 35 s in the app job.
- name: Build tests
# Built separately so the hang watchdog below times only test
# execution: a cold-cache coverage build on a slow runner can
# execution: a cold coverage build on a slow runner can
# legitimately take several minutes, and is already bounded by the
# 15-minute job timeout.
# 25-minute job timeout.
run: swift build --build-tests --enable-code-coverage --package-path ${{ matrix.path }}
- name: Run Tests
@ -253,6 +251,8 @@ jobs:
echo "Using iPhone simulator destination id: $destination_id"
echo "id=$destination_id" >> "$GITHUB_OUTPUT"
# Coverage and the index store are off, because no step reads them. The
# SwiftPM job already gates the benchmarks, so they are skipped here.
- name: Run iOS tests
run: |
set -o pipefail
@ -261,6 +261,9 @@ jobs:
-sdk iphonesimulator \
-destination "platform=iOS Simulator,id=${{ steps.destination.outputs.id }}" \
-parallel-testing-enabled NO \
-enableCodeCoverage NO \
-skip-testing:bitchatTests_iOS/PerformanceBaselineTests \
COMPILER_INDEX_STORE_ENABLE=NO \
CODE_SIGNING_ALLOWED=NO \
test

View File

@ -18,8 +18,7 @@ on:
permissions:
contents: read
# A superseded run has nothing left to report; the sibling PR workflows do not
# set this, so drop it if the repo prefers them uniform.
# A superseded run has nothing left to report.
concurrency:
group: validate-georelays-${{ github.ref }}
cancel-in-progress: true