1
0

build.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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@v3
  28. - name: Set up Node
  29. uses: actions/setup-node@v3
  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@v3
  38. with:
  39. distribution: 'zulu'
  40. java-version: ${{ env.JAVA_VERSION }}
  41. - name: Set up Clojure
  42. uses: DeLaGuardo/[email protected]
  43. with:
  44. cli: ${{ env.CLOJURE_VERSION }}
  45. - name: Clojure cache
  46. uses: actions/cache@v3
  47. id: clojure-deps
  48. with:
  49. path: |
  50. ~/.m2/repository
  51. ~/.gitlibs
  52. key: ${{ runner.os }}-clojure-deps-${{ hashFiles('deps.edn') }}
  53. restore-keys: ${{ runner.os }}-clojure-deps-
  54. - name: Fetch Clojure deps
  55. if: steps.clojure-deps.outputs.cache-hit != 'true'
  56. run: clojure -A:cljs -P
  57. - name: Fetch yarn deps
  58. run: yarn install --frozen-lockfile
  59. - name: Run ClojureScript tests
  60. run: |
  61. yarn cljs:test
  62. node static/tests.js
  63. lint:
  64. runs-on: ubuntu-latest
  65. steps:
  66. - name: Checkout
  67. uses: actions/checkout@v3
  68. - name: Set up Java
  69. uses: actions/setup-java@v3
  70. with:
  71. distribution: 'zulu'
  72. java-version: ${{ env.JAVA_VERSION }}
  73. - name: Set up Clojure
  74. uses: DeLaGuardo/[email protected]
  75. with:
  76. cli: ${{ env.CLOJURE_VERSION }}
  77. bb: ${{ env.BABASHKA_VERSION }}
  78. - name: Run clj-kondo lint
  79. run: clojure -M:clj-kondo --parallel --lint src
  80. - name: Carve lint for unused vars
  81. run: bb lint:carve 2>/dev/null
  82. - name: Lint for vars that are too large
  83. run: bb lint:large-vars 2>/dev/null
  84. - name: Lint for namespaces that aren't documented
  85. run: bb lint:ns-docstrings 2>/dev/null
  86. - name: Lint invalid translation entries
  87. run: bb lang:invalid-translations
  88. e2e-test:
  89. runs-on: ubuntu-latest
  90. steps:
  91. - name: Checkout
  92. uses: actions/checkout@v3
  93. - name: Set up Node
  94. uses: actions/setup-node@v3
  95. with:
  96. node-version: ${{ env.NODE_VERSION }}
  97. cache: 'yarn'
  98. cache-dependency-path: |
  99. yarn.lock
  100. static/yarn.lock
  101. - name: Set up Java
  102. uses: actions/setup-java@v3
  103. with:
  104. distribution: 'zulu'
  105. java-version: ${{ env.JAVA_VERSION }}
  106. - name: Set up Clojure
  107. uses: DeLaGuardo/[email protected]
  108. with:
  109. cli: ${{ env.CLOJURE_VERSION }}
  110. - name: Clojure cache
  111. uses: actions/cache@v2
  112. id: clojure-deps
  113. with:
  114. path: |
  115. ~/.m2/repository
  116. ~/.gitlibs
  117. key: ${{ runner.os }}-clojure-deps-${{ hashFiles('deps.edn') }}
  118. restore-keys: ${{ runner.os }}-clojure-deps-
  119. - name: Fetch Clojure deps
  120. if: steps.clojure-deps.outputs.cache-hit != 'true'
  121. run: clojure -A:cljs -P
  122. - name: Shadow-cljs cache
  123. uses: actions/cache@v3
  124. with:
  125. path: .shadow-cljs
  126. # ensure update cache every time
  127. key: ${{ runner.os }}-shadow-cljs-${{ github.sha }}
  128. # will match most recent upload
  129. restore-keys: |
  130. ${{ runner.os }}-shadow-cljs-
  131. - name: Fetch yarn deps
  132. run: yarn install
  133. env:
  134. PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
  135. # NOTE: require the app to be build in debug mode(compile instead of build).
  136. - name: Prepare E2E test build
  137. run: |
  138. yarn gulp:build && clojure -M:cljs compile app publishing electron
  139. (cd static && yarn install && yarn rebuild:better-sqlite3)
  140. # Exits with 0 if yarn.lock is up to date or 1 if we forgot to update it
  141. - name: Ensure static yarn.lock is up to date
  142. run: git diff --exit-code static/yarn.lock
  143. - name: Run Playwright test - 1/2
  144. run: xvfb-run -- npx playwright test --reporter github --shard=1/2
  145. env:
  146. LOGSEQ_CI: true
  147. DEBUG: "pw:api"
  148. RELEASE: true # skip dev only test
  149. - name: Run Playwright test - 2/2
  150. run: xvfb-run -- npx playwright test --reporter github --shard=2/2
  151. env:
  152. LOGSEQ_CI: true
  153. DEBUG: "pw:api"
  154. RELEASE: true # skip dev only test
  155. - name: Save test artifacts
  156. if: ${{ failure() }}
  157. uses: actions/upload-artifact@v3
  158. with:
  159. name: e2e-test-report
  160. path: e2e-dump/*