Pārlūkot izejas kodu

Add CI job to test creating and validating a db graph

also update older actions
Gabriel Horner 2 gadi atpakaļ
vecāks
revīzija
8756600fd7

+ 48 - 4
.github/workflows/build.yml

@@ -23,7 +23,7 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - name: Checkout Actions Repository
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4
       - name: Check spelling with custom config file
         uses: crate-ci/[email protected]
         with:
@@ -38,7 +38,7 @@ jobs:
 
     steps:
       - name: Checkout
-        uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c  # v3.3.0
+        uses: actions/checkout@v4
 
       - name: Set up Node
         uses: actions/setup-node@v3
@@ -91,7 +91,7 @@ jobs:
 
     steps:
       - name: Checkout
-        uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c  #v3
+        uses: actions/checkout@v4
 
       - name: Set up Java
         uses: actions/setup-java@v3
@@ -120,12 +120,56 @@ jobs:
       - name: Lint invalid translation entries
         run: bb lang:validate-translations
 
+  db-graph-test:
+    strategy:
+      matrix:
+        operating-system: [ubuntu-latest]
+
+    runs-on: ${{ matrix.operating-system }}
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+
+      - name: Set up Node
+        uses: actions/setup-node@v3
+        with:
+          node-version: ${{ env.NODE_VERSION }}
+          cache: 'yarn'
+          cache-dependency-path: |
+            deps/db/yarn.lock
+            scripts/yarn.lock
+
+      - name: Set up Java
+        uses: actions/setup-java@v3
+        with:
+          distribution: 'zulu'
+          java-version: ${{ env.JAVA_VERSION }}
+
+      - name: Set up Clojure
+        uses: DeLaGuardo/[email protected]
+        with:
+          cli: ${{ env.CLOJURE_VERSION }}
+          bb: ${{ env.BABASHKA_VERSION }}
+
+      - name: Fetch scripts yarn deps
+        run: cd scripts && yarn install --frozen-lockfile
+
+      - name: Create DB graph with properties
+        run: cd scripts && yarn nbb-logseq src/logseq/tasks/db_graph/create_graph_with_properties.cljs ./db-graph-with-props
+
+      - name: Fetch deps/db yarn deps
+        run: cd deps/db && yarn install --frozen-lockfile
+
+      - name: Validate created DB graph
+        run: cd deps/db && yarn nbb-logseq script/validate_client_db.cljs ../../scripts/db-graph-with-props --closed-maps --group-errors
+
   e2e-test:
     runs-on: ubuntu-latest
 
     steps:
       - name: Checkout
-        uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
+        uses: actions/checkout@v4
 
       - name: Set up Node
         uses: actions/setup-node@v3

+ 2 - 1
deps/db/script/validate_client_db.cljs

@@ -1,5 +1,6 @@
 (ns validate-client-db
-  "Script that validates the datascript db of a DB graph"
+  "Script that validates the datascript db of a DB graph
+   NOTE: This script is also used in CI to confirm our db's schema is up to date"
   (:require [logseq.db.sqlite.cli :as sqlite-cli]
             [logseq.db.sqlite.db :as sqlite-db]
             [logseq.db.schema :as db-schema]

+ 2 - 1
scripts/src/logseq/tasks/db_graph/create_graph_with_properties.cljs

@@ -1,6 +1,7 @@
 (ns logseq.tasks.db-graph.create-graph-with-properties
   "Script that generates all the permutations of property types and cardinality.
-   Also creates a page of queries that exercises most properties"
+   Also creates a page of queries that exercises most properties
+   NOTE: This script is also used in CI to confirm graph creation works"
   (:require [logseq.tasks.db-graph.create-graph :as create-graph]
             [logseq.db.sqlite.util :as sqlite-util]
             [clojure.string :as string]