All tests with extension build pm-28289 by @bw-ghapp[bot] #1564
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
| name: Test-all-custom-flags | |
| run-name: All tests with extension build ${{ inputs.CLIENTS_BRANCH || github.event.client_payload.origin_branch }} by @${{ github.actor }} | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| repository_dispatch: | |
| types: [trigger-bit-tests] | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| CLIENTS_BRANCH: | |
| default: "main" | |
| description: "clients branch of browser build to use" | |
| required: true | |
| type: string | |
| FEATURE_FLAGS: | |
| default: "{}" | |
| description: 'JSON key-value pairs representing feature flag states. (e.g. {"autofill-v2": true, "autofill-overlay": false})' | |
| required: true | |
| type: string | |
| jobs: | |
| build-and-test: | |
| name: Build and test | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| id-token: write | |
| contents: read | |
| packages: read | |
| pull-requests: write | |
| outputs: | |
| send_pr_feedback: false | |
| steps: | |
| - name: Send PR feedback check | |
| id: set-send-pr-feedback | |
| run: | | |
| echo "send_pr_feedback=${{ (github.event.client_payload.origin_issue || false) && (vars.ENABLE_PR_FEEDBACK || false) }}" >> "$GITHUB_OUTPUT" | |
| - name: Log in to Azure | |
| uses: bitwarden/gh-actions/azure-login@main | |
| if: steps.set-send-pr-feedback.outputs.send_pr_feedback == 'true' | |
| with: | |
| subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| tenant_id: ${{ secrets.AZURE_TENANT_ID }} | |
| client_id: ${{ secrets.AZURE_CLIENT_ID }} | |
| - name: Get Azure Key Vault secrets | |
| id: get-kv-secrets | |
| uses: bitwarden/gh-actions/get-keyvault-secrets@main | |
| if: steps.set-send-pr-feedback.outputs.send_pr_feedback == 'true' | |
| with: | |
| keyvault: gh-org-bitwarden | |
| secrets: "BW-GHAPP-ID,BW-GHAPP-KEY" | |
| - name: Log out from Azure | |
| uses: bitwarden/gh-actions/azure-logout@main | |
| if: steps.set-send-pr-feedback.outputs.send_pr_feedback == 'true' | |
| - name: Generate GH App token | |
| id: app-token | |
| uses: actions/create-github-app-token@30bf6253fa41bdc8d1501d202ad15287582246b4 # v2.0.3 | |
| if: steps.set-send-pr-feedback.outputs.send_pr_feedback == 'true' | |
| with: | |
| app-id: ${{ steps.get-kv-secrets.outputs.BW-GHAPP-ID }} | |
| private-key: ${{ steps.get-kv-secrets.outputs.BW-GHAPP-KEY }} | |
| owner: bitwarden | |
| repositories: clients | |
| permission-issues: write | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Setup Node | |
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| cache: "npm" | |
| cache-dependency-path: "**/package-lock.json" | |
| node-version: "23" | |
| - name: Create dotenv file | |
| uses: ./.github/actions/setup-env-file | |
| with: | |
| AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
| AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
| BW_DB_PORT: ${{ vars.BW_DB_PORT }} | |
| BW_DB_PROVIDER: ${{ vars.BW_DB_PROVIDER }} | |
| BW_DB_SERVER: ${{ vars.BW_DB_SERVER }} | |
| BW_DOMAIN: ${{ vars.BW_DOMAIN }} | |
| BW_ENABLE_SSL: ${{ vars.BW_ENABLE_SSL }} | |
| BW_SSL_CERT: ${{ vars.BW_SSL_CERT }} | |
| BW_SSL_KEY: ${{ vars.BW_SSL_KEY }} | |
| CI: true | |
| CLI_SERVE_HOST: ${{ vars.CLI_SERVE_HOST }} | |
| CLI_SERVE_PORT: ${{ vars.CLI_SERVE_PORT }} | |
| EXTENSION_BUILD_PATH: ${{ vars.EXTENSION_BUILD_PATH }} | |
| PAGES_HOST_INSECURE_PORT: ${{ vars.PAGES_HOST_INSECURE_PORT }} | |
| PAGES_HOST_PORT: ${{ vars.PAGES_HOST_PORT }} | |
| PAGES_HOST: ${{ vars.PAGES_HOST }} | |
| VAULT_HOST_INSECURE_PORT: ${{ vars.VAULT_HOST_INSECURE_PORT }} | |
| VAULT_HOST_PORT: ${{ vars.VAULT_HOST_PORT }} | |
| VAULT_HOST_URL: ${{ vars.VAULT_HOST_URL }} | |
| - name: Create feature flags file | |
| run: echo "{\"flagValues\":${{ inputs.FEATURE_FLAGS || '{}' }}}" > flags.json | |
| - name: Download extension artifact | |
| id: get-build-artifact | |
| uses: dawidd6/action-download-artifact@ac66b43f0e6a346234dd65d4d0c8fbb31cb316e5 # v11 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| workflow: build-browser.yml | |
| workflow_conclusion: "" | |
| branch: ${{ github.event.client_payload.origin_branch || inputs.CLIENTS_BRANCH || 'main' }} | |
| name: ^dist-chrome-MV3-\w{7}\.zip$ | |
| name_is_regexp: true | |
| repo: bitwarden/clients | |
| if_no_artifact_found: fail | |
| skip_unpack: true | |
| - name: Set no PR feedback when missing build artifact | |
| if: ${{ failure() && steps.get-build-artifact.conclusion != 'success' }} | |
| run: | | |
| echo "send_pr_feedback=false" > "$GITHUB_OUTPUT" | |
| - name: Unzip extension artifact | |
| run: | | |
| unzip -o "*dist-chrome-*.zip.zip" | |
| unzip -o "dist-chrome*.zip" -d build | |
| - name: Generate and install certs | |
| run: | | |
| npm run setup:ssl | |
| sudo apt-get install libnss3-tools=2:3.98-1build1 | |
| . .env | |
| mkdir -p "$HOME/.pki/nssdb" | |
| certutil -d "$HOME/.pki/nssdb" -N --empty-password | |
| certutil -d "sql:$HOME/.pki/nssdb" -A -t "CP,CP," -n TestAutomationSSL -i "./$BW_SSL_CERT" | |
| - name: Install Bitwarden CLI | |
| run: npm install -g @bitwarden/[email protected] | |
| - name: Install project dependencies | |
| run: | | |
| npm ci | |
| npx playwright install --with-deps chromium | |
| - name: Build and start the test vault | |
| run: docker compose up -d --build --remove-orphans --wait --wait-timeout 60 | |
| - name: Setup the vault test account | |
| run: npm run seed:vault:account | |
| - name: Setup the vault test account ciphers | |
| run: | | |
| npm run start:cli | |
| npm run seed:vault:ciphers | |
| - name: Download test site build | |
| uses: dawidd6/action-download-artifact@ac66b43f0e6a346234dd65d4d0c8fbb31cb316e5 # v11 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| workflow: build.yml | |
| workflow_conclusion: "" | |
| branch: main | |
| name: build-files | |
| path: test-site | |
| repo: bitwarden/test-the-web | |
| if_no_artifact_found: fail | |
| - name: Copy over certs and install test site dependencies | |
| run: | | |
| cp ssl.crt test-site/api/ | |
| cp ssl.key test-site/api/ | |
| cd test-site | |
| npm ci | |
| - name: Run all tests | |
| run: npm run test:static:ci | |
| - name: Update job summary | |
| if: always() | |
| run: echo "$(<./test-summary/test-summary.md)" >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload results as artifact | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| if: always() | |
| with: | |
| name: test-summary | |
| path: | | |
| ./flags.json | |
| ./test-summary | |
| ./tests-out/videos | |
| ./tests-out/screenshots | |
| - name: Remove past BIT status comments on originating issue | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 | |
| if: (success() || (failure() && steps.get-build-artifact.conclusion == 'success')) && steps.set-send-pr-feedback.outputs.send_pr_feedback == 'true' | |
| with: | |
| github-token: ${{ steps.app-token.outputs.token }} | |
| script: | | |
| // Note: should match the first line of `message` in the communication steps | |
| const workflowCommentTag = '<!-- comment_tag: test-all-custom-flags -->'; | |
| const owner = 'bitwarden'; | |
| const issueComments = await github.rest.issues.listComments({ | |
| issue_number: context.payload.client_payload.origin_issue, | |
| owner: owner, | |
| repo: 'clients', | |
| }); | |
| for (const comment of issueComments.data || []) { | |
| const shouldDeleteComment = | |
| // Do not delete comments that were not automated | |
| !!comment.performed_via_github_app && | |
| // Do not delete user comments | |
| comment.user.type === 'Bot' && | |
| // Do not delete edited comments | |
| comment.created_at === comment.updated_at && | |
| // Only delete comments from this workflow | |
| comment.body.trim().startsWith(workflowCommentTag); | |
| if (shouldDeleteComment) { | |
| await github.rest.issues.deleteComment({ | |
| comment_id: comment.id, | |
| owner: owner, | |
| repo: 'clients', | |
| }); | |
| } | |
| } | |
| - name: Communicate BIT failure on originating issue | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 | |
| if: failure() && steps.get-build-artifact.conclusion == 'success' && steps.set-send-pr-feedback.outputs.send_pr_feedback == 'true' | |
| with: | |
| github-token: ${{ steps.app-token.outputs.token }} | |
| script: | | |
| const owner = 'bitwarden'; | |
| const featureFlags = "${{ inputs.FEATURE_FLAGS || '{}' }}"; | |
| const featureFlagsMessage = featureFlags === '{}' ? | |
| '<ins>all feature flags disabled</ins>.' : | |
| `**the following flags enabled**:<br/><details><summary>Show/Hide Flags</summary><pre><code>${featureFlags}</code></pre></details>`; | |
| const runURL = `https://github.com/${owner}/browser-interactions-testing/actions/runs/${context.runId}`; | |
| const message = ` | |
| <!-- comment_tag: test-all-custom-flags --> | |
| #### ⚠️ Changes in this PR impact the Autofill experience of the browser client ⚠️ | |
| [BIT](https://github.com/${owner}/browser-interactions-testing) has tested the core experience with these changes and ${featureFlagsMessage} | |
| > [!CAUTION] | |
| > Unfortunately, one or more of these tests failed. 😞 | |
| > | |
| > Please resolve the failure before merging; reach out to \`@bitwarden/team-autofill-dev\` if you'd like help. | |
| You can view the detailed results of the tests [here](${runURL}). | |
| `; | |
| github.rest.issues.createComment({ | |
| issue_number: context.payload.client_payload.origin_issue, | |
| owner: owner, | |
| repo: 'clients', | |
| body: message | |
| }); | |
| - name: Communicate BIT success on originating issue | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 | |
| if: success() && steps.set-send-pr-feedback.outputs.send_pr_feedback == 'true' | |
| with: | |
| github-token: ${{ steps.app-token.outputs.token }} | |
| script: | | |
| const owner = 'bitwarden'; | |
| const featureFlags = "${{ inputs.FEATURE_FLAGS || '{}' }}"; | |
| const featureFlagsMessage = featureFlags === '{}' ? | |
| '<ins>all feature flags disabled</ins>.' : | |
| `**the following flags enabled**:<br/><details><summary>Show/Hide Flags</summary><pre><code>${featureFlags}</code></pre></details>`; | |
| const runURL = `https://github.com/${owner}/browser-interactions-testing/actions/runs/${context.runId}`; | |
| const message = ` | |
| <!-- comment_tag: test-all-custom-flags --> | |
| #### Changes in this PR impact the Autofill experience of the browser client | |
| [BIT](https://github.com/${owner}/browser-interactions-testing) has tested the core experience with these changes and ${featureFlagsMessage} | |
| ✅ Fortunately, [these BIT tests have passed](${runURL})! 🎉 | |
| `; | |
| github.rest.issues.createComment({ | |
| issue_number: context.payload.client_payload.origin_issue, | |
| owner: owner, | |
| repo: 'clients', | |
| body: message | |
| }); |