Run Cypress on Rust crypto (#11828)

* Run Cypress on Rust crypto

* Keep rust and legacy crypto results apart

* Move crypto stack id to kiwi build ID

... instead of test suite name
This commit is contained in:
Richard van der Hoff 2023-11-06 16:52:41 +00:00 committed by GitHub
parent 9bb50119c7
commit c344a378b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,10 +16,6 @@ on:
type: string type: string
required: true required: true
description: "The name of the github repository to check out and build." 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: secrets:
CYPRESS_RECORD_KEY: CYPRESS_RECORD_KEY:
required: true required: true
@ -84,7 +80,7 @@ jobs:
core.setOutput("email", response.data.author.email); core.setOutput("email", response.data.author.email);
# Only run Percy when it is demanded or we are running the daily build # 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 id: percy
if: | if: |
github.event.workflow_run.event == 'schedule' || github.event.workflow_run.event == 'schedule' ||
@ -107,7 +103,7 @@ jobs:
run: echo "value=sha-$GITHUB_SHA-time-$(date +"%s")" >> $GITHUB_OUTPUT run: echo "value=sha-$GITHUB_SHA-time-$(date +"%s")" >> $GITHUB_OUTPUT
tests: tests:
name: "Run Tests" name: "Run Tests (${{ matrix.crypto }} crypto)"
needs: prepare needs: prepare
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
@ -120,6 +116,8 @@ jobs:
matrix: matrix:
# Run 4 instances in Parallel # Run 4 instances in Parallel
runner: [1, 2, 3, 4] runner: [1, 2, 3, 4]
# Run tests using both crypto stacks
crypto: [legacy, rust]
steps: steps:
- uses: browser-actions/setup-chrome@803ef6dfb4fdf22089c9563225d95e4a515820a0 # v1 - uses: browser-actions/setup-chrome@803ef6dfb4fdf22089c9563225d95e4a515820a0 # v1
- run: echo "BROWSER_PATH=$(which chrome)" >> $GITHUB_ENV - run: echo "BROWSER_PATH=$(which chrome)" >> $GITHUB_ENV
@ -158,7 +156,7 @@ jobs:
# Enable rust crypto if the calling workflow requests it # Enable rust crypto if the calling workflow requests it
- name: Enable rust crypto - name: Enable rust crypto
if: inputs.rust-crypto if: matrix.crypto == 'rust'
run: | run: |
echo "CYPRESS_RUST_CRYPTO=1" >> "$GITHUB_ENV" echo "CYPRESS_RUST_CRYPTO=1" >> "$GITHUB_ENV"
@ -174,7 +172,7 @@ jobs:
record: true record: true
parallel: true parallel: true
command: "yarn percy exec --parallel -- npx cypress-cloud run" 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: env:
# pass the Dashboard record key as an environment variable # pass the Dashboard record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
@ -203,7 +201,9 @@ jobs:
# pass the Percy token as an environment variable # pass the Percy token as an environment variable
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} 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 }} PERCY_BROWSER_EXECUTABLE: ${{ steps.setup-chrome.outputs.chrome-path }}
# tell Percy more details about the context of this run # tell Percy more details about the context of this run
PERCY_BRANCH: ${{ github.event.workflow_run.head_branch }} PERCY_BRANCH: ${{ github.event.workflow_run.head_branch }}
@ -213,26 +213,26 @@ jobs:
# We manually finalize the build in the report stage # We manually finalize the build in the report stage
PERCY_PARALLEL_TOTAL: -1 PERCY_PARALLEL_TOTAL: -1
- name: Upload Artifact - name: 📤 Upload results artifact
if: failure() if: failure()
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: cypress-results name: cypress-results-${{ matrix.crypto }}-crypto
path: | path: |
matrix-react-sdk/cypress/screenshots matrix-react-sdk/cypress/screenshots
matrix-react-sdk/cypress/videos matrix-react-sdk/cypress/videos
matrix-react-sdk/cypress/synapselogs matrix-react-sdk/cypress/synapselogs
matrix-react-sdk/cypress/results/cypresslogs matrix-react-sdk/cypress/results/cypresslogs
- name: Upload reports - name: 📤 Upload JUnit report artifact
if: always() if: always()
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: cypress-junit name: cypress-junit-${{ matrix.crypto }}-crypto
path: matrix-react-sdk/cypress/results/junit path: matrix-react-sdk/cypress/results/junit
report: report:
name: Report results name: Finalize results
needs: needs:
- prepare - prepare
- tests - tests
@ -268,19 +268,22 @@ jobs:
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
kiwi: kiwi:
name: Report results to kiwi name: 🥝 Report results to kiwi (${{ matrix.crypto }} crypto)
needs: needs:
- prepare - prepare
- tests - tests
environment: Kiwi environment: Kiwi
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ needs.prepare.outputs.kiwi_enable == '1' }} if: ${{ needs.prepare.outputs.kiwi_enable == '1' }}
strategy:
matrix:
crypto: [legacy, rust]
steps: steps:
- name: Download all zip files - name: 📥 Download Junit report artifact
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: cypress-junit name: cypress-junit-${{ matrix.crypto }}-crypto
- name: Upload to kiwi - name: 📤 Upload results to kiwi
uses: vector-im/kiwitcms-upload-action@main uses: vector-im/kiwitcms-upload-action@main
with: with:
file-pattern: results-*.xml file-pattern: results-*.xml
@ -288,6 +291,6 @@ jobs:
kiwi-password: ${{ secrets.TCMS_PASSWORD }} kiwi-password: ${{ secrets.TCMS_PASSWORD }}
product: "Element Web" product: "Element Web"
product-version: ${{ github.event.workflow_run.head_branch }} product-version: ${{ github.event.workflow_run.head_branch }}
build-id: ${{ github.event.workflow_run.head_sha }} build-id: ${{ github.event.workflow_run.head_sha }}-${{ matrix.crypto }}-crypto
suite-name: "Cypress E2E" suite-name: "Cypress E2E"
summary-template: "$name" summary-template: "$name"