build.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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.10.1.727'
  13. # setup-java@v2 dropped support for legacy Java version syntax.
  14. # This is the same as 1.8.
  15. JAVA_VERSION: '8'
  16. # This is the latest node version we can run.
  17. NODE_VERSION: '16'
  18. BABASHKA_VERSION: '0.8.1'
  19. jobs:
  20. test:
  21. strategy:
  22. matrix:
  23. operating-system: [ubuntu-latest]
  24. runs-on: ${{ matrix.operating-system }}
  25. steps:
  26. - name: Checkout
  27. uses: actions/checkout@v2
  28. - name: Set up Node
  29. uses: actions/setup-node@v2
  30. with:
  31. node-version: ${{ env.NODE_VERSION }}
  32. cache: 'yarn'
  33. cache-dependency-path: |
  34. yarn.lock
  35. static/yarn.lock
  36. - name: Set up Java
  37. uses: actions/setup-java@v2
  38. with:
  39. distribution: 'zulu'
  40. java-version: ${{ env.JAVA_VERSION }}
  41. - name: Set up Clojure
  42. uses: DeLaGuardo/setup-clojure@master
  43. with:
  44. cli: ${{ env.CLOJURE_VERSION }}
  45. - name: Setup Babashka
  46. uses: turtlequeue/[email protected]
  47. with:
  48. babashka-version: ${{ env.BABASHKA_VERSION }}
  49. - name: Clojure cache
  50. uses: actions/cache@v2
  51. id: clojure-deps
  52. with:
  53. path: |
  54. ~/.m2/repository
  55. ~/.gitlibs
  56. key: ${{ runner.os }}-clojure-deps-${{ hashFiles('deps.edn') }}
  57. restore-keys: ${{ runner.os }}-clojure-deps-
  58. - name: Fetch Clojure deps
  59. if: steps.clojure-deps.outputs.cache-hit != 'true'
  60. run: clojure -A:cljs -P
  61. - name: Fetch yarn deps
  62. run: yarn install --frozen-lockfile
  63. - name: Run ClojureScript test
  64. run: |
  65. yarn cljs:test
  66. node static/tests.js
  67. # In this job because it depends on an npm package
  68. - name: Load nbb compatible namespaces
  69. run: bb test:load-nbb-compatible-namespaces
  70. lint:
  71. runs-on: ubuntu-latest
  72. steps:
  73. - name: Checkout
  74. uses: actions/checkout@v2
  75. - name: Set up Java
  76. uses: actions/setup-java@v2
  77. with:
  78. distribution: 'zulu'
  79. java-version: ${{ env.JAVA_VERSION }}
  80. - name: Set up Clojure
  81. uses: DeLaGuardo/setup-clojure@master
  82. with:
  83. cli: ${{ env.CLOJURE_VERSION }}
  84. - name: Setup Babashka
  85. uses: turtlequeue/[email protected]
  86. with:
  87. babashka-version: ${{ 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: scripts/carve.clj
  92. - name: Lint for vars that are too large
  93. run: scripts/large_vars.clj
  94. - name: Lint invalid translation entries
  95. run: bb lang:invalid-translations
  96. - name: Lint datalog rules
  97. run: scripts/lint_rules.clj
  98. e2e-test:
  99. runs-on: ubuntu-latest
  100. steps:
  101. - name: Checkout
  102. uses: actions/checkout@v2
  103. - name: Set up Node
  104. uses: actions/setup-node@v2
  105. with:
  106. node-version: ${{ env.NODE_VERSION }}
  107. cache: 'yarn'
  108. cache-dependency-path: |
  109. yarn.lock
  110. static/yarn.lock
  111. - name: Set up Java
  112. uses: actions/setup-java@v2
  113. with:
  114. distribution: 'zulu'
  115. java-version: ${{ env.JAVA_VERSION }}
  116. - name: Set up Clojure
  117. uses: DeLaGuardo/setup-clojure@master
  118. with:
  119. cli: ${{ env.CLOJURE_VERSION }}
  120. - name: Clojure cache
  121. uses: actions/cache@v2
  122. id: clojure-deps
  123. with:
  124. path: |
  125. ~/.m2/repository
  126. ~/.gitlibs
  127. key: ${{ runner.os }}-clojure-deps-${{ hashFiles('deps.edn') }}
  128. restore-keys: ${{ runner.os }}-clojure-deps-
  129. - name: Fetch Clojure deps
  130. if: steps.clojure-deps.outputs.cache-hit != 'true'
  131. run: clojure -A:cljs -P
  132. - name: Shadow-cljs cache
  133. uses: actions/cache@v2
  134. with:
  135. path: .shadow-cljs
  136. # ensure update cache every time
  137. key: ${{ runner.os }}-shadow-cljs-${{ github.sha }}
  138. # will match most recent upload
  139. restore-keys: |
  140. ${{ runner.os }}-shadow-cljs-
  141. - name: Fetch yarn deps
  142. run: yarn install
  143. env:
  144. PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
  145. # NOTE: require the app to be build in debug mode(compile instead of build).
  146. - name: Prepare E2E test build
  147. run: |
  148. yarn gulp:build && clojure -M:cljs compile app publishing electron
  149. (cd static && yarn install && yarn rebuild:better-sqlite3)
  150. # Exits with 0 if yarn.lock is up to date or 1 if we forgot to update it
  151. - name: Ensure static yarn.lock is up to date
  152. run: git diff --exit-code static/yarn.lock
  153. - name: Run Playwright test
  154. run: xvfb-run -- yarn e2e-test
  155. env:
  156. CI: true
  157. DEBUG: "pw:test"
  158. - name: Save test artifacts
  159. if: ${{ failure() }}
  160. uses: actions/upload-artifact@v2
  161. with:
  162. name: e2e-test-report
  163. path: artifacts.zip