build.yml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. jobs:
  14. test:
  15. strategy:
  16. matrix:
  17. operating-system: [ubuntu-latest]
  18. runs-on: ${{ matrix.operating-system }}
  19. steps:
  20. - name: Checkout
  21. uses: actions/checkout@v2
  22. with:
  23. fetch-depth: 1
  24. submodules: 'true'
  25. - name: Clojure cache
  26. uses: actions/cache@v2
  27. id: clojure-deps
  28. with:
  29. path: |
  30. ~/.m2/repository
  31. ~/.gitlibs
  32. key: ${{ runner.os }}-clojure-deps-${{ hashFiles('deps.edn') }}
  33. restore-keys: ${{ runner.os }}-clojure-deps-
  34. - name: Prepare Java
  35. uses: actions/setup-java@v1
  36. with:
  37. java-version: 1.8
  38. - name: Set up Node
  39. uses: actions/setup-node@v2
  40. with:
  41. node-version: 16
  42. - name: Check Dockerfile consistency
  43. run: |
  44. DOCKER_VERSION=$(grep -Po 'FROM clojure:.*-deps-?\K(.*)' Dockerfile)
  45. [[ $CLOJURE_VERSION == $DOCKER_VERSION ]] || { echo "Please make sure Docker container version matches CLOJURE_VERSION" && exit 1; }
  46. - name: Install Clojure tools.deps
  47. uses: DeLaGuardo/setup-clojure@master
  48. with:
  49. cli: ${{ env.CLOJURE_VERSION }}
  50. - name: Fetch Clojure deps
  51. if: steps.clojure-deps.outputs.cache-hit != 'true'
  52. run: clojure -A:cljs -P
  53. - name: Get yarn cache directory path
  54. id: yarn-cache-dir-path
  55. run: echo "::set-output name=dir::$(yarn cache dir)"
  56. - name: yarn cache
  57. uses: actions/cache@v1
  58. id: yarn-cache
  59. with:
  60. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  61. key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
  62. restore-keys: |
  63. ${{ runner.os }}-yarn-
  64. - name: Fetch yarn deps
  65. run: yarn cache clean && yarn install
  66. - name: Run ClojureScript test
  67. run: |
  68. yarn cljs:test
  69. node static/tests.js
  70. - name: Run Playwright test
  71. if: github.event_name == 'pull_request'
  72. run: |
  73. yarn release
  74. (cd static && yarn install && yarn rebuild:better-sqlite3)
  75. xvfb-run -- yarn e2e-test
  76. env:
  77. DEBUG: "pw:test"
  78. - name: Save test artifacts
  79. if: ${{ github.event_name == 'pull_request' && failure() }}
  80. uses: actions/upload-artifact@v2
  81. with:
  82. name: e2e-test-report
  83. path: artifacts.zip