-
Notifications
You must be signed in to change notification settings - Fork 8
CI cleanup: cache vendor + node_modules, --no-deps, doc each workflow, rework apispec #419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
turegjorup
merged 8 commits into
feature/update-infrastructure-for-mono-repo
from
feature/ci-cleanup
May 1, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
692087c
Cache vendor across PHP CI workflows
turegjorup 012a980
Skip mariadb startup for database-less PHP workflows
turegjorup ef586bf
Cache node_modules in JS CI workflows
turegjorup 016209f
Drop no-op strategy/fail-fast blocks from non-matrix jobs
turegjorup 200654b
Drop itk-dev tooling header, document every workflow uniformly
turegjorup b0be84c
Comment on PR only when api-spec drifts or changes
turegjorup 1501b0a
Re-run CI to measure cache-hot timings
turegjorup cb3d3df
Update changelog for CI cleanup
turegjorup File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,160 @@ | ||
| on: pull_request | ||
| ### ### Api Spec | ||
| ### | ||
| ### Re-exports the OpenAPI spec (`public/api-spec-v2.{yaml,json}`) from the | ||
| ### API Platform configuration. Posts a PR comment **only** when something | ||
| ### needs attention — spec drift, non-breaking changes, or breaking changes — | ||
| ### and stays quiet otherwise. The comment is edited in place across runs | ||
| ### so a PR carries at most one comment from this workflow. | ||
| ### | ||
| ### #### Assumptions | ||
| ### | ||
| ### 1. A docker compose service named `phpfpm` can be run and `bin/console` | ||
| ### can be run inside the `phpfpm` service. | ||
| ### 2. The committed `public/api-spec-v2.{yaml,json}` are kept in sync with | ||
| ### the API Platform configuration via `composer update-api-spec`. | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - "src/**/*.php" | ||
| - "config/**" | ||
| - "composer.json" | ||
| - "composer.lock" | ||
| - "public/api-spec-v2.yaml" | ||
| - "public/api-spec-v2.json" | ||
| - "docker-compose.yml" | ||
|
|
||
| name: Api Spec | ||
|
|
||
| env: | ||
| COMPOSE_USER: runner | ||
|
|
||
| jobs: | ||
| apispec: | ||
| api-spec-export: | ||
| name: Ensure API specification is up to date | ||
| runs-on: ubuntu-latest | ||
| name: API Specification validation | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Cache vendor | ||
| uses: actions/cache@v5 | ||
| with: | ||
| fetch-depth: 2 | ||
| path: vendor | ||
| key: vendor-php8.4-${{ hashFiles('composer.lock') }} | ||
| restore-keys: vendor-php8.4- | ||
|
|
||
| - name: Setup network | ||
| run: docker network create frontend | ||
|
|
||
| - name: Install Dependencies | ||
| run: docker compose run --rm phpfpm composer install | ||
|
|
||
| - name: Export specifications (yaml) | ||
| run: docker compose run --rm phpfpm bin/console api:openapi:export --yaml --output=public/api-spec-v2.yaml --no-interaction | ||
| - name: Export specifications | ||
| run: | | ||
| docker compose run --rm phpfpm bin/console api:openapi:export --yaml --output=public/api-spec-v2.yaml --no-interaction | ||
| docker compose run --rm phpfpm bin/console api:openapi:export --output=public/api-spec-v2.json --no-interaction | ||
|
|
||
| - name: Check for uncommitted changes | ||
| id: git-diff-spec | ||
| continue-on-error: true | ||
| run: git diff --diff-filter=ACMRT --exit-code public/api-spec-v2.yaml public/api-spec-v2.json | ||
|
|
||
| - name: Comment PR if spec is outdated | ||
| if: steps.git-diff-spec.outcome == 'failure' | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| gh pr comment ${{ github.event.pull_request.number }} \ | ||
| --body "$(cat <<'EOF' | ||
| ## API specification not up to date | ||
|
|
||
| The committed API specification files do not match the exported output. | ||
|
|
||
| Please run the following command, then commit and push the changes: | ||
|
|
||
| ```shell | ||
| docker compose exec phpfpm composer update-api-spec | ||
| ``` | ||
| EOF | ||
| )" \ | ||
| --create-if-none --edit-last | ||
|
|
||
| - name: Fail if spec is outdated | ||
| if: steps.git-diff-spec.outcome == 'failure' | ||
| run: exit 1 | ||
|
|
||
| api-spec-breaking-changes: | ||
| name: Detect breaking changes in API specification | ||
| runs-on: ubuntu-latest | ||
| needs: [api-spec-export] | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Fetch base branch for comparison | ||
| run: git fetch --depth=1 origin ${{ github.base_ref }} | ||
|
|
||
| - name: Detect breaking changes | ||
| id: breaking | ||
| continue-on-error: true | ||
| uses: oasdiff/oasdiff-action/breaking@v0.0.44 | ||
| with: | ||
| base: "origin/${{ github.base_ref }}:public/api-spec-v2.yaml" | ||
| revision: "public/api-spec-v2.yaml" | ||
| fail-on: ERR | ||
|
|
||
| - name: Generate changelog | ||
| id: changelog | ||
| continue-on-error: true | ||
| uses: oasdiff/oasdiff-action/changelog@v0.0.44 | ||
| with: | ||
| base: "origin/${{ github.base_ref }}:public/api-spec-v2.yaml" | ||
| revision: "public/api-spec-v2.yaml" | ||
| format: markdown | ||
| output-to-file: changelog.md | ||
|
|
||
| # Stay quiet when nothing changed — neither breaking nor non-breaking. | ||
| # Comments only fire on the two branches below. | ||
|
|
||
| - name: Check for changes in specifications (yaml) | ||
| run: git diff --diff-filter=ACMRT --exit-code public/api-spec-v2.yaml | ||
| - name: Comment PR - non-breaking changes | ||
| if: steps.breaking.outcome == 'success' && hashFiles('changelog.md') != '' | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| { | ||
| echo "## API Specification - Non-breaking changes" | ||
| echo "" | ||
| cat changelog.md | ||
| } > comment.md | ||
| gh pr comment ${{ github.event.pull_request.number }} \ | ||
| --body-file comment.md \ | ||
| --create-if-none --edit-last | ||
|
|
||
| - name: Export specifications (json) | ||
| run: docker compose run --rm phpfpm bin/console api:openapi:export --output=public/api-spec-v2.json --no-interaction | ||
| - name: Comment PR - breaking changes | ||
| if: steps.breaking.outcome == 'failure' | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| { | ||
| echo "## API Specification - Breaking changes detected" | ||
| echo "" | ||
| if [ -s changelog.md ]; then | ||
| cat changelog.md | ||
| else | ||
| echo "The breaking changes action detected incompatible changes. Review the action logs for details." | ||
| fi | ||
| } > comment.md | ||
| gh pr comment ${{ github.event.pull_request.number }} \ | ||
| --body-file comment.md \ | ||
| --create-if-none --edit-last | ||
|
|
||
| - name: Check for changes in specifications (json) | ||
| run: git diff --diff-filter=ACMRT --exit-code public/api-spec-v2.json | ||
| - name: Fail if breaking changes detected | ||
| if: steps.breaking.outcome == 'failure' | ||
| run: exit 1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we handle if we want to merge breaking changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With comment on PR explaining motivation/reasoning.