-
Notifications
You must be signed in to change notification settings - Fork 0
feat(ci): run integration tests on Dependabot PRs #149
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
zfarrell
wants to merge
2
commits into
main
Choose a base branch
from
feat/dependabot-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.
+61
−0
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| name: Dependabot Integration Tests | ||
|
|
||
| # Dependabot-triggered runs are sandboxed by GitHub: a read-only GITHUB_TOKEN and | ||
| # access only to the *Dependabot* secrets store — Actions secrets and variables | ||
| # resolve to empty strings, and this holds for pull_request and pull_request_target | ||
| # alike (the restriction keys on the PR author being dependabot[bot], not on the | ||
| # trigger). So the normal Integration Tests workflow skips every credentialed | ||
| # scenario on a bump and reports green without testing anything. | ||
| # | ||
| # This job runs the real suite for Dependabot bumps by reading all four test | ||
| # credentials from `secrets.*`, which on a Dependabot run resolve to the | ||
| # Dependabot store. They must be set there: | ||
| # Settings -> Secrets and variables -> Dependabot | ||
| # HOTDATA_SDK_TEST_API_URL | ||
| # HOTDATA_SDK_TEST_API_KEY | ||
| # HOTDATA_SDK_TEST_WORKSPACE_ID | ||
| # HOTDATA_SDK_TEST_CONNECTION_ID | ||
| # The non-secret three live in `vars` for normal runs but ride along here as | ||
| # secrets because Dependabot has no variables store. The guard below fails the | ||
| # job loudly if a credential is missing, so it can never pass green while | ||
| # silently skipping every scenario. | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: dependabot-integration-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| integration: | ||
| if: github.event.pull_request.user.login == 'dependabot[bot]' | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 20 | ||
| env: | ||
| HOTDATA_SDK_TEST_API_URL: ${{ secrets.HOTDATA_SDK_TEST_API_URL }} | ||
| HOTDATA_SDK_TEST_API_KEY: ${{ secrets.HOTDATA_SDK_TEST_API_KEY }} | ||
| HOTDATA_SDK_TEST_WORKSPACE_ID: ${{ secrets.HOTDATA_SDK_TEST_WORKSPACE_ID }} | ||
| HOTDATA_SDK_TEST_CONNECTION_ID: ${{ secrets.HOTDATA_SDK_TEST_CONNECTION_ID }} | ||
| steps: | ||
| - name: Require Dependabot credentials | ||
| run: | | ||
| test -n "$HOTDATA_SDK_TEST_API_KEY" || { echo "::error::HOTDATA_SDK_TEST_API_KEY is empty — set it as a *Dependabot* secret (Settings -> Secrets and variables -> Dependabot)."; exit 1; } | ||
| test -n "$HOTDATA_SDK_TEST_WORKSPACE_ID" || { echo "::error::HOTDATA_SDK_TEST_WORKSPACE_ID is empty — set it as a *Dependabot* secret."; exit 1; } | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable | ||
| # No cargo cache: building the bumped crate runs its build scripts, so we | ||
| # never persist a cache a later trusted run could restore. | ||
| - name: Run integration tests | ||
| # --no-fail-fast runs every scenario binary even after one fails, so a | ||
| # red run surfaces all failing scenarios at once. | ||
| run: cargo test --test '*' --no-fail-fast -- --nocapture | ||
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.
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.
super nit: this job checks out and executes untrusted dependency code (build scripts, proc-macros) with a live API key present, as the header comment acknowledges. Consider adding a
timeout-minutes:to the job as cheap defense-in-depth so a runaway/abusive build script can't sit on the credentialed runner indefinitely. (not blocking)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.
Added
timeout-minutes: 20to the job — good defense-in-depth, thanks.