diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index edae916de4..c22d087b08 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -6,7 +6,7 @@ on: jobs: container-job: runs-on: ubuntu-latest - container: node:20.12.0-alpine + container: pyramation/node-sqitch:20.12.0 services: pg_db: @@ -37,11 +37,28 @@ jobs: --health-retries 5 steps: + # - name: Install Git + # run: apk add --no-cache git + + - name: Configure Git (for tests) + run: | + git config --global user.name "CI Test User" + git config --global user.email "ci@example.com" + + # - name: Install Sqitch on Alpine + # run: | + # apk add --no-cache curl make perl perl-utils perl-dev build-base \ + # libpq libpq-dev postgresql-dev \ + # perl-dbd-pg perl-dbi perl-dbd-sqlite \ + # cpanminus + + # cpanm --notest --quiet App::Sqitch + - name: checkout uses: actions/checkout@v4 - - name: deps - run: apk update && apk add bash git python3-dev make g++ + # - name: deps + # run: apk update && apk add bash git python3-dev make g++ - name: deps run: yarn @@ -49,6 +66,12 @@ jobs: - name: build run: yarn build + - name: launchql/migrate + run: cd ./packages/migrate && yarn test + + - name: launchql/cli + run: cd ./packages/cli && yarn test + - name: launchql/client run: cd ./packages/client && yarn test env: diff --git a/TODO b/TODO index 2c85dcc49d..2205997072 100644 --- a/TODO +++ b/TODO @@ -12,8 +12,8 @@ Good next steps: 1. Get a demo script of creating some tables w the meta api -2. Get export working -3. Get boilerplate (lql init) working +X 2. Get export working +X 3. Get boilerplate (lql init) working 4. Get testing framework working (this will be HUGE) ** remove shelljs diff --git a/packages/cli/__tests__/__snapshots__/extensions.test.ts.snap b/packages/cli/__tests__/__snapshots__/extensions.test.ts.snap index e185844bea..b24b4686f8 100644 --- a/packages/cli/__tests__/__snapshots__/extensions.test.ts.snap +++ b/packages/cli/__tests__/__snapshots__/extensions.test.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`extension runs \`extension\` command after workspace and module setup: extension-update - files 1`] = ` +exports[`cmds:extension runs \`extension\` command after workspace and module setup: extension-update - files 1`] = ` [ "__tests__/first.test.ts", ".questions.json", @@ -17,7 +17,7 @@ exports[`extension runs \`extension\` command after workspace and module setup: ] `; -exports[`extension runs \`extension\` command after workspace and module setup: extension-update - result 1`] = ` +exports[`cmds:extension runs \`extension\` command after workspace and module setup: extension-update - result 1`] = ` { "_": [ "extension", @@ -30,7 +30,7 @@ exports[`extension runs \`extension\` command after workspace and module setup: } `; -exports[`extension runs \`extension\` command after workspace and module setup: initial - control file 1`] = ` +exports[`cmds:extension runs \`extension\` command after workspace and module setup: initial - control file 1`] = ` "# my-module extension comment = 'my-module extension' default_version = '0.0.1' @@ -41,7 +41,7 @@ superuser = false " `; -exports[`extension runs \`extension\` command after workspace and module setup: initial - module dependencies 1`] = ` +exports[`cmds:extension runs \`extension\` command after workspace and module setup: initial - module dependencies 1`] = ` { "modules": [], "native": [ @@ -51,14 +51,14 @@ exports[`extension runs \`extension\` command after workspace and module setup: } `; -exports[`extension runs \`extension\` command after workspace and module setup: initial - required modules 1`] = ` +exports[`cmds:extension runs \`extension\` command after workspace and module setup: initial - required modules 1`] = ` [ "mod-1", "mod2", ] `; -exports[`extension runs \`extension\` command after workspace and module setup: updated - control file 1`] = ` +exports[`cmds:extension runs \`extension\` command after workspace and module setup: updated - control file 1`] = ` "# my-module extension comment = 'my-module extension' default_version = '0.0.1' @@ -69,7 +69,7 @@ superuser = false " `; -exports[`extension runs \`extension\` command after workspace and module setup: updated - module dependencies 1`] = ` +exports[`cmds:extension runs \`extension\` command after workspace and module setup: updated - module dependencies 1`] = ` { "modules": [], "native": [ @@ -79,7 +79,7 @@ exports[`extension runs \`extension\` command after workspace and module setup: } `; -exports[`extension runs \`extension\` command after workspace and module setup: updated - required modules 1`] = ` +exports[`cmds:extension runs \`extension\` command after workspace and module setup: updated - required modules 1`] = ` [ "plpgsql", "module-c", diff --git a/packages/cli/__tests__/__snapshots__/init.test.ts.snap b/packages/cli/__tests__/__snapshots__/init.test.ts.snap index adfcad8f86..13c3c3699b 100644 --- a/packages/cli/__tests__/__snapshots__/init.test.ts.snap +++ b/packages/cli/__tests__/__snapshots__/init.test.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`init initialize module 1`] = ` +exports[`cmds:init initialize module 1`] = ` "# my-module extension comment = 'my-module extension' default_version = '0.0.1' @@ -11,7 +11,7 @@ superuser = false " `; -exports[`init initialize module: module-only - argv 1`] = ` +exports[`cmds:init initialize module: module-only - argv 1`] = ` { "MODULENAME": "my-module", "_": [ @@ -26,7 +26,7 @@ exports[`init initialize module: module-only - argv 1`] = ` } `; -exports[`init initialize module: module-only - files 1`] = ` +exports[`cmds:init initialize module: module-only - files 1`] = ` [ ".eslintrc.json", ".gitignore", @@ -57,7 +57,7 @@ exports[`init initialize module: module-only - files 1`] = ` ] `; -exports[`init initialize module: module-only - result 1`] = ` +exports[`cmds:init initialize module: module-only - result 1`] = ` { "MODULENAME": "my-module", "_": [ @@ -72,11 +72,11 @@ exports[`init initialize module: module-only - result 1`] = ` } `; -exports[`init initialize module: module-only - transformResults 1`] = `[]`; +exports[`cmds:init initialize module: module-only - transformResults 1`] = `[]`; -exports[`init initialize module: module-only - writeResults 1`] = `[]`; +exports[`cmds:init initialize module: module-only - writeResults 1`] = `[]`; -exports[`init initializes workspace: workspace - argv 1`] = ` +exports[`cmds:init initializes workspace: workspace - argv 1`] = ` { "_": [ "init", @@ -87,7 +87,7 @@ exports[`init initializes workspace: workspace - argv 1`] = ` } `; -exports[`init initializes workspace: workspace - files 1`] = ` +exports[`cmds:init initializes workspace: workspace - files 1`] = ` [ "my-workspace/.eslintrc.json", "my-workspace/.gitignore", @@ -106,7 +106,7 @@ exports[`init initializes workspace: workspace - files 1`] = ` ] `; -exports[`init initializes workspace: workspace - result 1`] = ` +exports[`cmds:init initializes workspace: workspace - result 1`] = ` { "_": [ "init", @@ -117,6 +117,6 @@ exports[`init initializes workspace: workspace - result 1`] = ` } `; -exports[`init initializes workspace: workspace - transformResults 1`] = `[]`; +exports[`cmds:init initializes workspace: workspace - transformResults 1`] = `[]`; -exports[`init initializes workspace: workspace - writeResults 1`] = `[]`; +exports[`cmds:init initializes workspace: workspace - writeResults 1`] = `[]`; diff --git a/packages/cli/__tests__/__snapshots__/plans.test.ts.snap b/packages/cli/__tests__/__snapshots__/package.test.ts.snap similarity index 54% rename from packages/cli/__tests__/__snapshots__/plans.test.ts.snap rename to packages/cli/__tests__/__snapshots__/package.test.ts.snap index a2d1358f26..5b9f84999c 100644 --- a/packages/cli/__tests__/__snapshots__/plans.test.ts.snap +++ b/packages/cli/__tests__/__snapshots__/package.test.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`extension updates module with \`extension\` and \`package\` commands in copied fixture workspace: extension-update - files 1`] = ` +exports[`cmds:package updates module with \`extension\` and \`package\` commands in copied fixture workspace: extension-update - files 1`] = ` [ "deploy/procedures/secretfunction.sql", "Makefile", @@ -14,14 +14,14 @@ exports[`extension updates module with \`extension\` and \`package\` commands in ] `; -exports[`extension updates module with \`extension\` and \`package\` commands in copied fixture workspace: extension-update - sql 1`] = ` +exports[`cmds:package updates module with \`extension\` and \`package\` commands in copied fixture workspace: extension-update - sql 1`] = ` "\\echo Use "CREATE EXTENSION secrets" to load this file. \\quit CREATE FUNCTION secretfunction ( ) RETURNS text AS $EOFCODE$ select * from generate_secret(); $EOFCODE$ LANGUAGE sql STABLE;" `; -exports[`extension updates module with \`extension\` and \`package\` commands in copied fixture workspace: initial - control file 1`] = ` +exports[`cmds:package updates module with \`extension\` and \`package\` commands in copied fixture workspace: initial - control file 1`] = ` "# secrets extension comment = 'skitch project' default_version = '0.0.1' @@ -32,7 +32,7 @@ superuser = false " `; -exports[`extension updates module with \`extension\` and \`package\` commands in copied fixture workspace: initial - module dependencies 1`] = ` +exports[`cmds:package updates module with \`extension\` and \`package\` commands in copied fixture workspace: initial - module dependencies 1`] = ` { "modules": [ "totp", @@ -45,7 +45,7 @@ exports[`extension updates module with \`extension\` and \`package\` commands in } `; -exports[`extension updates module with \`extension\` and \`package\` commands in copied fixture workspace: initial - required modules 1`] = ` +exports[`cmds:package updates module with \`extension\` and \`package\` commands in copied fixture workspace: initial - required modules 1`] = ` [ "plpgsql", "uuid-ossp", diff --git a/packages/cli/__tests__/extensions.test.ts b/packages/cli/__tests__/extensions.test.ts index ce9d13bc29..0243bebbbd 100644 --- a/packages/cli/__tests__/extensions.test.ts +++ b/packages/cli/__tests__/extensions.test.ts @@ -10,7 +10,7 @@ import { LaunchQLProject } from '@launchql/migrate'; const beforeEachSetup = setupTests(); -describe('extension', () => { +describe('cmds:extension', () => { let environment: TestEnvironment; let tempDir: string; diff --git a/packages/cli/__tests__/init.test.ts b/packages/cli/__tests__/init.test.ts index 27fe40f222..2f9326b562 100644 --- a/packages/cli/__tests__/init.test.ts +++ b/packages/cli/__tests__/init.test.ts @@ -10,7 +10,7 @@ import { LaunchQLProject } from '@launchql/migrate'; const beforeEachSetup = setupTests(); -describe('init', () => { +describe('cmds:init', () => { let environment: TestEnvironment; let tempDir: string; diff --git a/packages/cli/__tests__/plans.test.ts b/packages/cli/__tests__/package.test.ts similarity index 98% rename from packages/cli/__tests__/plans.test.ts rename to packages/cli/__tests__/package.test.ts index e44e223fa2..4824a579ec 100644 --- a/packages/cli/__tests__/plans.test.ts +++ b/packages/cli/__tests__/package.test.ts @@ -13,7 +13,7 @@ const fixture = (name: string) => const beforeEachSetup = setupTests(); -describe('extension', () => { +describe('cmds:package', () => { let environment: TestEnvironment; let tempDir: string;