CI testing on github actions

184 Views Asked by At

Good day everyone, i have this issue that i have been struggling with since Friday. i'm trying to write a CI test using github actions, but hasura migrate apply keeps throwing this error - level=fatal msg="database not found: error determining database kind for default, check if database exists on hasura". I have tried everything, anything suggestions will be deeply appreciated. i don't even know what else to pass as the anymore as the --database-name


name: Hasura Tests

on:
  pull_request:
    branches:
      - develop

jobs:
  build:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: kartoza/postgis:12.4
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASS: postgrespassword
          POSTGRES_DBNAME: postgres
        options: --health-cmd pg_isready --health-interval 30s --health-retries 12
        ports:
          - 5432:5432
      hasura:
        image: hasura/graphql-engine:v2.6.2
        env:
          HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
          HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
          PG_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
          HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
          HASURA_GRAPHQL_DEV_MODE: "true"
          HASURA_GRAPHQL_LOG_LEVEL: debug
          HASURA_GRAPHQL_ENABLED_APIS: "metadata,graphql"
          HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
          HASURA_GRAPHQL_ADMIN_SECRET: super-secret
        ports:
          - 4000:8080
    steps:
      - uses: actions/checkout@v2

      - uses: c-hive/gha-yarn-cache@v2
   
      - name:
        run: |
          docker container ls

      - name: Hasura CI/CD
        uses: browniefed/hasura-runner@master
        with:
          args: metadata apply
        env:
          PATH_TO_HASURA_PROJECT_ROOT: ./
          HASURA_CLI_VERSION: v2.6.2
          HASURA_ENDPOINT: http://hasura:8080
          HASURA_ADMIN_SECRET: super-secret

      - name: Hasura CI/CD
        uses: browniefed/hasura-runner@master
        with:
          args: migrate apply --database-name default
        env:
          PATH_TO_HASURA_PROJECT_ROOT: ./
          HASURA_CLI_VERSION: v2.6.2
          HASURA_ENDPOINT: http://hasura:8080
          HASURA_ADMIN_SECRET: super-secret

      - name: Hasura CI/CD
        uses: browniefed/hasura-runner@master
        with:
          args: metadata reload
        env:
          PATH_TO_HASURA_PROJECT_ROOT: ./
          HASURA_CLI_VERSION: v2.6.2
          HASURA_ENDPOINT: http://hasura:8080
          HASURA_ADMIN_SECRET: super-secret

      - name: Hasura CI/CD
        uses: browniefed/hasura-runner@master
        with:
          args: seeds apply --database-name default
        env:
          PATH_TO_HASURA_PROJECT_ROOT: ./
          HASURA_CLI_VERSION: v2.6.2
          HASURA_ENDPOINT: http://hasura:8080
          HASURA_ADMIN_SECRET: super-secret

      - name: Run unit tests
        run: |
          npm install
          npm run test:ci
        working-directory: ./



0

There are 0 best solutions below