-
Notifications
You must be signed in to change notification settings - Fork 137
ci: run selected example charm integration tests on PRs #2655
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
Open
dwilding
wants to merge
1
commit into
canonical:main
Choose a base branch
from
dwilding:example-charm-integration-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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
218 changes: 218 additions & 0 deletions
218
.github/workflows/example-charm-integration-tests-prs.yaml
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 |
|---|---|---|
| @@ -0,0 +1,218 @@ | ||
| name: Selected Example Charm Integration Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| # Cancel in-flight runs when new commits are pushed to the same PR. | ||
| group: example-charm-integration-tests-prs-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| # Detect which example directories have changed on this PR. | ||
| detect-changes: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| machine-tinyproxy: ${{ steps.check.outputs.machine-tinyproxy }} | ||
| k8s-1-minimal: ${{ steps.check.outputs.k8s-1-minimal }} | ||
| k8s-2-configurable: ${{ steps.check.outputs.k8s-2-configurable }} | ||
| k8s-3-postgresql: ${{ steps.check.outputs.k8s-3-postgresql }} | ||
| k8s-4-action: ${{ steps.check.outputs.k8s-4-action }} | ||
| k8s-5-observe: ${{ steps.check.outputs.k8s-5-observe }} | ||
| httpbin-demo: ${{ steps.check.outputs.httpbin-demo }} | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | ||
| with: | ||
| persist-credentials: false | ||
| fetch-depth: 0 # Need full history to diff against the base branch. | ||
| - id: check | ||
| run: | | ||
| examples='machine-tinyproxy k8s-1-minimal k8s-2-configurable k8s-3-postgresql k8s-4-action k8s-5-observe httpbin-demo' | ||
| # GITHUB_BASE_REF is a default env var set by GitHub Actions. | ||
| base="origin/$GITHUB_BASE_REF" | ||
| for dir in $examples; do | ||
| if git diff --name-only "$base...HEAD" -- "examples/$dir/" | grep -q .; then | ||
| echo "$dir=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "$dir=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
| done | ||
|
|
||
| machine-tinyproxy: | ||
| needs: detect-changes | ||
| if: ${{ needs.detect-changes.outputs.machine-tinyproxy == 'true' }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 | ||
| - name: Set up tox and tox-uv | ||
| run: uv tool install tox --with tox-uv | ||
| - name: Install Concierge | ||
| run: sudo snap install --classic concierge | ||
| - name: Prepare for deploying machine charms | ||
| run: sudo concierge prepare -p machine | ||
| timeout-minutes: 90 # Abandon the job if the GHA runner gets stuck. | ||
| - name: Pack charm | ||
| working-directory: examples/machine-tinyproxy | ||
| run: charmcraft pack | ||
| - name: Run integration tests | ||
| working-directory: examples/machine-tinyproxy | ||
| run: tox -e integration | ||
|
|
||
| k8s-1-minimal: | ||
| needs: detect-changes | ||
| if: ${{ needs.detect-changes.outputs.k8s-1-minimal == 'true' }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 | ||
| - name: Set up tox and tox-uv | ||
| run: uv tool install tox --with tox-uv | ||
| - name: Install Concierge | ||
| run: sudo snap install --classic concierge | ||
| - name: Prepare for deploying K8s charms | ||
| run: sudo concierge prepare -p k8s | ||
| timeout-minutes: 90 # Abandon the job if the GHA runner gets stuck. | ||
| - name: Pack charm | ||
| working-directory: examples/k8s-1-minimal | ||
| run: charmcraft pack | ||
| - name: Run integration tests | ||
| working-directory: examples/k8s-1-minimal | ||
| run: tox -e integration | ||
|
|
||
| k8s-2-configurable: | ||
| needs: detect-changes | ||
| if: ${{ needs.detect-changes.outputs.k8s-2-configurable == 'true' }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 | ||
| - name: Set up tox and tox-uv | ||
| run: uv tool install tox --with tox-uv | ||
| - name: Install Concierge | ||
| run: sudo snap install --classic concierge | ||
| - name: Prepare for deploying K8s charms | ||
| run: sudo concierge prepare -p k8s | ||
| timeout-minutes: 90 # Abandon the job if the GHA runner gets stuck. | ||
| - name: Pack charm | ||
| working-directory: examples/k8s-2-configurable | ||
| run: charmcraft pack | ||
| - name: Run integration tests | ||
| working-directory: examples/k8s-2-configurable | ||
| run: tox -e integration | ||
|
|
||
| k8s-3-postgresql: | ||
| needs: detect-changes | ||
| if: ${{ needs.detect-changes.outputs.k8s-3-postgresql == 'true' }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 | ||
| - name: Set up tox and tox-uv | ||
| run: uv tool install tox --with tox-uv | ||
| - name: Install Concierge | ||
| run: sudo snap install --classic concierge | ||
| - name: Prepare for deploying K8s charms | ||
| run: sudo concierge prepare -p k8s | ||
| timeout-minutes: 90 # Abandon the job if the GHA runner gets stuck. | ||
| - name: Fetch charmlibs | ||
| working-directory: examples/k8s-3-postgresql | ||
| run: charmcraft fetch-libs | ||
| - name: Pack charm | ||
| working-directory: examples/k8s-3-postgresql | ||
| run: charmcraft pack | ||
| - name: Run integration tests | ||
| working-directory: examples/k8s-3-postgresql | ||
| run: tox -e integration | ||
|
|
||
| k8s-4-action: | ||
| needs: detect-changes | ||
| if: ${{ needs.detect-changes.outputs.k8s-4-action == 'true' }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 | ||
| - name: Set up tox and tox-uv | ||
| run: uv tool install tox --with tox-uv | ||
| - name: Install Concierge | ||
| run: sudo snap install --classic concierge | ||
| - name: Prepare for deploying K8s charms | ||
| run: sudo concierge prepare -p k8s | ||
| timeout-minutes: 90 # Abandon the job if the GHA runner gets stuck. | ||
| - name: Fetch charmlibs | ||
| working-directory: examples/k8s-4-action | ||
| run: charmcraft fetch-libs | ||
| - name: Pack charm | ||
| working-directory: examples/k8s-4-action | ||
| run: charmcraft pack | ||
| - name: Run integration tests | ||
| working-directory: examples/k8s-4-action | ||
| run: tox -e integration | ||
|
|
||
| k8s-5-observe: | ||
| needs: detect-changes | ||
| if: ${{ needs.detect-changes.outputs.k8s-5-observe == 'true' }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 | ||
| - name: Set up tox and tox-uv | ||
| run: uv tool install tox --with tox-uv | ||
| - name: Install Concierge | ||
| run: sudo snap install --classic concierge | ||
| - name: Prepare for deploying K8s charms | ||
| run: sudo concierge prepare -p k8s | ||
| timeout-minutes: 90 # Abandon the job if the GHA runner gets stuck. | ||
| - name: Fetch charmlibs | ||
| working-directory: examples/k8s-5-observe | ||
| run: charmcraft fetch-libs | ||
| - name: Pack charm | ||
| working-directory: examples/k8s-5-observe | ||
| run: charmcraft pack | ||
| - name: Run integration tests | ||
| working-directory: examples/k8s-5-observe | ||
| run: tox -e integration | ||
|
|
||
| httpbin-demo: | ||
| needs: detect-changes | ||
| if: ${{ needs.detect-changes.outputs.httpbin-demo == 'true' }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 | ||
| - name: Set up tox and tox-uv | ||
| run: uv tool install tox --with tox-uv | ||
| - name: Install Concierge | ||
| run: sudo snap install --classic concierge | ||
| - name: Prepare for deploying K8s charms | ||
| run: sudo concierge prepare -p k8s | ||
| timeout-minutes: 90 # Abandon the job if the GHA runner gets stuck. | ||
| - name: Pack charm | ||
| working-directory: examples/httpbin-demo | ||
| run: charmcraft pack | ||
| - name: Run integration tests | ||
| working-directory: examples/httpbin-demo | ||
| run: tox -e integration | ||
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.
I'd be fine with dropping this. It can be quite annoying having to wait for integration tests to start from scratch because you pushed a little unrelated docs change or whatever -- and likewise, I think it's bad if you're incentivised to delay pushing to not interrupt the test run.