From 29a88decc2d5f11500786f706b30292dce126290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 29 May 2024 10:43:11 +0200 Subject: [PATCH 01/14] feat: npm workspaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- .mocharc.cjs | 15 ------- package-lock.json | 90 +++++++++++++++++++++++++------------- package.json | 48 ++------------------ spark-api/package.json | 38 ++++++++++++++++ spark-publish/package.json | 33 ++++++++++++++ 5 files changed, 134 insertions(+), 90 deletions(-) delete mode 100644 .mocharc.cjs create mode 100644 spark-api/package.json create mode 100644 spark-publish/package.json diff --git a/.mocharc.cjs b/.mocharc.cjs deleted file mode 100644 index abd6d46f..00000000 --- a/.mocharc.cjs +++ /dev/null @@ -1,15 +0,0 @@ -const MODULES = [ - 'spark-api', - 'spark-publish' -] - -module.exports = { - spec: getSpec() -} - -// Workaround for https://github.com/mochajs/mocha/issues/4100 -function getSpec () { - const isTestFile = (/** @type {string} */arg) => arg.endsWith('.js') - if (process.argv.slice(2).some(isTestFile)) return [] - return MODULES.map(dir => `${dir}/test/**/*.js`) -} diff --git a/package-lock.json b/package-lock.json index c9bed8d1..24121711 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,41 +1,15 @@ { - "name": "@filecoin-station/spark-api", + "name": "api", "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@filecoin-station/spark-api", - "version": "0.0.0", "license": "MIT", - "dependencies": { - "@filecoin-station/spark-impact-evaluator": "^1.0.0", - "@glif/filecoin-address": "^3.0.5", - "@influxdata/influxdb-client": "^1.33.2", - "@ipld/car": "^5.3.0", - "@sentry/node": "^8.5.0", - "@ucanto/core": "^10.0.1", - "@ucanto/principal": "^9.0.1", - "@web3-storage/access": "^18.3.2", - "@web3-storage/w3up-client": "^13.1.1", - "compare-versions": "^6.1.0", - "ethers": "^6.12.1", - "http-assert": "^1.5.0", - "http-responders": "^2.0.2", - "multiformats": "^13.1.0", - "p-retry": "^6.2.0", - "p-timeout": "^6.1.2", - "pg": "^8.11.5", - "postgrator": "^7.2.0", - "raw-body": "^2.5.2" - }, - "devDependencies": { - "@flydotio/dockerfile": "^0.5.7", - "light-my-request": "^5.13.0", - "mocha": "^10.4.0", - "standard": "^17.1.0", - "varint": "^6.0.0" - } + "workspaces": [ + "spark-api", + "spark-publish" + ] }, "node_modules/@adraffy/ens-normalize": { "version": "1.10.0", @@ -98,6 +72,10 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@filecoin-station/spark-api": { + "resolved": "spark-api", + "link": true + }, "node_modules/@filecoin-station/spark-impact-evaluator": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@filecoin-station/spark-impact-evaluator/-/spark-impact-evaluator-1.0.0.tgz", @@ -5397,6 +5375,10 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/spark-publish": { + "resolved": "spark-publish", + "link": true + }, "node_modules/split2": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", @@ -6003,6 +5985,52 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "spark-api": { + "version": "0.0.0", + "license": "MIT", + "dependencies": { + "@filecoin-station/spark-impact-evaluator": "^1.0.0", + "@glif/filecoin-address": "^3.0.5", + "@sentry/node": "^8.5.0", + "compare-versions": "^6.1.0", + "ethers": "^6.12.1", + "http-assert": "^1.5.0", + "http-responders": "^2.0.2", + "multiformats": "^13.1.0", + "pg": "^8.11.5", + "postgrator": "^7.2.0", + "raw-body": "^2.5.2" + }, + "devDependencies": { + "light-my-request": "^5.13.0", + "mocha": "^10.4.0", + "standard": "^17.1.0", + "varint": "^6.0.0" + } + }, + "spark-publish": { + "dependencies": { + "@filecoin-station/spark-impact-evaluator": "^1.0.0", + "@glif/filecoin-address": "^3.0.5", + "@influxdata/influxdb-client": "^1.33.2", + "@ipld/car": "^5.3.0", + "@sentry/node": "^8.4.0", + "@ucanto/core": "^10.0.1", + "@ucanto/principal": "^9.0.1", + "@web3-storage/access": "^18.3.2", + "@web3-storage/w3up-client": "^13.1.1", + "ethers": "^6.12.1", + "p-retry": "^6.2.0", + "p-timeout": "^6.1.2", + "pg": "^8.11.5" + }, + "devDependencies": { + "@flydotio/dockerfile": "^0.5.7", + "mocha": "^10.4.0", + "multiformats": "^13.1.0", + "standard": "^17.1.0" + } } } } diff --git a/package.json b/package.json index da356646..5a147559 100644 --- a/package.json +++ b/package.json @@ -1,50 +1,10 @@ { - "name": "@filecoin-station/spark-api", "private": true, - "version": "0.0.0", "license": "MIT", "repository": "filecoin-station/spark-api", "type": "module", - "description": "API for SPARK", - "scripts": { - "migrate": "node bin/migrate.js", - "start:api": "node spark-api/bin/spark.js", - "start:publish": "node spark-publish/bin/spark-publish.js", - "test:api": "mocha spark-api/test/**/*.js", - "test:publish": "mocha spark-publish/test/**/*.js", - "test": "standard && mocha" - }, - "devDependencies": { - "@flydotio/dockerfile": "^0.5.7", - "light-my-request": "^5.13.0", - "mocha": "^10.4.0", - "standard": "^17.1.0", - "varint": "^6.0.0" - }, - "dependencies": { - "@filecoin-station/spark-impact-evaluator": "^1.0.0", - "@glif/filecoin-address": "^3.0.5", - "@influxdata/influxdb-client": "^1.33.2", - "@ipld/car": "^5.3.0", - "@sentry/node": "^8.5.0", - "@ucanto/core": "^10.0.1", - "@ucanto/principal": "^9.0.1", - "@web3-storage/access": "^18.3.2", - "@web3-storage/w3up-client": "^13.1.1", - "compare-versions": "^6.1.0", - "ethers": "^6.12.1", - "http-assert": "^1.5.0", - "http-responders": "^2.0.2", - "multiformats": "^13.1.0", - "p-retry": "^6.2.0", - "p-timeout": "^6.1.2", - "pg": "^8.11.5", - "postgrator": "^7.2.0", - "raw-body": "^2.5.2" - }, - "standard": { - "env": [ - "mocha" - ] - } + "workspaces": [ + "spark-api", + "spark-publish" + ] } diff --git a/spark-api/package.json b/spark-api/package.json new file mode 100644 index 00000000..d64dc3f1 --- /dev/null +++ b/spark-api/package.json @@ -0,0 +1,38 @@ +{ + "name": "@filecoin-station/spark-api", + "private": true, + "version": "0.0.0", + "license": "MIT", + "repository": "filecoin-station/spark-api", + "type": "module", + "description": "API for SPARK", + "scripts": { + "migrate": "node bin/migrate.js", + "start": "node bin/spark.js", + "test": "standard && mocha" + }, + "devDependencies": { + "light-my-request": "^5.13.0", + "mocha": "^10.4.0", + "standard": "^17.1.0", + "varint": "^6.0.0" + }, + "dependencies": { + "@filecoin-station/spark-impact-evaluator": "^1.0.0", + "@glif/filecoin-address": "^3.0.5", + "@sentry/node": "^8.5.0", + "compare-versions": "^6.1.0", + "ethers": "^6.12.1", + "http-assert": "^1.5.0", + "http-responders": "^2.0.2", + "multiformats": "^13.1.0", + "pg": "^8.11.5", + "postgrator": "^7.2.0", + "raw-body": "^2.5.2" + }, + "standard": { + "env": [ + "mocha" + ] + } +} diff --git a/spark-publish/package.json b/spark-publish/package.json new file mode 100644 index 00000000..eecf99c4 --- /dev/null +++ b/spark-publish/package.json @@ -0,0 +1,33 @@ +{ + "type": "module", + "scripts": { + "start": "node bin/spark-publish.js", + "test": "standard && mocha" + }, + "dependencies": { + "@filecoin-station/spark-impact-evaluator": "^1.0.0", + "@glif/filecoin-address": "^3.0.5", + "@influxdata/influxdb-client": "^1.33.2", + "@ipld/car": "^5.3.0", + "@sentry/node": "^8.4.0", + "@ucanto/core": "^10.0.1", + "@ucanto/principal": "^9.0.1", + "@web3-storage/access": "^18.3.2", + "@web3-storage/w3up-client": "^13.1.1", + "ethers": "^6.12.1", + "p-retry": "^6.2.0", + "p-timeout": "^6.1.2", + "pg": "^8.11.5" + }, + "devDependencies": { + "@flydotio/dockerfile": "^0.5.7", + "mocha": "^10.4.0", + "multiformats": "^13.1.0", + "standard": "^17.1.0" + }, + "standard": { + "env": [ + "mocha" + ] + } +} From 05c50ec3f9e43fd91a3eacb7b253fc202ff2a598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 29 May 2024 10:57:19 +0200 Subject: [PATCH 02/14] fix CI + move `standard` to monorepo root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- .github/workflows/ci.yml | 16 ++++++++++++++-- package-lock.json | 9 ++++++--- package.json | 16 +++++++++++++++- spark-api/package.json | 10 +--------- spark-publish/package.json | 11 ++--------- 5 files changed, 38 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c837bf8..ad622963 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,13 +25,14 @@ jobs: env: DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres GLIF_TOKEN: ${{ secrets.GLIF_TOKEN }} + NPM_CONFIG_WORKSPACE: spark-api steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 - run: npm ci - - run: npm run test:api + - run: npm test build-publish: runs-on: ubuntu-latest @@ -51,6 +52,7 @@ jobs: --health-retries 5 env: DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres + NPM_CONFIG_WORKSPACE: spark-api steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -58,7 +60,17 @@ jobs: node-version: 20 - run: npm ci - run: npm run migrate - - run: npm run test:publish + - run: npm test + + lint-all: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm ci + - run: npm run lint docker-build: runs-on: ubuntu-latest diff --git a/package-lock.json b/package-lock.json index 24121711..043135bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,11 @@ "workspaces": [ "spark-api", "spark-publish" - ] + ], + "devDependencies": { + "mocha": "^10.4.0", + "standard": "^17.1.0" + } }, "node_modules/@adraffy/ens-normalize": { "version": "1.10.0", @@ -5987,6 +5991,7 @@ } }, "spark-api": { + "name": "@filecoin-station/spark-api", "version": "0.0.0", "license": "MIT", "dependencies": { @@ -6004,8 +6009,6 @@ }, "devDependencies": { "light-my-request": "^5.13.0", - "mocha": "^10.4.0", - "standard": "^17.1.0", "varint": "^6.0.0" } }, diff --git a/package.json b/package.json index 5a147559..ac8f742d 100644 --- a/package.json +++ b/package.json @@ -6,5 +6,19 @@ "workspaces": [ "spark-api", "spark-publish" - ] + ], + "scripts": { + "migrate": "node bin/migrate.js", + "lint": "standard", + "test": "npm run lint && npm test --workspaces" + }, + "devDependencies": { + "mocha": "^10.4.0", + "standard": "^17.1.0" + }, + "standard": { + "env": [ + "mocha" + ] + } } diff --git a/spark-api/package.json b/spark-api/package.json index d64dc3f1..aca55741 100644 --- a/spark-api/package.json +++ b/spark-api/package.json @@ -7,14 +7,11 @@ "type": "module", "description": "API for SPARK", "scripts": { - "migrate": "node bin/migrate.js", "start": "node bin/spark.js", - "test": "standard && mocha" + "test": "mocha" }, "devDependencies": { "light-my-request": "^5.13.0", - "mocha": "^10.4.0", - "standard": "^17.1.0", "varint": "^6.0.0" }, "dependencies": { @@ -29,10 +26,5 @@ "pg": "^8.11.5", "postgrator": "^7.2.0", "raw-body": "^2.5.2" - }, - "standard": { - "env": [ - "mocha" - ] } } diff --git a/spark-publish/package.json b/spark-publish/package.json index eecf99c4..c68a3cb6 100644 --- a/spark-publish/package.json +++ b/spark-publish/package.json @@ -2,7 +2,7 @@ "type": "module", "scripts": { "start": "node bin/spark-publish.js", - "test": "standard && mocha" + "test": "mocha" }, "dependencies": { "@filecoin-station/spark-impact-evaluator": "^1.0.0", @@ -21,13 +21,6 @@ }, "devDependencies": { "@flydotio/dockerfile": "^0.5.7", - "mocha": "^10.4.0", - "multiformats": "^13.1.0", - "standard": "^17.1.0" - }, - "standard": { - "env": [ - "mocha" - ] + "multiformats": "^13.1.0" } } From de05fec634328a5632373faad2eff0e309402f3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 29 May 2024 10:58:35 +0200 Subject: [PATCH 03/14] monorepo package name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- package-lock.json | 7 +++---- package.json | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 043135bf..cafc09a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,10 +1,11 @@ { - "name": "api", + "name": "@filecoin-station/spark-api-monorepo", "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { + "name": "@filecoin-station/spark-api-monorepo", "license": "MIT", "workspaces": [ "spark-api", @@ -6030,9 +6031,7 @@ }, "devDependencies": { "@flydotio/dockerfile": "^0.5.7", - "mocha": "^10.4.0", - "multiformats": "^13.1.0", - "standard": "^17.1.0" + "multiformats": "^13.1.0" } } } diff --git a/package.json b/package.json index ac8f742d..baba6d7f 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,5 @@ { + "name": "@filecoin-station/spark-api-monorepo", "private": true, "license": "MIT", "repository": "filecoin-station/spark-api", From 6ccb7792026a3b840a595bc13451a9ee291d8e5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 29 May 2024 11:05:50 +0200 Subject: [PATCH 04/14] ci: run CI for all pull requests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad622963..f5b24e18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,6 @@ on: push: branches: [main] pull_request: - branches: [main] jobs: build-api: From d7fbab45f7cdd968669bdf4dc6946db710401813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 29 May 2024 11:11:31 +0200 Subject: [PATCH 05/14] move mocha to sub-packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- package-lock.json | 3 ++- package.json | 1 - spark-api/package.json | 1 + spark-publish/package.json | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index cafc09a8..1444bc4d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,6 @@ "spark-publish" ], "devDependencies": { - "mocha": "^10.4.0", "standard": "^17.1.0" } }, @@ -6010,6 +6009,7 @@ }, "devDependencies": { "light-my-request": "^5.13.0", + "mocha": "^10.4.0", "varint": "^6.0.0" } }, @@ -6031,6 +6031,7 @@ }, "devDependencies": { "@flydotio/dockerfile": "^0.5.7", + "mocha": "^10.4.0", "multiformats": "^13.1.0" } } diff --git a/package.json b/package.json index baba6d7f..22d85974 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,6 @@ "test": "npm run lint && npm test --workspaces" }, "devDependencies": { - "mocha": "^10.4.0", "standard": "^17.1.0" }, "standard": { diff --git a/spark-api/package.json b/spark-api/package.json index aca55741..425883a9 100644 --- a/spark-api/package.json +++ b/spark-api/package.json @@ -12,6 +12,7 @@ }, "devDependencies": { "light-my-request": "^5.13.0", + "mocha": "^10.4.0", "varint": "^6.0.0" }, "dependencies": { diff --git a/spark-publish/package.json b/spark-publish/package.json index c68a3cb6..6c1ad516 100644 --- a/spark-publish/package.json +++ b/spark-publish/package.json @@ -21,6 +21,7 @@ }, "devDependencies": { "@flydotio/dockerfile": "^0.5.7", + "mocha": "^10.4.0", "multiformats": "^13.1.0" } } From daa26500505d69998ac67522d8b53eaa72ab5065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 29 May 2024 15:43:50 +0200 Subject: [PATCH 06/14] add standard to child workspaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- package-lock.json | 4 +++- spark-api/package.json | 7 +++++++ spark-publish/package.json | 9 ++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1444bc4d..8011a860 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6010,6 +6010,7 @@ "devDependencies": { "light-my-request": "^5.13.0", "mocha": "^10.4.0", + "standard": "^17.1.0", "varint": "^6.0.0" } }, @@ -6032,7 +6033,8 @@ "devDependencies": { "@flydotio/dockerfile": "^0.5.7", "mocha": "^10.4.0", - "multiformats": "^13.1.0" + "multiformats": "^13.1.0", + "standard": "^17.1.0" } } } diff --git a/spark-api/package.json b/spark-api/package.json index 425883a9..2dea8d6f 100644 --- a/spark-api/package.json +++ b/spark-api/package.json @@ -8,11 +8,13 @@ "description": "API for SPARK", "scripts": { "start": "node bin/spark.js", + "lint": "standard", "test": "mocha" }, "devDependencies": { "light-my-request": "^5.13.0", "mocha": "^10.4.0", + "standard": "^17.1.0", "varint": "^6.0.0" }, "dependencies": { @@ -27,5 +29,10 @@ "pg": "^8.11.5", "postgrator": "^7.2.0", "raw-body": "^2.5.2" + }, + "standard": { + "env": [ + "mocha" + ] } } diff --git a/spark-publish/package.json b/spark-publish/package.json index 6c1ad516..d955d972 100644 --- a/spark-publish/package.json +++ b/spark-publish/package.json @@ -2,6 +2,7 @@ "type": "module", "scripts": { "start": "node bin/spark-publish.js", + "lint": "standard", "test": "mocha" }, "dependencies": { @@ -22,6 +23,12 @@ "devDependencies": { "@flydotio/dockerfile": "^0.5.7", "mocha": "^10.4.0", - "multiformats": "^13.1.0" + "multiformats": "^13.1.0", + "standard": "^17.1.0" + }, + "standard": { + "env": [ + "mocha" + ] } } From 30fe8d522b0f663af21a5d647f3bbd9d7ac1476e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 29 May 2024 15:45:01 +0200 Subject: [PATCH 07/14] fix CI step to migrate the DB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5b24e18..a03309a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: with: node-version: 20 - run: npm ci - - run: npm run migrate + - run: node bin/migrate.js - run: npm test lint-all: From aa45167034208c85f606490c3f0d4c54fed13e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 29 May 2024 16:08:03 +0200 Subject: [PATCH 08/14] Rework Dockerfile to use `npm start --workspace` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- Dockerfile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7d183596..23b8e624 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,13 @@ RUN apt-get update -qq && \ # to install all modules: "npm install --production=false". # Ref: https://docs.npmjs.com/cli/v9/commands/npm-install#description COPY --link package-lock.json package.json ./ -RUN npm ci + +# We cannot use a wildcard until `COPY --parents` is stabilised +# See https://docs.docker.com/reference/dockerfile/#copy---parents +COPY --link spark-api/package.json ./spark-api/ +COPY --link spark-publish/package.json ./spark-publish/ + +RUN npm ci --workspaces # Copy application code COPY --link . . @@ -44,6 +50,6 @@ ARG SERVICE # ARGs are not preserved at runtime, we need to store the value # as a default value of an ENV var -ENV SCRIPT="start:${SERVICE}" +ENV WORKSPACE="spark-${SERVICE}" -CMD npm run ${SCRIPT} +CMD npm start --workspace ${WORKSPACE} From 09be6acd785b11320c8a35231b72aa3450fd0616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 29 May 2024 16:08:58 +0200 Subject: [PATCH 09/14] ci: fix build-publish MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a03309a9..60a0f3e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,6 +51,7 @@ jobs: --health-retries 5 env: DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres + GLIF_TOKEN: ${{ secrets.GLIF_TOKEN }} NPM_CONFIG_WORKSPACE: spark-api steps: - uses: actions/checkout@v4 From 02f909ea9b624692b505fc2f6c111086e4225271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 29 May 2024 16:16:34 +0200 Subject: [PATCH 10/14] fix dependabot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- .github/dependabot.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 4f6c5d92..5138039b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,6 +8,7 @@ updates: interval: "daily" time: "09:00" timezone: "Europe/Berlin" + versioning-strategy: increase commit-message: prefix: "deps" prefix-development: "deps(dev)" From 9760a4e94a5e2b61473fdffc90f20f9b3e0260a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 29 May 2024 16:30:08 +0200 Subject: [PATCH 11/14] another fix for Dependabot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- .github/dependabot.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5138039b..36f5e7ae 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,7 +3,6 @@ updates: - package-ecosystem: "npm" directories: - "/" - - "/spark-publish" schedule: interval: "daily" time: "09:00" From 98333c73e51f6a0443ea5da8d1bed07e9e2ea8fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 29 May 2024 16:32:06 +0200 Subject: [PATCH 12/14] fix build-publish to test publish, not api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60a0f3e1..f310530f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,8 +51,7 @@ jobs: --health-retries 5 env: DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres - GLIF_TOKEN: ${{ secrets.GLIF_TOKEN }} - NPM_CONFIG_WORKSPACE: spark-api + NPM_CONFIG_WORKSPACE: spark-publish steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 From dadc4113dcdb25b0baed223e65a60f074a1e1f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 29 May 2024 16:37:08 +0200 Subject: [PATCH 13/14] add postgrator to spark-publish dev-dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- spark-publish/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/spark-publish/package.json b/spark-publish/package.json index d955d972..7a52297a 100644 --- a/spark-publish/package.json +++ b/spark-publish/package.json @@ -24,6 +24,7 @@ "@flydotio/dockerfile": "^0.5.7", "mocha": "^10.4.0", "multiformats": "^13.1.0", + "postgrator": "^7.2.0", "standard": "^17.1.0" }, "standard": { From 8193fed4916f08d4781033e0e2a071088c6d0e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 29 May 2024 16:55:58 +0200 Subject: [PATCH 14/14] minor fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- .github/workflows/ci.yml | 4 ++-- README.md | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f310530f..10eb50cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,7 +105,7 @@ jobs: deploy-api: if: github.ref == 'refs/heads/main' - needs: [build-api, build-publish, docker-build, docker-build] + needs: [build-api, build-publish, docker-build] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -134,7 +134,7 @@ jobs: SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} deploy-publish: if: github.ref == 'refs/heads/main' - needs: [build-api, build-publish, docker-build, docker-build] + needs: [build-api, build-publish, docker-build] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/README.md b/README.md index 00e45fc8..7018f91e 100644 --- a/README.md +++ b/README.md @@ -89,13 +89,14 @@ docker run -d --name spark-db \ Start the API service: ```bash -npm run start:api +npm start --workspace spark-api ``` Run tests and linters: ```bash -npm run test:api +npm test --workspace spark-api +npm run lint --workspace spark-api ``` ## Deployment