cotton

SQL Database Toolkit for Deno

https://github.com/rahmanfadhil/cotton
name: ci

on: [push, pull_request, release]

jobs:
  test:
    runs-on: ubuntu-latest

    # Skip commits that includes "ci skip"
    if: "!contains(github.event.head_commit.message, 'ci skip')"

    services:
      postgres:
        image: postgres
        env:
          POSTGRES_USER: test
          POSTGRES_PASSWORD: test
          POSTGRES_DB: test
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
        ports:
          - 5432:5432

      mysql:
        image: mysql:5.7
        env:
          MYSQL_ROOT_PASSWORD: test
          MYSQL_USER: test
          MYSQL_PASSWORD: test
          MYSQL_DATABASE: test
        ports:
          - 3306:3306
        options: >-
          --health-cmd="mysqladmin ping"
          --health-interval=10s
          --health-timeout=5s
          --health-retries=3

    steps:
      - name: Clone repo
        uses: actions/checkout@master

      - name: Install deno
        uses: denolib/setup-deno@master
        with:
          deno-version: 1.6.2

      - name: Check formatting
        run: deno fmt --check

      - name: Run tests
        env:
          POSTGRES_DATABASE: test
          POSTGRES_HOSTNAME: localhost
          POSTGRES_PORT: 5432
          POSTGRES_PASSWORD: test
          POSTGRES_USERNAME: test
          MYSQL_DATABASE: test
          MYSQL_HOSTNAME: localhost
          MYSQL_PORT: 3306
          MYSQL_USERNAME: test
          MYSQL_PASSWORD: test
        run: deno test -c tsconfig.json --allow-read --allow-net --allow-write --allow-env test.ts