diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 297f23cc47e..81270ac7917 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,9 +41,9 @@ jobs: if ( baseRef ) { baseRef = `--base-ref origin/${ baseRef }`; } - + let githubEvent = ${{ toJson( github.event_name ) }}; - + const child_process = require( 'node:child_process' ); child_process.execSync( `pnpm utils ci-jobs ${ baseRef } --event ${ githubEvent }` ); @@ -116,12 +116,29 @@ jobs: install: '${{ matrix.projectName }}...' build: '${{ matrix.projectName }}' + - name: Get commit message + id: get_commit_message + run: | + if [[ "${{ github.event_name }}" == "push" ]]; then + echo "Commit message is ${{ github.event.head_commit.message }}" + echo "COMMIT_MESSAGE=${{ github.event.head_commit.message }}" >> "$GITHUB_OUTPUT" + elif [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "Commit message is ${{ github.event.pull_request.title }}" + echo "COMMIT_MESSAGE=${{ github.event.pull_request.title }}" >> "$GITHUB_OUTPUT" + else + echo "Workflow triggered by other event" + fi + shell: bash + - name: 'Prepare Test Environment' id: 'prepare-test-environment' if: ${{ matrix.testEnv.shouldCreate }} run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.testEnv.start }}' - name: 'Run tests' + env: + BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_ANALYTICS_TOKEN }} + BUILDKITE_ANALYTICS_MESSAGE: ${{ steps.get_commit_message.outputs.COMMIT_MESSAGE }} run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.command }}' - name: 'Upload artifacts' @@ -153,12 +170,29 @@ jobs: install: '${{ matrix.projectName }}...' build: '${{ matrix.projectName }}' + - name: Get commit message + id: get_commit_message + run: | + if [[ "${{ github.event_name }}" == "push" ]]; then + echo "Commit message is ${{ github.event.head_commit.message }}" + echo "COMMIT_MESSAGE=${{ github.event.head_commit.message }}" >> "$GITHUB_OUTPUT" + elif [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "Commit message is ${{ github.event.pull_request.title }}" + echo "COMMIT_MESSAGE=${{ github.event.pull_request.title }}" >> "$GITHUB_OUTPUT" + else + echo "Workflow triggered by other event" + fi + shell: bash + - name: 'Prepare Test Environment' id: 'prepare-test-environment' if: ${{ matrix.testEnv.shouldCreate }} run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.testEnv.start }}' - name: 'Run tests' + env: + BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_API_ANALYTICS_TOKEN }} + BUILDKITE_ANALYTICS_MESSAGE: ${{ steps.get_commit_message.outputs.COMMIT_MESSAGE }} run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.command }}' - name: 'Upload artifacts' diff --git a/plugins/woocommerce/changelog/e2e-try-buildkite-test-analytics b/plugins/woocommerce/changelog/e2e-try-buildkite-test-analytics new file mode 100644 index 00000000000..609aca9f43b --- /dev/null +++ b/plugins/woocommerce/changelog/e2e-try-buildkite-test-analytics @@ -0,0 +1,4 @@ +Significance: patch +Type: dev + +Try out the BuildKite Test Analytics in CI diff --git a/plugins/woocommerce/package.json b/plugins/woocommerce/package.json index 231b432423e..200ae402b5f 100644 --- a/plugins/woocommerce/package.json +++ b/plugins/woocommerce/package.json @@ -379,7 +379,8 @@ "@woocommerce/admin-library": "workspace:*", "@woocommerce/block-library": "workspace:*", "@woocommerce/classic-assets": "workspace:*", - "@wordpress/browserslist-config": "wp-6.0" + "@wordpress/browserslist-config": "wp-6.0", + "buildkite-test-collector": "^1.7.1" }, "nodemonConfig": { "delay": 2500, diff --git a/plugins/woocommerce/tests/api-core-tests/playwright.config.js b/plugins/woocommerce/tests/api-core-tests/playwright.config.js index 6a3c9207974..be1e0c34532 100644 --- a/plugins/woocommerce/tests/api-core-tests/playwright.config.js +++ b/plugins/woocommerce/tests/api-core-tests/playwright.config.js @@ -48,6 +48,7 @@ const config = { './test-results/test-results.json', }, ], + [ 'buildkite-test-collector/playwright/reporter' ], ], use: { screenshot: 'only-on-failure', diff --git a/plugins/woocommerce/tests/e2e-pw/playwright.config.js b/plugins/woocommerce/tests/e2e-pw/playwright.config.js index 36b6b128f90..743dba84310 100644 --- a/plugins/woocommerce/tests/e2e-pw/playwright.config.js +++ b/plugins/woocommerce/tests/e2e-pw/playwright.config.js @@ -31,6 +31,7 @@ const reporter = [ if ( process.env.CI ) { reporter.push( [ 'github' ] ); + reporter.push( [ 'buildkite-test-collector/playwright/reporter' ] ); } else { reporter.push( [ 'html', diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5925944296c..e1ed911d67d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3020,6 +3020,9 @@ importers: '@wordpress/browserslist-config': specifier: wp-6.0 version: 4.1.3 + buildkite-test-collector: + specifier: ^1.7.1 + version: 1.7.1 devDependencies: '@babel/cli': specifier: 7.12.8 @@ -5150,19 +5153,6 @@ packages: react-dom: 17.0.2(react@17.0.2) dev: false - /@automattic/calypso-analytics@1.1.1: - resolution: {integrity: sha512-yk8okslaliV2cwqVCmT9y6XNDT34CqNjtyBZEmHSY35xUohxRoAMvLk68QfHJLOO9LZ4KMwm1Mb6w17477ruDA==} - dependencies: - '@automattic/load-script': 1.0.0 - cookie: 0.4.2 - debug: 4.3.4(supports-color@9.4.0) - hash.js: 1.1.7 - tslib: 2.6.2 - uuid: 8.3.2 - transitivePeerDependencies: - - supports-color - dev: false - /@automattic/calypso-analytics@1.1.2: resolution: {integrity: sha512-+pPM41BL8XYxHKoEidk3/J3XjKxinVZfB0/t8E2KPBqGclDSVg7PXxslOzWsQsNju64rSWcjIY5+c8fnnWRW5g==} dependencies: @@ -5357,13 +5347,8 @@ packages: react-popper: 2.3.0(@popperjs/core@2.11.8)(react-dom@17.0.2)(react@17.0.2) redux: 4.2.1 transitivePeerDependencies: - - '@babel/helper-module-imports' - - '@babel/types' - '@types/react' - - aslemammad-vite-plugin-macro - - babel-plugin-macros - supports-color - - vite dev: false /@automattic/typography@1.0.0: @@ -26764,6 +26749,16 @@ packages: - debug dev: false + /axios@1.6.8: + resolution: {integrity: sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==} + dependencies: + follow-redirects: 1.15.6 + form-data: 4.0.0 + proxy-from-env: 1.1.0 + transitivePeerDependencies: + - debug + dev: false + /axobject-query@3.2.1: resolution: {integrity: sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==} dependencies: @@ -28270,6 +28265,19 @@ packages: base64-js: 1.5.1 ieee754: 1.2.1 + /buildkite-test-collector@1.7.1: + resolution: {integrity: sha512-xYjBp9xbL8rwbt+cfOQSitCyrS+qWcli6Uy2UzUpENnVD+lviP+fpYQ9lc29QgFdCY5fFI6j6O0od179TgfA+w==} + engines: {npm: '>=7.0.0'} + dependencies: + axios: 1.6.8 + dotenv: 16.3.1 + request-spy: 0.0.10 + strip-ansi: 6.0.1 + uuid: 8.3.2 + transitivePeerDependencies: + - debug + dev: false + /builtin-status-codes@3.0.0: resolution: {integrity: sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==} dev: true @@ -31214,7 +31222,6 @@ packages: /dotenv@16.3.1: resolution: {integrity: sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==} engines: {node: '>=12'} - dev: true /dotenv@8.6.0: resolution: {integrity: sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==} @@ -33904,6 +33911,16 @@ packages: dependencies: debug: 4.3.4(supports-color@9.4.0) + /follow-redirects@1.15.6: + resolution: {integrity: sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==} + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + dev: false + /follow-redirects@1.5.10: resolution: {integrity: sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==} engines: {node: '>=4.0'} @@ -41989,6 +42006,10 @@ packages: /moment@2.29.4: resolution: {integrity: sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==} + /monkeypatch@1.0.0: + resolution: {integrity: sha512-6tG0IrCUUIBuAspnbdmOAd+D/AptB/ya9JLujp88NIAuFuTGdGvCKtDkc6pwNOcIJ6nKLm3FjJlaCdx8vr3r2w==} + dev: false + /moo@0.5.2: resolution: {integrity: sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==} @@ -47138,6 +47159,12 @@ packages: tough-cookie: 2.5.0 dev: true + /request-spy@0.0.10: + resolution: {integrity: sha512-va+4vLamK9Pwu/WJnJrQcTjCjYdIcl0KDKOKEkfvNmer4f+K+OhgbpU4DCiPyzBGnTpYXbrVLrnD8O5fS/cmKA==} + dependencies: + monkeypatch: 1.0.0 + dev: false + /request@2.88.2: resolution: {integrity: sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==} engines: {node: '>= 6'}