|
1 | 1 | name: Test-all
|
2 |
| -run-name: All tests with extension build ${{ inputs.CLIENTS_BRANCH }} by @${{ github.actor }} |
| 2 | +run-name: All tests with extension build ${{ inputs.CLIENTS_BRANCH || github.event.client_payload.origin_branch }} by @${{ github.actor }} |
3 | 3 | on:
|
4 | 4 | push:
|
5 | 5 | branches:
|
6 | 6 | - "main"
|
| 7 | + repository_dispatch: |
| 8 | + types: [trigger-bit-tests] |
7 | 9 | pull_request:
|
8 | 10 | workflow_dispatch:
|
9 | 11 | inputs:
|
|
24 | 26 | id-token: write
|
25 | 27 | contents: read
|
26 | 28 | packages: read
|
| 29 | + pull-requests: write |
| 30 | + outputs: |
| 31 | + send_pr_feedback: false |
27 | 32 | steps:
|
| 33 | + - name: Send PR feedback check |
| 34 | + id: set-send-pr-feedback |
| 35 | + run: | |
| 36 | + echo "send_pr_feedback=github.event.client_payload.origin_issue && vars.ENABLE_PR_FEEDBACK == 'true'" >> "$GITHUB_OUTPUT" |
| 37 | +
|
| 38 | + - name: Log in to Azure |
| 39 | + uses: bitwarden/gh-actions/azure-login@main |
| 40 | + if: steps.set-send-pr-feedback.outputs.send_pr_feedback == 'true' |
| 41 | + with: |
| 42 | + subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} |
| 43 | + tenant_id: ${{ secrets.AZURE_TENANT_ID }} |
| 44 | + client_id: ${{ secrets.AZURE_CLIENT_ID }} |
| 45 | + |
| 46 | + - name: Get Azure Key Vault secrets |
| 47 | + id: get-kv-secrets |
| 48 | + uses: bitwarden/gh-actions/get-keyvault-secrets@main |
| 49 | + if: steps.set-send-pr-feedback.outputs.send_pr_feedback == 'true' |
| 50 | + with: |
| 51 | + keyvault: gh-org-bitwarden |
| 52 | + secrets: "BW-GHAPP-ID,BW-GHAPP-KEY" |
| 53 | + |
| 54 | + - name: Log out from Azure |
| 55 | + uses: bitwarden/gh-actions/azure-logout@main |
| 56 | + if: steps.set-send-pr-feedback.outputs.send_pr_feedback == 'true' |
| 57 | + |
| 58 | + - name: Generate GH App token |
| 59 | + id: app-token |
| 60 | + uses: actions/create-github-app-token@30bf6253fa41bdc8d1501d202ad15287582246b4 # v2.0.3 |
| 61 | + if: steps.set-send-pr-feedback.outputs.send_pr_feedback == 'true' |
| 62 | + with: |
| 63 | + app-id: ${{ steps.get-kv-secrets.outputs.BW-GHAPP-ID }} |
| 64 | + private-key: ${{ steps.get-kv-secrets.outputs.BW-GHAPP-KEY }} |
| 65 | + owner: bitwarden |
| 66 | + repositories: clients |
| 67 | + permission-actions: write |
| 68 | + |
28 | 69 | - name: Checkout
|
29 | 70 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
| 71 | + |
30 | 72 | - name: Setup Node
|
31 | 73 | uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
32 | 74 | with:
|
|
65 | 107 | github_token: ${{ secrets.GITHUB_TOKEN }}
|
66 | 108 | workflow: build-browser.yml
|
67 | 109 | workflow_conclusion: ""
|
68 |
| - branch: ${{ inputs.CLIENTS_BRANCH || 'main' }} |
| 110 | + branch: ${{ github.event.client_payload.origin_branch || inputs.CLIENTS_BRANCH || 'main' }} |
69 | 111 | name: ^dist-chrome-MV3-\w{7}\.zip$
|
70 | 112 | name_is_regexp: true
|
71 | 113 | repo: bitwarden/clients
|
@@ -146,3 +188,49 @@ jobs:
|
146 | 188 | ./test-summary
|
147 | 189 | ./tests-out/videos
|
148 | 190 | ./tests-out/screenshots
|
| 191 | +
|
| 192 | + - name: Communicate BIT failure on originating issue |
| 193 | + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 |
| 194 | + if: failure() && steps.set-send-pr-feedback.outputs.send_pr_feedback == 'true' |
| 195 | + with: |
| 196 | + github-token: ${{ steps.app-token.outputs.token }} |
| 197 | + script: | |
| 198 | + const owner = 'bitwarden'; |
| 199 | + const runURL = `https://github.com/${owner}/browser-interactions-testing/actions/runs/${context.runId}`; |
| 200 | + const configURL = new URL('${{ vars.BW_REMOTE_VAULT_CONFIG_MATCH }}'); |
| 201 | + const message = `⚠️ **Files have been modified in this PR that impact the Autofill experience** ⚠️ |
| 202 | +
|
| 203 | + [BIT](https://github.com/${owner}/browser-interactions-testing) was run to verify no regressions have been introduced to the core Autofill experience. The tests ran with the same feature flag configuration used by \`${configURL.hostname}\` |
| 204 | +
|
| 205 | + ❌ Unfortunately, one or more of these BIT tests failed. 😞 |
| 206 | +
|
| 207 | + Please resolve the failure before merging; reach out to \`@bitwarden/team-autofill-dev\` if you'd like help. |
| 208 | +
|
| 209 | + You can view the detailed results of the tests [here](${runURL}).`; |
| 210 | +
|
| 211 | + github.rest.issues.createComment({ |
| 212 | + issue_number: context.payload.client_payload.origin_issue, |
| 213 | + owner: owner, |
| 214 | + repo: 'clients', |
| 215 | + body: message |
| 216 | + }); |
| 217 | +
|
| 218 | + - name: Communicate BIT success on originating issue |
| 219 | + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 |
| 220 | + if: success() && steps.set-send-pr-feedback.outputs.send_pr_feedback == 'true' |
| 221 | + with: |
| 222 | + github-token: ${{ steps.app-token.outputs.token }} |
| 223 | + script: | |
| 224 | + const owner = 'bitwarden'; |
| 225 | + const message = `⚠️ **Files have been modified in this PR that impact the Autofill experience** ⚠️ |
| 226 | +
|
| 227 | + [BIT](https://github.com/${owner}/browser-interactions-testing) was run to verify no regressions have been introduced to the core Autofill experience. |
| 228 | +
|
| 229 | + ✅ Fortunately, [these BIT tests have passed](https://github.com/${owner}/browser-interactions-testing/actions/runs/${context.runId})! 🎉`; |
| 230 | +
|
| 231 | + github.rest.issues.createComment({ |
| 232 | + issue_number: context.payload.client_payload.origin_issue, |
| 233 | + owner: owner, |
| 234 | + repo: 'clients', |
| 235 | + body: message |
| 236 | + }); |
0 commit comments