matrix:
  include:
    - language: node_js
      name: 'GoCryptoTrader [front-end]'
      node_js:
        - '10'
        - '8'
        - '6'
      before_install:
        - cd web/
      install:
        - npm install
      script:
        - npm run lint
        - npm run build

    - language: go
      dist: xenial
      name: 'GoCryptoTrader [back-end] [linux] [64-bit]'
      go:
        - 1.17.x
      env:
        - GO111MODULE=on
        - PSQL_USER=postgres
        - PSQL_HOST=localhost
        - PSQL_DBNAME=gct_dev_ci
        - PSQL_SKIPSQLCMD=true
        - PSQL_TESTDBNAME=gct_dev_ci
      install: true
      cache:
        directories:
          - $GOPATH/pkg/mod
      services:
        - postgresql
      before_script:
        - psql -c 'create database gct_dev_ci;' -U postgres
      script:
        - make check
      after_success:
        - bash <(curl -s https://codecov.io/bash)

    - language: go
      dist: xenial
      name: 'GoCryptoTrader [back-end] [linux] [32-bit]'
      go:
        - 1.17.x
      env:
        - GO111MODULE=on
        - NO_RACE_TEST=1
        - PSQL_USER=postgres
        - PSQL_HOST=localhost
        - PSQL_DBNAME=gct_dev_ci
        - PSQL_SKIPSQLCMD=true
        - PSQL_TESTDBNAME=gct_dev_ci
      install: true
      cache:
        directories:
          - $GOPATH/pkg/mod
      services:
        - postgresql
      before_script:
        - psql -c 'create database gct_dev_ci;' -U postgres
      script:
        - export GOARCH=386
        - export CGO_ENABLED=1
        - sudo apt-get update
        - sudo apt-get install gcc-multilib
        - make test
      after_success:
        - bash <(curl -s https://codecov.io/bash)

    - language: go
      os: osx
      name: 'GoCryptoTrader [back-end] [darwin]'
      go:
        - 1.17.x
      env:
        - GO111MODULE=on
        - PSQL_USER=postgres
        - PSQL_HOST=localhost
        - PSQL_DBNAME=gct_dev_ci
        - PSQL_SSLMODE=disable
        - PSQL_SKIPSQLCMD=true
        - PSQL_TESTDBNAME=gct_dev_ci
        - MACOSX_DEPLOYMENT_TARGET=10.15
      install: true
      cache:
        directories:
          - $GOPATH/pkg/mod
      before_install:
        - rm -rf /usr/local/var/postgres
        - initdb /usr/local/var/postgres
        - pg_ctl start --pgdata /usr/local/var/postgres
        - createuser -s postgres
        - psql -c 'create database gct_dev_ci;' -U postgres
      script:
        - make check
      after_success:
        - bash <(curl -s https://codecov.io/bash)
