Repository navigation
Conversation
Consolidate snap-publish from tests.yaml, docs spread tests from spread-docs.yaml, and manual spread tests from spread-manual.yaml into spread.yaml with a shared snap-build job so the snap is packed only once per workflow run.
| submodules: true | ||
|
|
||
| - name: Download snap artifact | ||
| uses: actions/download-artifact@v8 |
| mkdir "${{ github.workspace }}" | ||
|
|
||
| - name: Checkout charmcraft | ||
| uses: actions/checkout@v7 |
| name: snap | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v7 |
| submodules: true | ||
|
|
||
| - name: Download snap artifact | ||
| uses: actions/download-artifact@v8 |
| mkdir "${{ github.workspace }}" | ||
|
|
||
| - name: Checkout charmcraft | ||
| uses: actions/checkout@v7 |
Comment on lines
+34
to
+69
| filter: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| source: ${{ steps.filter.outputs.source }} | ||
| docs: ${{ steps.filter.outputs.docs }} | ||
| manual: ${{ steps.filter.outputs.manual == 'true' || steps.manual-eval.outputs.manual == 'true' }} | ||
| snap-needed: ${{ steps.filter.outputs.source == 'true' || steps.filter.outputs.docs == 'true' || steps.filter.outputs.manual == 'true' || steps.manual-eval.outputs.manual == 'true' }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 | ||
| id: filter | ||
| with: | ||
| filters: | | ||
| source: | ||
| - '!({docs/**,*.md,**/*.md,.readthedocs.yaml})' | ||
| - 'tests/spread/**' | ||
| - 'spread.yaml' | ||
| - '.github/workflows/spread.yaml' | ||
| docs: | ||
| - 'docs/**/code/**' | ||
| - 'spread.yaml' | ||
| - '.readthedocs.yaml' | ||
| - '.github/workflows/spread.yaml' | ||
| manual: | ||
| - 'tests/spread/charms/**' | ||
| - 'tests/spread/smoketests/parallel-build/**' | ||
| - 'tests/spread/smoketests/remote-build/**' | ||
| - '.github/workflows/spread.yaml' | ||
| - id: manual-eval | ||
| env: | ||
| IS_MANUAL: "${{ contains(github.event.pull_request.labels.*.name, 'PR: Run Manual Spread') }}" | ||
| run: | | ||
| echo "manual=${IS_MANUAL}" >> "$GITHUB_OUTPUT" |
Comment on lines
+212
to
+216
| - name: Checkout charmcraft | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| fetch-depth: 0 | ||
| submodules: true |
Comment on lines
+243
to
+247
| - name: Checkout charmcraft | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| fetch-depth: 0 | ||
| submodules: true |
Comment on lines
+42
to
+45
| - name: Checkout code | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| fetch-depth: 0 |
Comment on lines
+298
to
+302
| - name: Checkout charmcraft | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| fetch-depth: 0 | ||
| submodules: true |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Consolidate snap-dependent jobs into a single unified
spread.yamlworkflow so that the Charmcraft snap is built once and shared across all spread test jobs and PR snap publishing, eliminating redundant snap builds.Problem
Previously, four separate workflows each defined independent
snap-buildjobs usingaction-build:tests.yamlbuilt the snap on every PR solely to publish it toedge/pr-*.spread.yamlbuilt the snap on every PR to run source and store spread tests.spread-docs.yamlbuilt the snap whenever doc code changed to run doc spread tests.spread-manual.yamlbuilt the snap whenever manual spread runs were triggered.Across a single PR's lifecycle (PR creation and subsequent merge to
main), the exact same snap was built up to 5 times, wasting runner time and delaying test completion.Solution
snap-publish(fromtests.yaml),docs-tests(fromspread-docs.yaml), andmanual-spread-tests(fromspread-manual.yaml) into.github/workflows/spread.yaml.filterstep viadorny/paths-filterto detect whether source, docs, or manual spread runs are needed.snap-build(upgraded tocanonical/action-build@v1) only when needed, and share the build artifact across all downstream jobs.tests.yaml,spread-docs.yaml, andspread-manual.yamlworkflow files.Testsbadge inREADME.mdto point toqa.yamlwhere unit and integration tests actually run.Verification
actionlint(0 errors).zizmor(eliminated multiple unpinned/deprecated warnings and excessive permission warnings from removed workflows).ruff check,ruff format --diff,ty check, andmake test-fast.