Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple cypress build #723

Merged
merged 8 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Build the application
name: Build
name: Build without E2E tests
on:
pull_request: {}
push:
Expand Down
39 changes: 15 additions & 24 deletions .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
# This is a tchap-specific file, inspired from the one in matrix-react-sdk
name: Cypress End to End Tests
name: Build + E2E Tests

# Run this job when the "Build" job completes
on:
workflow_run:
workflows: ["Build"]
types:
- completed
workflow_dispatch: # for running action manually

env:
# Removing this makes the job break.
REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
pull_request:
types: [ready_for_review]

jobs:
cypress:
name: Cypress
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -26,29 +18,29 @@ jobs:
id: node_version
run: echo ::set-output name=node_version::$(node -e 'console.log(require("./package.json").engines.node)')

- name: Yarn cache
- name: Setup node with yarn cache
uses: actions/setup-node@v3
with:
cache: "yarn"
node-version: ${{ steps.node_version.outputs.node_version }}

- name: Download build from artifact
# use this action instead of actions/download-artifact because we need the "workflow" param
uses: dawidd6/action-download-artifact@v2
with:
name: devbuild
path: webapp
run_id: ${{ github.event.workflow_run.id }} # I think this is the run_id of the workflow that triggered this workflow

- name: Install Dependencies
run: "yarn install" # this is needed otherwise "cypress: not found". Can we do just yarn install cypress to go faster ?
run: "yarn install"

- name: "Copy the dev config file at the right place"
run: "cp config.dev.json config.json"
# todo we could make the choice of backend configurable.
# But then the test user, password, server, should be changed too, see cypress env vars below.

- name: Build
run: "yarn build"

- name: Run Cypress tests
uses: cypress-io/[email protected]
with:
install: false # disable the default install, we already installed and built.

# Serve with 'npx serve', a simple static webserver, so that it starts quickly. The dev server is slow and messy to start.
# Serve with 'npx serve', a simple static webserver, so that it starts quickly. The webpack dev server is slow and messy to start.
start: "npx serve -p 8080 -L webapp"
# Note : 'wait-on' caused issues where localhost was not found by cypress. Be careful if you want to use it.

Expand All @@ -65,4 +57,3 @@ jobs:
E2E_TEST_USER_SECURITY_KEY: ${{ secrets.E2E_TEST_USER_SECURITY_KEY }}
E2E_TEST_USER_HOMESERVER_URL: "https://matrix.agent1.tchap.incubateur.net"
E2E_TEST_USER_HOMESERVER_SHORT: "agent1.tchap.incubateur.net"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # don't remember what this is for, can't hurt
Loading