Skip to content

Move package test running to test script#70

Open
graeme wants to merge 7 commits into
mainfrom
swift-test-script
Open

Move package test running to test script#70
graeme wants to merge 7 commits into
mainfrom
swift-test-script

Conversation

@graeme

@graeme graeme commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

PR: Add scripts/test and run Swift package tests in CI

Summary

Adds a scripts/test helper that runs the Swift Package tests for both packages — BrewKit (root Package.swift) and BrewUILint (Tools/BrewUILint/Package.swift) — and wires those same tests into the pr_build_test CI workflow so local runs and CI stay in parity.

Changes

CI (.github/workflows/pr_build_test.yml)

  • Broadened the path filters that trigger the workflow to include Sources/**, Tests/**, Package.swift, and Tools/BrewUILint/**.
  • Renamed the existing build step to "Build and test (Xcode app target)" for clarity.
  • Added swift test steps for the BrewKit and BrewUILint packages, each with a .build cache keyed on its package manifests/sources.
  • Extended the failure log artifact to also upload swift-test-brewkit.log and swift-test-brewuilint.log.

Tooling (scripts/test)

  • New executable script that runs swift test for both packages and mirrors the CI steps, so green locally means green on CI.

Docs (AGENTS.md)

  • Documented scripts/test and when agents should run it: before any commit, and before reporting a code-changing turn complete when Swift sources, package manifests, or the CI workflow changed.

Testing

  • scripts/test runs and exits 0 (BrewKit + BrewUILint package tests pass locally).
  • CI workflow YAML reviewed for the added steps, cache keys, and artifact paths.

PR checklist

  • Have you followed this repository's contribution and workflow guidance?
  • Have you explained what changed and why this should land now?
  • Have you run relevant local checks for the changed scope?
  • Are changes scoped and free of unrelated modifications?

  • AI was used to generate or assist with generating this PR.
  • If yes, describe exactly how AI was used and what manual verification was performed: AI drafted this PR description from the branch diff. The script and workflow changes were authored and verified manually by running scripts/test locally.

Copilot AI review requested due to automatic review settings June 18, 2026 12:56
@graeme graeme requested a review from MikeMcQuaid June 18, 2026 12:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a local scripts/test helper to run Swift Package tests for both the root package (“BrewKit”) and Tools/BrewUILint, then wires those same package tests into the pr_build_test GitHub Actions workflow to keep local and CI test execution aligned.

Changes:

  • Add scripts/test to run xcrun swift test for the root package and Tools/BrewUILint.
  • Update pr_build_test CI to run both SwiftPM test suites, cache .build outputs, and upload SwiftPM test logs on failure.
  • Document scripts/test usage expectations for agents in AGENTS.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
scripts/test New local helper script to run SwiftPM tests for both packages.
AGENTS.md Documents when to run scripts/test for local/CI parity.
.github/workflows/pr_build_test.yml Adds SwiftPM test steps + caches + failure log uploads, and broadens workflow path filters.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/pr_build_test.yml
Comment thread .github/workflows/pr_build_test.yml
Comment thread .github/workflows/pr_build_test.yml Outdated
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: .build
key: ${{ runner.os }}-brewkit-${{ hashFiles('Package.swift', 'Package.resolved') }}
Comment thread .github/workflows/pr_build_test.yml Outdated
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: Tools/BrewUILint/.build
key: ${{ runner.os }}-brewuilint-${{ hashFiles('Tools/BrewUILint/Package.swift', 'Tools/BrewUILint/Package.resolved', 'Tools/BrewUILint/Sources/**', 'Tools/BrewUILint/Plugins/**') }}
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

graeme and others added 4 commits June 19, 2026 18:55
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
The .build caches keyed only on package manifests with bare restore-keys
prefixes, so a runner-image Xcode/Swift bump could restore artifacts built
by a different compiler. Add a swift --version fingerprint to each cache
key and restore-keys prefix so the cache busts on a real toolchain change
while staying warm across ordinary source edits.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants