Skip to content

Instantly share code, notes, and snippets.

@KATT
Last active July 12, 2021 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KATT/2aa98a72a815bd2bf33b61986d4d6c68 to your computer and use it in GitHub Desktop.
Save KATT/2aa98a72a815bd2bf33b61986d4d6c68 to your computer and use it in GitHub Desktop.
Github Actions CI: Hasura + Auth0 + Next.js + Cypress + Playwright
name: Cypress
on: [push]
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 20
services:
postgres:
image: postgres:12.1
env:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
hasura:
image: hasura/graphql-engine:v1.3.2
env:
HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:@postgres:5432/postgres
HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
HASURA_GRAPHQL_JWT_SECRET: '{"type": "RS512", "key": "xxxx"}'
HASURA_GRAPHQL_ENABLE_CONSOLE: 'true'
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: anonymous
ACTION_BASE_URL: 'http://172.17.0.1:4000'
ACTION_WEBHOOK_URL: 'http://172.17.0.1:4000/api/v2/webhooks/hasura'
ACTION_SECRET: actionsecret
ports:
- 8080:8080
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install Hasura cli
run: npm i -g hasura-cli@1.3.2
- name: Migrate to the latest version of the database
run: |
cd hasura
docker ps
npx wait-port http://:8080/v1/version
hasura migrate status --skip-update-check
hasura migrate apply --skip-update-check
hasura metadata apply --skip-update-check
psql -h localhost -f fixtures/seed.sql
env:
PGPASSWORD: postgres
PGUSER: postgres
PGDATABASE: postgres
PGPORT: 5432
HASURA_GRAPHQL_ENDPOINT: http://localhost:8080
HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
HASURA_SKIP_UPDATE_CHECK: true
ACTION_SECRET: actionsecret
- uses: microsoft/playwright-github-action@v1
- name: Install deps
uses: bahmutov/npm-install@v1
- name: Next.js cache
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs
- run: yarn jest
- name: Build & run
run: |
yarn build
yarn start --port 4000 &
npx wait-port http://:4000/api/healthz --timeout 10000
env:
NODE_ENV: test
ACTION_SECRET: actionsecret
AUTH0_BASE_URL: 'http://localhost:4000'
AUTH0_CLIENT_ID: 'xxxxx'
AUTH0_CLIENT_SECRET: 'xxxxx'
AUTH0_ISSUER_BASE_URL: 'https://fruitbay.eu.auth0.com'
AUTH0_SECRET: 'xxxxx'
HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
HASURA_GRAPHQL_ENDPOINT: http://localhost:8080
NEXT_PUBLIC_BUGSNAG_API_KEY: xxxxx
NEXT_PUBLIC_HASURA_URL: http://localhost:8080/v1/graphql
NEXT_PUBLIC_SEGMENT_ID: xxxxx
NEXT_PUBLIC_ENV_NAME: test
PORT: 4000
- run: yarn test:playwright
- run: yarn cypress run
- name: Upload videos
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: video
path: |
playwright
cypress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment