From 46377308ed7a1efa6f969c3c7cf1b54ab0d732b3 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 3 Nov 2023 15:40:30 +0000 Subject: [PATCH 1/3] Run Cypress on Rust crypto --- .github/workflows/cypress.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 4b33aeea039..cdb717bca46 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -16,10 +16,6 @@ on: type: string required: true description: "The name of the github repository to check out and build." - rust-crypto: - type: boolean - required: false - description: "Enable Rust cryptography for the cypress run." secrets: CYPRESS_RECORD_KEY: required: true @@ -84,7 +80,7 @@ jobs: core.setOutput("email", response.data.author.email); # Only run Percy when it is demanded or we are running the daily build - - name: Enable Percy if X-Needs-Percy + - name: Enable Percy id: percy if: | github.event.workflow_run.event == 'schedule' || @@ -107,7 +103,7 @@ jobs: run: echo "value=sha-$GITHUB_SHA-time-$(date +"%s")" >> $GITHUB_OUTPUT tests: - name: "Run Tests" + name: "Run Tests (${{ matrix.crypto }} crypto)" needs: prepare runs-on: ubuntu-latest permissions: @@ -120,6 +116,8 @@ jobs: matrix: # Run 4 instances in Parallel runner: [1, 2, 3, 4] + # Run tests using both crypto stacks + crypto: [legacy, rust] steps: - uses: browser-actions/setup-chrome@803ef6dfb4fdf22089c9563225d95e4a515820a0 # v1 - run: echo "BROWSER_PATH=$(which chrome)" >> $GITHUB_ENV @@ -158,7 +156,7 @@ jobs: # Enable rust crypto if the calling workflow requests it - name: Enable rust crypto - if: inputs.rust-crypto + if: matrix.crypto == 'rust' run: | echo "CYPRESS_RUST_CRYPTO=1" >> "$GITHUB_ENV" @@ -174,7 +172,7 @@ jobs: record: true parallel: true command: "yarn percy exec --parallel -- npx cypress-cloud run" - ci-build-id: ${{ needs.prepare.outputs.uuid }} + ci-build-id: ${{ needs.prepare.outputs.uuid }}-${{ matrix.crypto }} env: # pass the Dashboard record key as an environment variable CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} @@ -203,7 +201,9 @@ jobs: # pass the Percy token as an environment variable PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} - PERCY_ENABLE: ${{ needs.prepare.outputs.percy_enable }} + + # only run percy on legacy crypto (for now) + PERCY_ENABLE: ${{ matrix.crypto == 'legacy' && needs.prepare.outputs.percy_enable || 0 }} PERCY_BROWSER_EXECUTABLE: ${{ steps.setup-chrome.outputs.chrome-path }} # tell Percy more details about the context of this run PERCY_BRANCH: ${{ github.event.workflow_run.head_branch }} From 20801c18982c539a6cce0dd1dadfa74c8b8b1c90 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 6 Nov 2023 11:56:47 +0000 Subject: [PATCH 2/3] Keep rust and legacy crypto results apart --- .github/workflows/cypress.yaml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index cdb717bca46..8a22c27d27e 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -213,26 +213,26 @@ jobs: # We manually finalize the build in the report stage PERCY_PARALLEL_TOTAL: -1 - - name: Upload Artifact + - name: 📤 Upload results artifact if: failure() uses: actions/upload-artifact@v3 with: - name: cypress-results + name: cypress-results-${{ matrix.crypto }}-crypto path: | matrix-react-sdk/cypress/screenshots matrix-react-sdk/cypress/videos matrix-react-sdk/cypress/synapselogs matrix-react-sdk/cypress/results/cypresslogs - - name: Upload reports + - name: 📤 Upload JUnit report artifact if: always() uses: actions/upload-artifact@v3 with: - name: cypress-junit + name: cypress-junit-${{ matrix.crypto }}-crypto path: matrix-react-sdk/cypress/results/junit report: - name: Report results + name: Finalize results needs: - prepare - tests @@ -268,19 +268,22 @@ jobs: target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} kiwi: - name: Report results to kiwi + name: 🥝 Report results to kiwi (${{ matrix.crypto }} crypto) needs: - prepare - tests environment: Kiwi runs-on: ubuntu-latest if: ${{ needs.prepare.outputs.kiwi_enable == '1' }} + strategy: + matrix: + crypto: [legacy, rust] steps: - - name: Download all zip files + - name: 📥 Download Junit report artifact uses: actions/download-artifact@v3 with: - name: cypress-junit - - name: Upload to kiwi + name: cypress-junit-${{ matrix.crypto }}-crypto + - name: 📤 Upload results to kiwi uses: vector-im/kiwitcms-upload-action@main with: file-pattern: results-*.xml @@ -289,5 +292,5 @@ jobs: product: "Element Web" product-version: ${{ github.event.workflow_run.head_branch }} build-id: ${{ github.event.workflow_run.head_sha }} - suite-name: "Cypress E2E" + suite-name: "Cypress E2E (${{ matrix.crypto }} crypto)" summary-template: "$name" From eeffc8a1cc8e3c4553b15e8cc5b029128876ba72 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 6 Nov 2023 12:48:06 +0000 Subject: [PATCH 3/3] Move crypto stack id to kiwi build ID ... instead of test suite name --- .github/workflows/cypress.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 8a22c27d27e..c397db01bc0 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -291,6 +291,6 @@ jobs: kiwi-password: ${{ secrets.TCMS_PASSWORD }} product: "Element Web" product-version: ${{ github.event.workflow_run.head_branch }} - build-id: ${{ github.event.workflow_run.head_sha }} - suite-name: "Cypress E2E (${{ matrix.crypto }} crypto)" + build-id: ${{ github.event.workflow_run.head_sha }}-${{ matrix.crypto }}-crypto + suite-name: "Cypress E2E" summary-template: "$name"