build.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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 ClojureScript query tests against basic query type
  68. run: DB_QUERY_TYPE=basic node static/tests.js -r frontend.db.query-dsl-test
  69. - name: Run ClojureScript tests
  70. run: node static/tests.js -e fix-me
  71. lint:
  72. runs-on: ubuntu-22.04
  73. steps:
  74. - name: Checkout
  75. uses: actions/checkout@v4
  76. - name: Set up Java
  77. uses: actions/setup-java@v4
  78. with:
  79. distribution: 'zulu'
  80. java-version: ${{ env.JAVA_VERSION }}
  81. - name: Set up Clojure
  82. uses: DeLaGuardo/[email protected]
  83. with:
  84. cli: ${{ env.CLOJURE_VERSION }}
  85. bb: ${{ env.BABASHKA_VERSION }}
  86. - name: Run clj-kondo lint
  87. run: clojure -M:clj-kondo --parallel --lint src
  88. - name: Carve lint for unused vars
  89. run: bb lint:carve
  90. - name: Lint for vars that are too large
  91. run: bb lint:large-vars
  92. - name: Lint for namespaces that aren't documented
  93. run: bb lint:ns-docstrings
  94. - name: Lint invalid translation entries
  95. run: bb lang:validate-translations
  96. - name: Lint to keep worker independent of frontend
  97. run: bb lint:worker-and-frontend-separate
  98. - name: Lint to keep db and file graph code separate
  99. run: bb lint:db-and-file-graphs-separate
  100. db-graph-test:
  101. strategy:
  102. matrix:
  103. operating-system: [ubuntu-latest]
  104. runs-on: ${{ matrix.operating-system }}
  105. steps:
  106. - name: Checkout
  107. uses: actions/checkout@v4
  108. - name: Set up Node
  109. uses: actions/setup-node@v4
  110. with:
  111. node-version: ${{ env.NODE_VERSION }}
  112. cache: 'yarn'
  113. cache-dependency-path: |
  114. deps/db/yarn.lock
  115. scripts/yarn.lock
  116. - name: Set up Java
  117. uses: actions/setup-java@v4
  118. with:
  119. distribution: 'zulu'
  120. java-version: ${{ env.JAVA_VERSION }}
  121. - name: Set up Clojure
  122. uses: DeLaGuardo/[email protected]
  123. with:
  124. cli: ${{ env.CLOJURE_VERSION }}
  125. bb: ${{ env.BABASHKA_VERSION }}
  126. - name: Fetch scripts yarn deps
  127. run: cd scripts && yarn install --frozen-lockfile
  128. - name: Create DB graph with properties
  129. run: cd scripts && yarn nbb-logseq src/logseq/tasks/db_graph/create_graph_with_properties.cljs ./properties-graph
  130. # TODO: Use a smaller, test-focused graph to test classes
  131. - name: Create DB graph with classes
  132. run: cd scripts && yarn nbb-logseq src/logseq/tasks/db_graph/create_graph_with_schema_org.cljs ./schema-graph
  133. - name: Fetch deps/db yarn deps
  134. run: cd deps/db && yarn install --frozen-lockfile
  135. # Can run from deps/db since all JS deps for this command are available in deps/db
  136. - name: Validate created DB graphs
  137. run: cd deps/db && yarn nbb-logseq -cp src:../cli/src -m logseq.cli validate -g ../../scripts/properties-graph ../../scripts/schema-graph
  138. - name: Export a created DB graph
  139. run: cd deps/db && yarn nbb-logseq -cp src:../cli/src -m logseq.cli export-edn -g ../../scripts/properties-graph -f properties.edn -T
  140. - name: Create graph from the export and diff the two graphs
  141. 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