From c3696759917b2cc03c2424e1a99a9b55d59b4e57 Mon Sep 17 00:00:00 2001 From: Adrian Cowan Date: Fri, 6 Jan 2023 20:51:49 +1100 Subject: [PATCH 1/2] website: Automate e2e testing with a simpler method than #376 --- .github/workflows/test-e2e.yaml | 37 +++++++++++++++++++++++++++++++++ docker-compose.yaml | 5 +++++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/test-e2e.yaml diff --git a/.github/workflows/test-e2e.yaml b/.github/workflows/test-e2e.yaml new file mode 100644 index 00000000..f2759808 --- /dev/null +++ b/.github/workflows/test-e2e.yaml @@ -0,0 +1,37 @@ +name: E2E Tests (Website) + +on: + push: + branches: + - main + paths: + - backend/** + - website/** + pull_request: + paths: + - backend/** + - website/** + +jobs: + test-e2e: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Start website, backend, etc + run: docker compose up ci --build -d + - name: Run Cypress tests + uses: cypress-io/github-action@v5.0.2 + with: + browser: chrome + working-directory: website + - uses: actions/upload-artifact@v3 + if: failure() # NOTE: screenshots will be generated only if E2E test failed + with: + name: cypress-screenshots + path: website/cypress/screenshots + - uses: actions/upload-artifact@v3 + if: always() + with: + name: cypress-videos + path: website/cypress/videos diff --git a/docker-compose.yaml b/docker-compose.yaml index 6bc42c51..6896bf18 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -11,6 +11,11 @@ services: image: sverrirab/sleep depends_on: [db, webdb, adminer, maildev, backend, redis] + # Used by CI automations. + ci: + image: sverrirab/sleep + depends_on: [db, webdb, maildev, backend, redis, web] + # This DB is for the FastAPI Backend. db: image: postgres From b930d2b9c7f6e29823cbf348d21dc15e2d2181ab Mon Sep 17 00:00:00 2001 From: Adrian Cowan Date: Mon, 9 Jan 2023 10:09:54 +1100 Subject: [PATCH 2/2] Trigger e2e testing on changes to oasst-shared --- .github/workflows/test-e2e.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-e2e.yaml b/.github/workflows/test-e2e.yaml index f2759808..44ef5b04 100644 --- a/.github/workflows/test-e2e.yaml +++ b/.github/workflows/test-e2e.yaml @@ -5,10 +5,12 @@ on: branches: - main paths: + - oasst-shared/** - backend/** - website/** pull_request: paths: + - oasst-shared/** - backend/** - website/**