Cypress use the simulated merge commit for the source of tests (#10688)
* Cypress use the simulated merge commit for the source of tests * Add comments * Update .github/workflows/cypress.yaml Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> --------- Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
parent
2486e7a90a
commit
25ac825ae5
2 changed files with 22 additions and 9 deletions
29
.github/workflows/cypress.yaml
vendored
29
.github/workflows/cypress.yaml
vendored
|
@ -106,15 +106,6 @@ jobs:
|
|||
# supposed to be covered by STIXGeneral.
|
||||
tools: fonts-stix
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
# XXX: We're checking out untrusted code in a secure context
|
||||
# We need to be careful to not trust anything this code outputs/may do
|
||||
# We need to check this out to access the cypress tests which are on the head branch
|
||||
repository: ${{ github.event.workflow_run.head_repository.full_name }}
|
||||
ref: ${{ github.event.workflow_run.head_sha }}
|
||||
persist-credentials: false
|
||||
|
||||
# There's a 'download artifact' action, but it hasn't been updated for the workflow_run action
|
||||
# (https://github.com/actions/download-artifact/issues/60) so instead we get this mess:
|
||||
- name: 📥 Download artifact
|
||||
|
@ -124,6 +115,25 @@ jobs:
|
|||
name: previewbuild
|
||||
path: webapp
|
||||
|
||||
# The workflow_run.head_sha is the sha of the head commit but the element-web was built using a simulated
|
||||
# merge commit - https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
|
||||
# so use the sha from the tarball for the checkout of the cypress tests
|
||||
# to make sure we get a matching set of code and tests.
|
||||
- name: Grab sha from webapp
|
||||
id: sha
|
||||
run: |
|
||||
echo "sha=$(cat webapp/sha)" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
# XXX: We're checking out untrusted code in a secure context
|
||||
# We need to be careful to not trust anything this code outputs/may do
|
||||
# We need to check this out to access the cypress tests which are on the head branch
|
||||
repository: ${{ github.event.workflow_run.head_repository.full_name }}
|
||||
ref: ${{ steps.sha.outputs.sha }}
|
||||
persist-credentials: false
|
||||
path: matrix-react-sdk
|
||||
|
||||
- name: Run Cypress tests
|
||||
uses: cypress-io/github-action@a29a621b736c9a8547ba0236cc9cee1e49725bd5
|
||||
with:
|
||||
|
@ -137,6 +147,7 @@ jobs:
|
|||
command-prefix: "yarn percy exec --parallel --"
|
||||
config: '{"reporter":"cypress-multi-reporters", "reporterOptions": { "configFile": "cypress-ci-reporter-config.json" } }'
|
||||
ci-build-id: ${{ needs.prepare.outputs.uuid }}
|
||||
project: matrix-react-sdk
|
||||
env:
|
||||
# pass the Dashboard record key as an environment variable
|
||||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||
|
|
2
.github/workflows/element-web.yaml
vendored
2
.github/workflows/element-web.yaml
vendored
|
@ -43,6 +43,7 @@ jobs:
|
|||
run: cp element.io/develop/config.json config.json
|
||||
working-directory: ./element-web
|
||||
|
||||
# After building we write the version file and the react-sdk sha so our cypress tests are from the same sha
|
||||
- name: Build
|
||||
env:
|
||||
CI_PACKAGE: true
|
||||
|
@ -50,6 +51,7 @@ jobs:
|
|||
run: |
|
||||
yarn build
|
||||
echo $VERSION > webapp/version
|
||||
echo $GITHUB_SHA > webapp/sha
|
||||
working-directory: ./element-web
|
||||
|
||||
- name: Upload Artifact
|
||||
|
|
Loading…
Reference in a new issue