Skip to content

Conversation

@ryan-son
Copy link
Owner

@ryan-son ryan-son commented Aug 15, 2025

Description

This PR introduces a major refactoring of the CI/CD pipeline to improve efficiency, clarity, and robustness, inspired by best practices from mature open-source projects.

The key goals are to speed up CI runs, provide better integration validation, and make the overall workflow system more modular and maintainable.


Key Changes & Rationale

1. Workflow Separation

  • The CI process has been split into two distinct files:
    • ci.yml: Now exclusively handles building the library, running tests, and building the example app. It runs on all pushes and pull requests.
    • documentation.yml: A new workflow dedicated to generating and deploying DocC documentation. It now runs only on pushes to main.

2. Example App Integration Test

  • A new build-example-app job has been added to swift-ci.yml.
  • This job attempts to build the SwiftUI example app using xcodebuild, acting as a vital integration test that verifies that PactKitCore can be successfully consumed by a client application.

3. Caching Strategy for Performance

  • Caching has been added to both CI jobs to dramatically speed up subsequent runs:
    • test-and-build-library job: Caches the .build directory, which is the artifact folder for the swift test command.
    • build-example-app job: Caches the ~/Library/Developer/Xcode/DerivedData directory, which is the artifact folder for xcodebuild.
  • Each job caches the appropriate directory for its specific build tool, ensuring optimal performance.

4. Concurrency Control

  • Both workflows now include a concurrency block to automatically cancel in-progress runs when new commits are pushed to the same branch, saving time and resources.

This commit introduces a major refactoring of the CI/CD pipeline for
improved efficiency, clarity, and robustness.

- **Workflow Separation:** The CI process is now split into two distinct
  workflows: `swift-ci.yml` for testing and `documentation.yml` for
  deploying docs. This prevents unnecessary documentation deployments
  on pull requests.

- **Documentation Fix:** The `documentation.yml` workflow has been
  updated to use a more robust deployment action (`JamesIves/github-pages-deploy-action`)
  and now creates a `.nojekyll` file to prevent GitHub Pages from
  incorrectly trying to build a Jekyll site.

- **Example App Validation:** The main `swift-ci.yml` workflow now
  includes a separate job to build the `PactKit-iOS-Example` app.
  This serves as a crucial integration test, ensuring the library
  builds and links correctly in a real application environment.

- **Concurrency:** A concurrency group has been added to both workflows
  to automatically cancel redundant runs, saving CI resources.
@ryan-son ryan-son self-assigned this Aug 15, 2025
@ryan-son ryan-son added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels Aug 15, 2025
@ryan-son ryan-son merged commit db0f4e7 into main Aug 15, 2025
2 checks passed
@ryan-son ryan-son deleted the chore/separate-ci-workflows branch August 15, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants