build.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. name: CI
  2. on:
  3. push:
  4. branches: [master]
  5. paths-ignore:
  6. - '*.md'
  7. pull_request:
  8. branches: [master]
  9. paths-ignore:
  10. - '*.md'
  11. env:
  12. CLOJURE_VERSION: '1.11.1.1413'
  13. JAVA_VERSION: '11'
  14. # This is the latest node version we can run.
  15. NODE_VERSION: '22'
  16. BABASHKA_VERSION: '1.0.168'
  17. jobs:
  18. typos:
  19. name: Spell Check with Typos
  20. runs-on: ubuntu-22.04
  21. steps:
  22. - name: Checkout Actions Repository
  23. uses: actions/checkout@v4
  24. - name: Check spelling with custom config file
  25. uses: crate-ci/[email protected]
  26. with:
  27. config: ./typos.toml
  28. test:
  29. strategy:
  30. matrix:
  31. operating-system: [ubuntu-22.04]
  32. runs-on: ${{ matrix.operating-system }}
  33. steps:
  34. - name: Checkout
  35. uses: actions/checkout@v4
  36. - name: Set up Node
  37. uses: actions/setup-node@v4
  38. with:
  39. node-version: ${{ env.NODE_VERSION }}
  40. cache: 'yarn'
  41. cache-dependency-path: yarn.lock
  42. - name: Set up Java
  43. uses: actions/setup-java@v4
  44. with:
  45. distribution: 'zulu'
  46. java-version: ${{ env.JAVA_VERSION }}
  47. - name: Set up Clojure
  48. uses: DeLaGuardo/[email protected]
  49. with:
  50. cli: ${{ env.CLOJURE_VERSION }}
  51. - name: Clojure cache
  52. uses: actions/cache@v4
  53. id: clojure-deps
  54. with:
  55. path: |
  56. ~/.m2/repository
  57. ~/.gitlibs
  58. key: ${{ runner.os }}-clojure-deps-${{ hashFiles('deps.edn') }}
  59. restore-keys: ${{ runner.os }}-clojure-deps-
  60. - name: Fetch Clojure deps
  61. if: steps.clojure-deps.outputs.cache-hit != 'true'
  62. run: clojure -A:cljs -P
  63. - name: Fetch yarn deps
  64. run: yarn install --frozen-lockfile
  65. - name: Build test asset
  66. run: clojure -M:test compile test
  67. - name: Run some ClojureScript tests against DB version
  68. run: DB_GRAPH=1 node static/tests.js -r frontend.db.query-dsl-test
  69. - name: Run ClojureScript query tests against DB version with basic query type
  70. run: DB_GRAPH=1 DB_QUERY_TYPE=basic node static/tests.js -r frontend.db.query-dsl-test
  71. - name: Run ClojureScript tests
  72. run: node static/tests.js -e fix-me
  73. lint:
  74. runs-on: ubuntu-22.04
  75. steps:
  76. - name: Checkout
  77. uses: actions/checkout@v4
  78. - name: Set up Java
  79. uses: actions/setup-java@v4
  80. with:
  81. distribution: 'zulu'
  82. java-version: ${{ env.JAVA_VERSION }}
  83. - name: Set up Clojure
  84. uses: DeLaGuardo/[email protected]
  85. with:
  86. cli: ${{ env.CLOJURE_VERSION }}
  87. bb: ${{ env.BABASHKA_VERSION }}
  88. - name: Run clj-kondo lint
  89. run: clojure -M:clj-kondo --parallel --lint src
  90. - name: Carve lint for unused vars
  91. run: bb lint:carve
  92. - name: Lint for vars that are too large
  93. run: bb lint:large-vars
  94. - name: Lint for namespaces that aren't documented
  95. run: bb lint:ns-docstrings
  96. - name: Lint invalid translation entries
  97. run: bb lang:validate-translations
  98. - name: Lint to keep worker independent of frontend
  99. run: bb lint:worker-and-frontend-separate
  100. - name: Lint to keep db and file graph code separate
  101. run: bb lint:db-and-file-graphs-separate
  102. db-graph-test:
  103. strategy:
  104. matrix:
  105. operating-system: [ubuntu-latest]
  106. runs-on: ${{ matrix.operating-system }}
  107. steps:
  108. - name: Checkout
  109. uses: actions/checkout@v4
  110. - name: Set up Node
  111. uses: actions/setup-node@v4
  112. with:
  113. node-version: ${{ env.NODE_VERSION }}
  114. cache: 'yarn'
  115. cache-dependency-path: |
  116. deps/db/yarn.lock
  117. scripts/yarn.lock
  118. - name: Set up Java
  119. uses: actions/setup-java@v4
  120. with:
  121. distribution: 'zulu'
  122. java-version: ${{ env.JAVA_VERSION }}
  123. - name: Set up Clojure
  124. uses: DeLaGuardo/[email protected]
  125. with:
  126. cli: ${{ env.CLOJURE_VERSION }}
  127. bb: ${{ env.BABASHKA_VERSION }}
  128. - name: Fetch scripts yarn deps
  129. run: cd scripts && yarn install --frozen-lockfile
  130. - name: Create DB graph with properties
  131. run: cd scripts && yarn nbb-logseq src/logseq/tasks/db_graph/create_graph_with_properties.cljs ./properties-graph
  132. # TODO: Use a smaller, test-focused graph to test classes
  133. - name: Create DB graph with classes
  134. run: cd scripts && yarn nbb-logseq src/logseq/tasks/db_graph/create_graph_with_schema_org.cljs ./schema-graph
  135. - name: Fetch deps/db yarn deps
  136. run: cd deps/db && yarn install --frozen-lockfile
  137. # Can run from deps/db since all JS deps for this command are available in deps/db
  138. - name: Validate created DB graphs
  139. run: cd deps/db && yarn nbb-logseq -cp src:../cli/src -m logseq.cli validate -g ../../scripts/schema-graph
  140. - name: Export a created DB graph
  141. run: cd deps/db && yarn nbb-logseq -cp src:../cli/src -m logseq.cli export-edn -g ../../scripts/properties-graph -f properties.edn -T
  142. - name: Create graph from the export and diff the two graphs
  143. run: cd deps/db && yarn nbb-logseq -cp src:../outliner/src:script script/create_graph.cljs ./properties-graph2 properties.edn -iv && yarn nbb-logseq script/diff_graphs.cljs ../../scripts/properties-graph ./properties-graph2 -T