-
Notifications
You must be signed in to change notification settings - Fork 72
QVAC-16473 infra: add suite filtering and PR-triggered e2e test workflows for SDK #1653
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
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8ad4ca0
infra: add suite filtering and PR-triggered e2e test workflows for SDK
lauripiisang 6143f50
infra: add Device Farm artifact download and upload to Android SDK te…
lauripiisang 7f00ea8
infra: fix CodeQL alert in on-pr-test-sdk.yml
lauripiisang 2e76a4e
infra: improve Android Device Farm logging with continuous background…
lauripiisang 0e8a23e
infra: increase Device Farm cleanup wait to 30 min for artifact download
lauripiisang f7cad8f
Merge branch 'main' into test/sdk-run-smoke-suite
lauripiisang 81d7655
fix: fix security issue caused by allowing out-of-date labeled prs
lauripiisang fc1c574
Merge branch 'main' into test/sdk-run-smoke-suite
lauripiisang ffd4a46
Merge branch 'main' into test/sdk-run-smoke-suite
lauripiisang 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,105 @@ | ||
| # QVAC SDK E2E Tests - PR Trigger | ||
| # | ||
| # Triggers SDK e2e tests via test-sdk.yml when: | ||
| # - "test-e2e-smoke" label applied: runs smoke suite on all platforms | ||
| # - "test-e2e-full" label applied: runs full suite on all platforms | ||
| # - PR opened/updated targeting release-* branch with packages/sdk/ changes: runs full suite | ||
| # | ||
| # On success, applies "e2e-tested" label to the PR. | ||
| # | ||
| # Uses pull_request_target for secrets access (Device Farm, MQTT). | ||
| # Authorization gate prevents untrusted fork PRs from running. | ||
|
|
||
| name: QVAC Tests (sdk) - PR | ||
|
|
||
| on: | ||
| pull_request_target: | ||
| types: [labeled, opened, synchronize] | ||
| paths: | ||
| - "packages/sdk/**" | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| packages: read | ||
|
|
||
| jobs: | ||
| resolve-config: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| should-run: ${{ steps.check.outputs.should-run }} | ||
| suite: ${{ steps.check.outputs.suite }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Authorize PR | ||
| id: auth | ||
| uses: ./.github/actions/authorize-pr | ||
| with: | ||
| label: safe-to-test | ||
| github-token: ${{ github.token }} | ||
|
|
||
| - name: Determine test config | ||
| if: steps.auth.outputs.allowed == 'true' | ||
| id: check | ||
| shell: bash | ||
| run: | | ||
| EVENT="${{ github.event.action }}" | ||
| LABEL="${{ github.event.label.name }}" | ||
| TARGET="${{ github.base_ref }}" | ||
|
|
||
| if [ "$EVENT" = "labeled" ]; then | ||
| if [ "$LABEL" = "test-e2e-smoke" ]; then | ||
| echo "should-run=true" >> "$GITHUB_OUTPUT" | ||
| echo "suite=smoke" >> "$GITHUB_OUTPUT" | ||
| elif [ "$LABEL" = "test-e2e-full" ]; then | ||
| echo "should-run=true" >> "$GITHUB_OUTPUT" | ||
| echo "suite=" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "::notice::Ignoring unrelated label: $LABEL" | ||
| echo "should-run=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
| elif echo "$TARGET" | grep -q '^release-'; then | ||
| git fetch origin "refs/pull/${{ github.event.pull_request.number }}/head" | ||
| CHANGED=$(git diff --name-only "${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}" -- packages/sdk/) | ||
| if [ -n "$CHANGED" ]; then | ||
| echo "::notice::Release branch PR with SDK changes — running full suite" | ||
| echo "should-run=true" >> "$GITHUB_OUTPUT" | ||
| echo "suite=" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "::notice::Release branch PR but no changes in packages/sdk/ — skipping" | ||
| echo "should-run=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
| else | ||
| echo "should-run=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| run-tests: | ||
Check failureCode scanning / CodeQL Checkout of untrusted code in trusted context High
Potential execution of untrusted code on a privileged workflow (
pull_request_target Error loading related location Loading |
||
| needs: resolve-config | ||
| if: needs.resolve-config.outputs.should-run == 'true' | ||
| uses: ./.github/workflows/test-sdk.yml | ||
| with: | ||
| targets: all | ||
| suite: ${{ needs.resolve-config.outputs.suite }} | ||
| secrets: inherit | ||
|
|
||
| apply-label: | ||
| needs: run-tests | ||
| if: success() | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| pull-requests: write | ||
| steps: | ||
| - name: Apply e2e-tested label | ||
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # 7.0.1 | ||
| with: | ||
| script: | | ||
| await github.rest.issues.addLabels({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.payload.pull_request.number, | ||
| labels: ['e2e-tested'] | ||
| }); | ||
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.
Uh oh!
There was an error while loading. Please reload this page.