diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 7dee2fd1..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,599 +0,0 @@ -version: 2 - -node-image: &node-image - image: circleci/node:17 - -set-npm-global: &set-npm-global - run: - name: set-npm-global - command: | - mkdir -p ~/.npm-global - npm config set prefix '~/.npm-global' - echo 'export NPM_CONFIG_PREFIX=~/.npm-global' >> $BASH_ENV - echo 'export PATH=~/.npm-global/bin:$PATH' >> $BASH_ENV - source $BASH_ENV - npm install -g pnpm - -save: &save - save_cache: - key: code-{{ .Revision }} - paths: - - . - - '~/.npm-global' - -restore: &restore - restore_cache: - key: code-{{ .Revision }} - -postgres-wait: &postgres-wait - run: - name: Wait for DB - command: dockerize -wait tcp://127.0.0.1:5432 -timeout 120s - -test-postgres: &test-postgres - run: - name: test - command: npm run migrate up -- -m test/migrations && npm run migrate down 0 -- -m test/migrations --timestamps - -cockroach-wait: &cockroach-wait - run: - name: Wait for DB - command: | - dockerize -wait tcp://127.0.0.1:26257 -timeout 120s && node -e ' - (new (require("pg").Pool)({ connectionString: process.env.DATABASE_URL })) - .query( - "CREATE DATABASE circle_test", - err => (process.exitCode = err ? 1 : 0) && process.stdout.write(err.stack) - ) - ' - -jobs: - install: - docker: - - <<: *node-image - steps: - - checkout - - <<: *set-npm-global - - restore_cache: - key: dependency-cache-{{ checksum "pnpm-lock.yaml" }} - - run: npm i - - save_cache: - key: dependency-cache-{{ checksum "pnpm-lock.yaml" }} - paths: - - ./node_modules - - <<: *save - test-pg-9: - docker: - - <<: *node-image - environment: - - DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/circle_test - - image: postgres:9.6-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - <<: *test-postgres - test-pg-10: - docker: - - <<: *node-image - environment: - - DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/circle_test - - image: postgres:10.19-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - <<: *test-postgres - test-pg-11: - docker: - - <<: *node-image - environment: - - DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/circle_test - - image: postgres:11.14-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - <<: *test-postgres - test-pg-12: - docker: - - <<: *node-image - environment: - - DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/circle_test - - image: postgres:12.9-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - <<: *test-postgres - test-pg-13: - docker: - - <<: *node-image - environment: - - DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/circle_test - - image: postgres:13.5-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - <<: *test-postgres - test-pg-14: - docker: - - <<: *node-image - environment: - - DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/circle_test - - image: postgres:14.1-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - <<: *test-postgres - test-cockroach-1: - docker: - - <<: *node-image - environment: - - DATABASE_URL=postgresql://root@localhost:26257/circle_test - - image: cockroachdb/cockroach:v1.1.9 - command: ['start', '--insecure', '--host=localhost'] - steps: - - <<: *restore - - <<: *cockroach-wait - - run: - name: test - command: npm run migrate up -- -m test/cockroach -s '' --migrations-schema circle_test --no-lock && npm run migrate down 0 -- -m test/cockroach -s '' --migrations-schema circle_test --no-lock --timestamps - test-cockroach-2: - docker: - - <<: *node-image - environment: - - DATABASE_URL=postgresql://root@localhost:26257/circle_test - - image: cockroachdb/cockroach:v2.1.11 - command: ['start', '--insecure', '--host=localhost'] - steps: - - <<: *restore - - <<: *cockroach-wait - - run: - name: test - command: npm run migrate up -- -m test/cockroach --no-lock && npm run migrate down 0 -- -m test/cockroach --no-lock --timestamps - test-cockroach-19: - docker: - - <<: *node-image - environment: - - DATABASE_URL=postgresql://root@localhost:26257/circle_test - - image: cockroachdb/cockroach:v19.2.12 - command: ['start', '--insecure', '--host=localhost'] - steps: - - <<: *restore - - <<: *cockroach-wait - - run: - name: test - command: npm run migrate up -- -m test/cockroach --no-lock && npm run migrate down 0 -- -m test/cockroach --no-lock --timestamps - test-cockroach-20: - docker: - - <<: *node-image - environment: - - DATABASE_URL=postgresql://root@localhost:26257/circle_test - - image: cockroachdb/cockroach:v20.2.18 - command: ['start-single-node', '--insecure', '--host=localhost'] - steps: - - <<: *restore - - <<: *cockroach-wait - - run: - name: test - command: npm run migrate up -- -m test/cockroach --no-lock && npm run migrate down 0 -- -m test/cockroach --no-lock --timestamps - test-cockroach-21: - docker: - - <<: *node-image - environment: - - DATABASE_URL=postgresql://root@localhost:26257/circle_test - - image: cockroachdb/cockroach:v21.2.3 - command: ['start-single-node', '--insecure', '--host=localhost'] - steps: - - <<: *restore - - <<: *cockroach-wait - - run: - name: test - command: npm run migrate up -- -m test/cockroach --no-lock && npm run migrate down 0 -- -m test/cockroach --no-lock --timestamps - test-node-12: - docker: - - image: circleci/node:12.20.0 - environment: - - DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/circle_test - - image: postgres:14.1-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - <<: *test-postgres - test-node-14: - docker: - - image: circleci/node:14 - environment: - - DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/circle_test - - image: postgres:14.1-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - <<: *test-postgres - test-node-16: - docker: - - image: circleci/node:16 - environment: - - DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/circle_test - - image: postgres:14.1-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - <<: *test-postgres - test-node-17: - docker: - - image: circleci/node:17 - environment: - - DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/circle_test - - image: postgres:13.5-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - <<: *test-postgres - test-config: - docker: - - <<: *node-image - - image: postgres:14.1-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - run: - name: create-config - command: | - mkdir -p config - cat > config/default.json << 'EOF' - { - "db": { - "user": "ubuntu", - "password": "ubuntu", - "host": "localhost", - "port": "5432", - "database": "circle_test" - } - } - EOF - - <<: *postgres-wait - - <<: *test-postgres - test-dotenv: - docker: - - <<: *node-image - - image: postgres:14.1-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - run: - name: create-config - command: | - cat > .env << 'EOF' - DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/circle_test - EOF - - <<: *postgres-wait - - <<: *test-postgres - test-dotenv-expand: - docker: - - <<: *node-image - - image: postgres:14.1-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - run: - name: create-config - command: | - cat > .env << 'EOF' - POSTGRES_USER=ubuntu - POSTGRES_PASSWORD=ubuntu - POSTGRES_DB=circle_test - DATABASE_URL=postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@localhost:5432/$POSTGRES_DB - EOF - - <<: *postgres-wait - - <<: *test-postgres - test-password-1: - docker: - - <<: *node-image - environment: - # can't use characters @#?/ in password - they have special meaning in url - - DATABASE_URL=postgres://ubuntu:123456abcdefghABCDEFGH~\`\!$%^\&*-_=+{}[]\(\)\<\>,.\;:\"\'\|\\@localhost:5432/circle_test - - image: postgres:14.1-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=123456abcdefghABCDEFGH~\`\!$%^\&*-_=+{}[]\(\)\<\>,.\;:\"\'\|\\ - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - <<: *test-postgres - test-password-2: - docker: - - <<: *node-image - - image: postgres:14.1-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=123456abcdefghABCDEFGH~\`\!@#$%^\&*-_=+{}[]\(\)\<\>,.\;:\"\'?\|/\\ - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - run: - name: create-config - command: | - mkdir -p config - cat > config/default.json << 'EOF' - { - "db": { - "user": "ubuntu", - "password": "123456abcdefghABCDEFGH~`!@#$%^&*-_=+{}[]()<>,.;:\"'?|/\\", - "host": "localhost", - "port": "5432", - "database": "circle_test" - } - } - EOF - - <<: *postgres-wait - - <<: *test-postgres - test-env-vars: - docker: - - <<: *node-image - environment: - - PGUSER=ubuntu - - PGPASSWORD=123456abcdefghABCDEFGH~\`\!@#$%^\&*-_=+{}[]\(\)\<\>,.\;:\"\'?\|/\\ - - PGDATABASE=circle_test - - image: postgres:14.1-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=123456abcdefghABCDEFGH~\`\!@#$%^\&*-_=+{}[]\(\)\<\>,.\;:\"\'?\|/\\ - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - <<: *test-postgres - test-schema: - docker: - - <<: *node-image - environment: - - DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/circle_test - # used in tests - - SCHEMA=myschema - - image: postgres:14.1-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - run: - name: test - command: npm run migrate up -- -s myschema --create-schema -m test/migrations && npm run migrate down 0 -- -s myschema -m test/migrations --timestamps - test-schemas: - docker: - - <<: *node-image - environment: - - DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/circle_test - # used in tests - - SCHEMA=myschema - - image: postgres:14.1-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - run: - name: test - command: npm run migrate up -- -s myschema public --create-schema -m test/migrations && npm run migrate down 0 -- -s myschema public -m test/migrations --timestamps - test-typescript-migration: - docker: - - <<: *node-image - environment: - - DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/circle_test - - image: postgres:14.1-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - run: - name: test - command: npm run migrate up -- --tsconfig tsconfig.json -m test/ts/migrations && npm run migrate down 0 -- --tsconfig tsconfig.json -m test/ts/migrations --timestamps - test-typescript-customrunner-url: - docker: - - <<: *node-image - environment: - - DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/circle_test - - image: postgres:14.1-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - run: - name: test - command: $(npm bin)/ts-node test/ts/customRunnerDBUrl.ts - test-typescript-customrunner-client: - docker: - - <<: *node-image - environment: - - DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/circle_test - - image: postgres:14.1-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - run: - name: test - command: $(npm bin)/ts-node test/ts/customRunnerDBClient.ts - test-typescript-customrunner-undef-count: - docker: - - <<: *node-image - environment: - - DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/circle_test - - image: postgres:14.1-alpine - environment: - - POSTGRES_USER=ubuntu - - POSTGRES_PASSWORD=ubuntu - - POSTGRES_DB=circle_test - steps: - - <<: *restore - - <<: *postgres-wait - - run: - name: test - command: $(npm bin)/ts-node test/ts/customRunnerUndefCount.ts - test-create-migration: - docker: - - <<: *node-image - steps: - - <<: *restore - - run: - name: check dir does not exists - command: | - [ ! -d migrations ] - - run: - name: create migration - command: npm run migrate create test - - run: - name: check file was created - command: | - [ $(ls -1 migrations | wc -l) -eq 1 ] - -workflows: - version: 2 - main_workflow: - jobs: - - install - - test-pg-9: - requires: - - install - - test-pg-10: - requires: - - install - - test-pg-11: - requires: - - install - - test-pg-12: - requires: - - install - - test-pg-13: - requires: - - install - - test-pg-14: - requires: - - install - - test-cockroach-1: - requires: - - install - - test-cockroach-2: - requires: - - install - - test-cockroach-19: - requires: - - install - - test-cockroach-20: - requires: - - install - - test-cockroach-21: - requires: - - install - - test-node-12: - requires: - - install - - test-node-14: - requires: - - install - - test-node-16: - requires: - - install - - test-node-17: - requires: - - install - - test-config: - requires: - - install - - test-dotenv: - requires: - - install - - test-dotenv-expand: - requires: - - install - - test-password-1: - requires: - - install - - test-password-2: - requires: - - install - - test-env-vars: - requires: - - install - - test-schema: - requires: - - install - - test-schemas: - requires: - - install - - test-typescript-migration: - requires: - - install - - test-typescript-customrunner-url: - requires: - - install - - test-typescript-customrunner-client: - requires: - - install - - test-typescript-customrunner-undef-count: - requires: - - install - - test-create-migration: - requires: - - install diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 541b31b3..4d527278 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,9 +23,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - # Required for docs/versions tests - fetch-depth: 0 - name: Install pnpm uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 @@ -72,3 +69,42 @@ jobs: - name: Check formatting run: pnpm prettier --check . + + create-migration-test: + runs-on: ubuntu-latest + strategy: + matrix: + node_version: [20] + fail-fast: false + timeout-minutes: 10 + + name: 'Create Migration Test: node-${{ matrix.node_version }}, ubuntu-latest' + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install pnpm + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: ${{ matrix.node_version }} + cache: 'pnpm' + + - name: Install deps + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Check dir does not exists + run: | + [ ! -d migrations ] + + - name: Create migration + run: pnpm run migrate create test + + - name: Check file was created + run: | + [ $(ls -1 migrations | wc -l) -eq 1 ] diff --git a/.github/workflows/cockroach-test.yml b/.github/workflows/cockroach-test.yml new file mode 100644 index 00000000..7b9b1917 --- /dev/null +++ b/.github/workflows/cockroach-test.yml @@ -0,0 +1,56 @@ +name: Cockroach Test + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read # to fetch code (actions/checkout) + +jobs: + integration-test: + runs-on: ubuntu-latest + strategy: + matrix: + node_version: [20] + cockroach_version: [22.2.19, 23.1.16] + fail-fast: false + timeout-minutes: 10 + + name: 'Cockroach Test: cockroach-${{ matrix.cockroach_version }}, node-${{ matrix.node_version }}, ubuntu-latest' + steps: + - name: Init Cockroach + env: + COCKROACHDB_DOCKER_TAG: cockroachdb/cockroach:v${{ matrix.cockroach_version }} + DATABASE_URL: postgresql://root@localhost:26257/integration_test + run: | + docker pull $COCKROACHDB_DOCKER_TAG + docker run -d --name roach --hostname roach -p 26257:26257 -p 8080:8080 $COCKROACHDB_DOCKER_TAG start-single-node --insecure + sudo apt update && sudo apt install wait-for-it -y + wait-for-it -h localhost -p 26257 + docker exec roach bash -c "./cockroach sql --execute=\"CREATE DATABASE integration_test;\" --insecure" + + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install pnpm + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: ${{ matrix.node_version }} + cache: 'pnpm' + + - name: Install deps + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Integration Test + run: pnpm run migrate up -m test/cockroach --no-lock && pnpm run migrate down 0 -m test/cockroach --no-lock --timestamps + env: + DATABASE_URL: postgresql://root@localhost:26257/integration_test diff --git a/.github/workflows/postgres-test.yml b/.github/workflows/postgres-test.yml new file mode 100644 index 00000000..5b25b176 --- /dev/null +++ b/.github/workflows/postgres-test.yml @@ -0,0 +1,716 @@ +name: Postgres Test + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read # to fetch code (actions/checkout) + +jobs: + migration-test: + runs-on: ubuntu-latest + strategy: + matrix: + node_version: [18, 20] + postgres_version: [12.18, 13.14, 14.11, 15.6, 16.2] + fail-fast: false + timeout-minutes: 10 + + services: + postgres: + image: postgres:${{ matrix.postgres_version }}-alpine + env: + POSTGRES_USER: ubuntu + POSTGRES_PASSWORD: ubuntu + POSTGRES_DB: integration_test + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + + name: 'Postgres Test: pg-${{ matrix.postgres_version }}, node-${{ matrix.node_version }}, ubuntu-latest' + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install pnpm + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: ${{ matrix.node_version }} + cache: 'pnpm' + + - name: Install deps + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Integration Test + run: pnpm run migrate up -m test/migrations && pnpm run migrate down 0 -m test/migrations --timestamps + env: + DATABASE_URL: postgres://ubuntu:ubuntu@localhost:5432/integration_test + + config-test: + runs-on: ubuntu-latest + strategy: + matrix: + node_version: [20] + postgres_version: [16.2] + fail-fast: false + timeout-minutes: 10 + + services: + postgres: + image: postgres:${{ matrix.postgres_version }}-alpine + env: + POSTGRES_USER: ubuntu + POSTGRES_PASSWORD: ubuntu + POSTGRES_DB: integration_test + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + + name: 'Config Test: pg-${{ matrix.postgres_version }}, node-${{ matrix.node_version }}, ubuntu-latest' + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install pnpm + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: ${{ matrix.node_version }} + cache: 'pnpm' + + - name: Install deps + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Write config + run: | + mkdir -p config + cat > config/default.json << 'EOF' + { + "db": { + "user": "ubuntu", + "password": "ubuntu", + "host": "localhost", + "port": "5432", + "database": "integration_test" + } + } + EOF + + - name: Integration Test + run: pnpm run migrate up -m test/migrations && pnpm run migrate down 0 -m test/migrations --timestamps + + dotenv-test: + runs-on: ubuntu-latest + strategy: + matrix: + node_version: [20] + postgres_version: [16.2] + fail-fast: false + timeout-minutes: 10 + + services: + postgres: + image: postgres:${{ matrix.postgres_version }}-alpine + env: + POSTGRES_USER: ubuntu + POSTGRES_PASSWORD: ubuntu + POSTGRES_DB: integration_test + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + + name: 'Dotenv Test: pg-${{ matrix.postgres_version }}, node-${{ matrix.node_version }}, ubuntu-latest' + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install pnpm + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: ${{ matrix.node_version }} + cache: 'pnpm' + + - name: Install deps + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Write config + run: | + cat > .env << 'EOF' + DATABASE_URL=postgres://ubuntu:ubuntu@localhost:5432/integration_test + EOF + + - name: Integration Test + run: pnpm run migrate up -m test/migrations && pnpm run migrate down 0 -m test/migrations --timestamps + + dotenv-expand-test: + runs-on: ubuntu-latest + strategy: + matrix: + node_version: [20] + postgres_version: [16.2] + fail-fast: false + timeout-minutes: 10 + + services: + postgres: + image: postgres:${{ matrix.postgres_version }}-alpine + env: + POSTGRES_USER: ubuntu + POSTGRES_PASSWORD: ubuntu + POSTGRES_DB: integration_test + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + + name: 'Dotenv Expand Test: pg-${{ matrix.postgres_version }}, node-${{ matrix.node_version }}, ubuntu-latest' + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install pnpm + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: ${{ matrix.node_version }} + cache: 'pnpm' + + - name: Install deps + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Write config + run: | + cat > .env << 'EOF' + POSTGRES_USER=ubuntu + POSTGRES_PASSWORD=ubuntu + POSTGRES_DB=integration_test + DATABASE_URL=postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@localhost:5432/$POSTGRES_DB + EOF + + - name: Integration Test + run: pnpm run migrate up -m test/migrations && pnpm run migrate down 0 -m test/migrations --timestamps + + password-1-test: + runs-on: ubuntu-latest + strategy: + matrix: + node_version: [20] + postgres_version: [16.2] + fail-fast: false + timeout-minutes: 10 + + services: + postgres: + image: postgres:${{ matrix.postgres_version }}-alpine + env: + POSTGRES_USER: ubuntu + # can't use characters @#?/ in password - they have special meaning in url + POSTGRES_PASSWORD: 123456abcdefghABCDEFGH~\`\!$%^\&*-_=+{}[]\(\)\<\>,.\;:\"\'\|\\ + POSTGRES_DB: integration_test + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + + name: 'Password 1 Test: pg-${{ matrix.postgres_version }}, node-${{ matrix.node_version }}, ubuntu-latest' + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install pnpm + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: ${{ matrix.node_version }} + cache: 'pnpm' + + - name: Install deps + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Integration Test + run: pnpm run migrate up -m test/migrations && pnpm run migrate down 0 -m test/migrations --timestamps + env: + DATABASE_URL: postgres://ubuntu:123456abcdefghABCDEFGH~\`\!$%^\&*-_=+{}[]\(\)\<\>,.\;:\"\'\|\\@localhost:5432/integration_test + + password-2-test: + runs-on: ubuntu-latest + strategy: + matrix: + node_version: [20] + postgres_version: [16.2] + fail-fast: false + timeout-minutes: 10 + + services: + postgres: + image: postgres:${{ matrix.postgres_version }}-alpine + env: + POSTGRES_USER: ubuntu + POSTGRES_PASSWORD: 123456abcdefghABCDEFGH~`!$%^&*-_=+{}[]()<>,.;:"'|\ + POSTGRES_DB: integration_test + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + + name: 'Password 2 Test: pg-${{ matrix.postgres_version }}, node-${{ matrix.node_version }}, ubuntu-latest' + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install pnpm + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: ${{ matrix.node_version }} + cache: 'pnpm' + + - name: Install deps + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Write config + run: | + mkdir -p config + cat > config/default.json << 'EOF' + { + "db": { + "user": "ubuntu", + "password": "123456abcdefghABCDEFGH~`!$%^&*-_=+{}[]()<>,.;:\"'|\\", + "host": "localhost", + "port": "5432", + "database": "integration_test" + } + } + EOF + + - name: Integration Test + run: pnpm run migrate up -m test/migrations && pnpm run migrate down 0 -m test/migrations --timestamps + + env-vars-test: + runs-on: ubuntu-latest + strategy: + matrix: + node_version: [20] + postgres_version: [16.2] + fail-fast: false + timeout-minutes: 10 + + services: + postgres: + image: postgres:${{ matrix.postgres_version }}-alpine + env: + POSTGRES_USER: ubuntu + POSTGRES_PASSWORD: 123456abcdefghABCDEFGH~\`\!@#$%^\&*-_=+{}[]\(\)\<\>,.\;:\"\'?\|/\\ + POSTGRES_DB: integration_test + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + + name: 'Env Vars Test: pg-${{ matrix.postgres_version }}, node-${{ matrix.node_version }}, ubuntu-latest' + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install pnpm + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: ${{ matrix.node_version }} + cache: 'pnpm' + + - name: Install deps + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Integration Test + run: pnpm run migrate up -m test/migrations && pnpm run migrate down 0 -m test/migrations --timestamps + env: + PGUSER: ubuntu + PGPASSWORD: 123456abcdefghABCDEFGH~\`\!@#$%^\&*-_=+{}[]\(\)\<\>,.\;:\"\'?\|/\\ + PGDATABASE: integration_test + + schema-test: + runs-on: ubuntu-latest + strategy: + matrix: + node_version: [20] + postgres_version: [16.2] + fail-fast: false + timeout-minutes: 10 + + services: + postgres: + image: postgres:${{ matrix.postgres_version }}-alpine + env: + POSTGRES_USER: ubuntu + POSTGRES_PASSWORD: ubuntu + POSTGRES_DB: integration_test + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + + name: 'Schema Test: pg-${{ matrix.postgres_version }}, node-${{ matrix.node_version }}, ubuntu-latest' + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install pnpm + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: ${{ matrix.node_version }} + cache: 'pnpm' + + - name: Install deps + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Integration Test + run: pnpm run migrate up -s myschema --create-schema -m test/migrations && pnpm run migrate down 0 -s myschema -m test/migrations --timestamps + env: + DATABASE_URL: postgres://ubuntu:ubuntu@localhost:5432/integration_test + SCHEMA: myschema + + schemas-test: + runs-on: ubuntu-latest + strategy: + matrix: + node_version: [20] + postgres_version: [16.2] + fail-fast: false + timeout-minutes: 10 + + services: + postgres: + image: postgres:${{ matrix.postgres_version }}-alpine + env: + POSTGRES_USER: ubuntu + POSTGRES_PASSWORD: ubuntu + POSTGRES_DB: integration_test + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + + name: 'Schemas Test: pg-${{ matrix.postgres_version }}, node-${{ matrix.node_version }}, ubuntu-latest' + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install pnpm + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: ${{ matrix.node_version }} + cache: 'pnpm' + + - name: Install deps + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Integration Test + run: pnpm run migrate up -s myschema public --create-schema -m test/migrations && pnpm run migrate down 0 -s myschema public -m test/migrations --timestamps + env: + DATABASE_URL: postgres://ubuntu:ubuntu@localhost:5432/integration_test + SCHEMA: myschema + + typescript-migration-test: + runs-on: ubuntu-latest + strategy: + matrix: + node_version: [20] + postgres_version: [16.2] + fail-fast: false + timeout-minutes: 10 + + services: + postgres: + image: postgres:${{ matrix.postgres_version }}-alpine + env: + POSTGRES_USER: ubuntu + POSTGRES_PASSWORD: ubuntu + POSTGRES_DB: integration_test + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + + name: 'TypeScript Migration Test: pg-${{ matrix.postgres_version }}, node-${{ matrix.node_version }}, ubuntu-latest' + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install pnpm + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: ${{ matrix.node_version }} + cache: 'pnpm' + + - name: Install deps + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Integration Test + run: pnpm run migrate up --tsconfig tsconfig.json -m test/ts/migrations && pnpm run migrate down 0 --tsconfig tsconfig.json -m test/ts/migrations --timestamps + env: + DATABASE_URL: postgres://ubuntu:ubuntu@localhost:5432/integration_test + + typescript-customrunner-url-test: + runs-on: ubuntu-latest + strategy: + matrix: + node_version: [20] + postgres_version: [16.2] + fail-fast: false + timeout-minutes: 10 + + services: + postgres: + image: postgres:${{ matrix.postgres_version }}-alpine + env: + POSTGRES_USER: ubuntu + POSTGRES_PASSWORD: ubuntu + POSTGRES_DB: integration_test + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + + name: 'TypeScript Customrunner Url Test: pg-${{ matrix.postgres_version }}, node-${{ matrix.node_version }}, ubuntu-latest' + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install pnpm + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: ${{ matrix.node_version }} + cache: 'pnpm' + + - name: Install deps + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Integration Test + run: pnpm ts-node test/ts/customRunnerDBUrl.ts + env: + DATABASE_URL: postgres://ubuntu:ubuntu@localhost:5432/integration_test + + typescript-customrunner-client-test: + runs-on: ubuntu-latest + strategy: + matrix: + node_version: [20] + postgres_version: [16.2] + fail-fast: false + timeout-minutes: 10 + + services: + postgres: + image: postgres:${{ matrix.postgres_version }}-alpine + env: + POSTGRES_USER: ubuntu + POSTGRES_PASSWORD: ubuntu + POSTGRES_DB: integration_test + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + + name: 'TypeScript Customrunner Client Test: pg-${{ matrix.postgres_version }}, node-${{ matrix.node_version }}, ubuntu-latest' + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install pnpm + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: ${{ matrix.node_version }} + cache: 'pnpm' + + - name: Install deps + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Integration Test + run: pnpm ts-node test/ts/customRunnerDBClient.ts + env: + DATABASE_URL: postgres://ubuntu:ubuntu@localhost:5432/integration_test + + typescript-customrunner-undef-count-test: + runs-on: ubuntu-latest + strategy: + matrix: + node_version: [20] + postgres_version: [16.2] + fail-fast: false + timeout-minutes: 10 + + services: + postgres: + image: postgres:${{ matrix.postgres_version }}-alpine + env: + POSTGRES_USER: ubuntu + POSTGRES_PASSWORD: ubuntu + POSTGRES_DB: integration_test + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + + name: 'TypeScript Customrunner undef count Test: pg-${{ matrix.postgres_version }}, node-${{ matrix.node_version }}, ubuntu-latest' + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install pnpm + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: ${{ matrix.node_version }} + cache: 'pnpm' + + - name: Install deps + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Integration Test + run: pnpm ts-node test/ts/customRunnerUndefCount.ts + env: + DATABASE_URL: postgres://ubuntu:ubuntu@localhost:5432/integration_test