Finish up logseq.graph-parser

- Parser now parses all graph files like the app does, not just pages and journals.
  This required extracting another fn from repo-handler
- Add and tweak CI steps that are specific to graph-parser. All
  namespaces in this library are checked for nbb compatibility
- Cleaned up parser cli API so only one fn is needed for scripts
- Tests were updated to match new parsing behavior
- large_vars.clj can run with a smaller max-line-count after only refactoring two fns
- Add docs
This commit is contained in:
Gabriel Horner
2022-05-26 22:22:34 -04:00
parent 1e299052ce
commit b142327491
30 changed files with 338 additions and 217 deletions

View File

@@ -1,6 +1,7 @@
name: logseq graph-parser CI
on:
# Path filters ensure jobs only kick off if a change is made to graph-parser
push:
branches: [master]
paths:
@@ -47,10 +48,10 @@ jobs:
with:
cli: ${{ env.CLOJURE_VERSION }}
# - name: Setup Babashka
# uses: turtlequeue/setup-babashka@v1.3.0
# with:
# babashka-version: ${{ env.BABASHKA_VERSION }}
- name: Setup Babashka
uses: turtlequeue/setup-babashka@v1.3.0
with:
babashka-version: ${{ env.BABASHKA_VERSION }}
- name: Clojure cache
uses: actions/cache@v2
@@ -64,20 +65,20 @@ jobs:
- name: Fetch Clojure deps
if: steps.clojure-deps.outputs.cache-hit != 'true'
run: clojure -A:test -P
run: cd deps/graph-parser && clojure -A:test -P
- name: Fetch yarn deps
run: cd deps/graph-parser && yarn install --frozen-lockfile
- name: Run ClojureScript tests
run: clojure -M:test
run: cd deps/graph-parser && clojure -M:test
- name: Run nbb-logseq tests
run: cd deps/graph-parser && yarn nbb-logseq -cp src:test -m logseq.graph-parser.nbb-test-runner/run-tests
# # In this job because it depends on an npm package
# - name: Load nbb compatible namespaces
# run: bb test:load-nbb-compatible-namespaces
# In this job because it depends on an npm package
- name: Load namespaces into nbb-logseq
run: bb test:load-all-namespaces-with-nbb deps/graph-parser src
lint:
runs-on: ubuntu-latest
@@ -105,8 +106,8 @@ jobs:
- name: Run clj-kondo lint
run: cd deps/graph-parser && clojure -M:clj-kondo --parallel --lint src test
- name: Lint for vars that are too large
run: scripts/large_vars.clj deps/graph-parser/src
- name: Carve lint for unused vars
run: cd deps/graph-parser && ../../scripts/carve.clj
- name: Lint for vars that are too large
run: scripts/large_vars.clj deps/graph-parser/src '{:max-lines-count 75}'