temp #17625
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: E2E Tests | |
on: | |
pull_request: | |
branches: [main, feature/*] | |
jobs: | |
cypress-run: | |
name: Cypress | |
runs-on: ubuntu-latest | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres@sha256:0aafd2ae7e6c391f39fb6b7621632d79f54068faebc726caf469e87bd1d301c0 | |
env: | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
redis: | |
# Docker Hub image | |
image: redis@sha256:fb534a36ac2034a6374933467d971fbcbfa5d213805507f560d564851a720355 | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
env: | |
# Needed for Next Auth to initialize | |
TOKEN_SECRET: testKey | |
APP_ENV: test | |
NEXT_PUBLIC_APP_ENV: test | |
REDIS_URL: localhost | |
DATABASE_URL: postgres://postgres:postgres@localhost:5432/formsDB | |
steps: | |
- name: Checkout | |
uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1.2.0 | |
- name: Node.JS Setup | |
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | |
with: | |
node-version-file: .nvmrc | |
- name: Yarn update to V4 | |
run: corepack enable && yarn set version berry | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: linux-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
linux-yarn- | |
- name: "Install dependencies" | |
run: yarn workspaces focus gcforms flag_initialization | |
- name: Cypress Tests | |
uses: cypress-io/github-action@8d3918616d8ac34caa2b49afc8b408b6a872a6f5 # v6.7.1 | |
with: | |
# we have already installed all dependencies above | |
install: false | |
browser: chrome | |
headed: false | |
build: yarn build:test | |
start: yarn start:test | |
wait-on: "http://localhost:3000" | |
config: baseUrl=http://localhost:3000 | |
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots |