name: End-to-end tests
on: [push]
jobs:
  cypress-run:
    runs-on: ubuntu-latest
    container: cypress/browsers:node14.16.0-chrome89-ff77
    services:
      mariadb:
        image: mariadb:latest
        ports:
          - 3306:3306
        env:
          MYSQL_USER: test
          MYSQL_PASSWORD: test
          MYSQL_DATABASE: test
          MYSQL_ROOT_PASSWORD: test
        options: >-
          --health-cmd="mysqladmin ping"
          --health-interval=5s
          --health-timeout=2s
          --health-retries=3

    steps:
      - name: Checkout
        uses: actions/checkout@v1
      - name: Install
        run: npm install --include=dev
      - name: Prisma init
        run: npm run db
        env:
          DATABASE_URL: "mysql://test:test@localhost:3306/test"
      # Install NPM dependencies, cache them correctly
      # and run all Cypress tests
      - name: Cypress run
        uses: cypress-io/github-action@v2
        with:
          start: npm run start
          # quote the url to be safe against YML parsing surprises
          wait-on: 'http://localhost:3000/demo'
          quiet: true
        env:
          DATABASE_URL: "mysql://test:test@localhost:3306/test"

name: End-to-end tests
on: [push]
jobs:
  cypress-run:
    runs-on: ubuntu-latest
    container: cypress/browsers:node14.16.0-chrome89-ff77
    services:
      mariadb:
        image: mariadb:latest
        ports:
          - 3306:3306
        env:
          MYSQL_USER: test
          MYSQL_PASSWORD: test
          MYSQL_DATABASE: test
          MYSQL_ROOT_PASSWORD: test
        options: >-
          --health-cmd="mysqladmin ping"
          --health-interval=5s
          --health-timeout=2s
          --health-retries=3

    steps:
      - name: Checkout
        uses: actions/checkout@v1
      - name: Install
        run: npm install --include=dev
      - name: Prisma init
        run: npm run db
        env:
          DATABASE_URL: "mysql://test:test@localhost:3306/test"
      # Install NPM dependencies, cache them correctly
      # and run all Cypress tests
      - name: Cypress run
        uses: cypress-io/github-action@v2
        with:
          start: npm run start
          # quote the url to be safe against YML parsing surprises
          wait-on: 'http://localhost:3000/demo'
          quiet: true
        env:
          DATABASE_URL: "mysql://test:test@mariadb:3306/test"

Use service name as host
Use service name as host
