build.yml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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.763'
  13. JAVA_VERSION: '11'
  14. # This is the latest node version we can run.
  15. NODE_VERSION: '18'
  16. BABASHKA_VERSION: '1.0.168'
  17. jobs:
  18. typos:
  19. name: Spell Check with Typos
  20. runs-on: ubuntu-latest
  21. steps:
  22. - name: Checkout Actions Repository
  23. uses: actions/checkout@v3
  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-latest]
  32. runs-on: ${{ matrix.operating-system }}
  33. steps:
  34. - name: Checkout
  35. uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
  36. - name: Set up Node
  37. uses: actions/setup-node@v3
  38. with:
  39. node-version: ${{ env.NODE_VERSION }}
  40. cache: 'yarn'
  41. cache-dependency-path: |
  42. yarn.lock
  43. static/yarn.lock
  44. - name: Set up Java
  45. uses: actions/setup-java@v3
  46. with:
  47. distribution: 'zulu'
  48. java-version: ${{ env.JAVA_VERSION }}
  49. - name: Set up Clojure
  50. uses: DeLaGuardo/[email protected]
  51. with:
  52. cli: ${{ env.CLOJURE_VERSION }}
  53. - name: Clojure cache
  54. uses: actions/cache@v3
  55. id: clojure-deps
  56. with:
  57. path: |
  58. ~/.m2/repository
  59. ~/.gitlibs
  60. key: ${{ runner.os }}-clojure-deps-${{ hashFiles('deps.edn') }}
  61. restore-keys: ${{ runner.os }}-clojure-deps-
  62. - name: Fetch Clojure deps
  63. if: steps.clojure-deps.outputs.cache-hit != 'true'
  64. run: clojure -A:cljs -P
  65. - name: Fetch yarn deps
  66. run: yarn install --frozen-lockfile
  67. - name: Run ClojureScript tests
  68. run: |
  69. yarn cljs:test
  70. node static/tests.js
  71. lint:
  72. runs-on: ubuntu-latest
  73. steps:
  74. - name: Checkout
  75. uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c #v3
  76. - name: Set up Java
  77. uses: actions/setup-java@v3
  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 2>/dev/null
  90. - name: Lint for vars that are too large
  91. run: bb lint:large-vars 2>/dev/null
  92. - name: Lint for namespaces that aren't documented
  93. run: bb lint:ns-docstrings 2>/dev/null
  94. - name: Lint invalid translation entries
  95. run: bb lang:validate-translations
  96. e2e-test:
  97. runs-on: ubuntu-latest
  98. steps:
  99. - name: Checkout
  100. uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
  101. - name: Set up Node
  102. uses: actions/setup-node@v3
  103. with:
  104. node-version: ${{ env.NODE_VERSION }}
  105. cache: 'yarn'
  106. cache-dependency-path: |
  107. yarn.lock
  108. static/yarn.lock
  109. - name: Set up Java
  110. uses: actions/setup-java@v3
  111. with:
  112. distribution: 'zulu'
  113. java-version: ${{ env.JAVA_VERSION }}
  114. - name: Set up Clojure
  115. uses: DeLaGuardo/[email protected]
  116. with:
  117. cli: ${{ env.CLOJURE_VERSION }}
  118. - name: Clojure cache
  119. uses: actions/cache@v3
  120. id: clojure-deps
  121. with:
  122. path: |
  123. ~/.m2/repository
  124. ~/.gitlibs
  125. key: ${{ runner.os }}-clojure-deps-${{ hashFiles('deps.edn') }}
  126. restore-keys: ${{ runner.os }}-clojure-deps-
  127. - name: Fetch Clojure deps
  128. if: steps.clojure-deps.outputs.cache-hit != 'true'
  129. run: clojure -A:cljs -P
  130. - name: Shadow-cljs cache
  131. uses: actions/cache@v3
  132. with:
  133. path: .shadow-cljs
  134. # ensure update cache every time
  135. key: ${{ runner.os }}-shadow-cljs-${{ github.sha }}
  136. # will match most recent upload
  137. restore-keys: |
  138. ${{ runner.os }}-shadow-cljs-
  139. - name: Fetch yarn deps
  140. run: yarn install
  141. env:
  142. PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
  143. # NOTE: require the app to be build in debug mode(compile instead of build).
  144. - name: Prepare E2E test build
  145. run: |
  146. yarn gulp:build && clojure -M:cljs compile app publishing electron
  147. (cd static && yarn install && yarn rebuild:all)
  148. # Exits with 0 if yarn.lock is up to date or 1 if we forgot to update it
  149. - name: Ensure static yarn.lock is up to date
  150. run: git diff --exit-code static/yarn.lock
  151. - name: Install fluxbox
  152. run: sudo apt-get update && sudo apt-get install -y fluxbox
  153. - name: Export display
  154. run: export DISPLAY=:99
  155. - name: Run Playwright test - 1/2
  156. run: Xvfb :99 -screen 0 1024x768x16 & fluxbox & npx playwright test --reporter github --shard=1/2
  157. env:
  158. LOGSEQ_CI: true
  159. DEBUG: "pw:api"
  160. RELEASE: true # skip dev only test
  161. - name: Run Playwright test - 2/2
  162. run: Xvfb :99 -screen 0 1024x768x16 & fluxbox & npx playwright test --reporter github --shard=2/2
  163. env:
  164. LOGSEQ_CI: true
  165. DEBUG: "pw:api"
  166. RELEASE: true # skip dev only test
  167. - name: Save test artifacts
  168. if: ${{ failure() }}
  169. uses: actions/upload-artifact@v3
  170. with:
  171. name: e2e-test-report
  172. path: e2e-dump/*
  173. retention-days: 1