e2e.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. name: E2E
  2. # Running E2E test multiple times to confirm test stability.
  3. # E2E test could be randomly failed due to the batch update mechanism of React.
  4. # Robust E2E test could help improving dev experience.
  5. on:
  6. push:
  7. branches: [master]
  8. paths:
  9. - 'e2e-tests/**'
  10. pull_request:
  11. branches: [master]
  12. paths:
  13. - 'e2e-tests/**'
  14. env:
  15. CLOJURE_VERSION: '1.10.1.727'
  16. # setup-java@v2 dropped support for legacy Java version syntax.
  17. # This is the same as 1.8.
  18. JAVA_VERSION: '8'
  19. # This is the latest node version we can run.
  20. NODE_VERSION: '16'
  21. BABASHKA_VERSION: '1.0.168'
  22. jobs:
  23. e2e-test-build:
  24. name: Build Test Artifact
  25. runs-on: ubuntu-latest
  26. steps:
  27. - name: Checkout
  28. uses: actions/checkout@v2
  29. - name: Set up Node
  30. uses: actions/setup-node@v2
  31. with:
  32. node-version: ${{ env.NODE_VERSION }}
  33. cache: 'yarn'
  34. cache-dependency-path: |
  35. yarn.lock
  36. static/yarn.lock
  37. - name: Set up Java
  38. uses: actions/setup-java@v2
  39. with:
  40. distribution: 'zulu'
  41. java-version: ${{ env.JAVA_VERSION }}
  42. - name: Set up Clojure
  43. uses: DeLaGuardo/setup-clojure@master
  44. with:
  45. cli: ${{ env.CLOJURE_VERSION }}
  46. - name: Clojure cache
  47. uses: actions/cache@v2
  48. id: clojure-deps
  49. with:
  50. path: |
  51. ~/.m2/repository
  52. ~/.gitlibs
  53. key: ${{ runner.os }}-clojure-deps-${{ hashFiles('deps.edn') }}
  54. restore-keys: ${{ runner.os }}-clojure-deps-
  55. - name: Fetch Clojure deps
  56. if: steps.clojure-deps.outputs.cache-hit != 'true'
  57. run: clojure -A:cljs -P
  58. - name: Shadow-cljs cache
  59. uses: actions/cache@v2
  60. with:
  61. path: .shadow-cljs
  62. # ensure update cache every time
  63. key: ${{ runner.os }}-shadow-cljs-${{ github.sha }}
  64. # will match most recent upload
  65. restore-keys: |
  66. ${{ runner.os }}-shadow-cljs-
  67. - name: Fetch yarn deps
  68. run: yarn install
  69. env:
  70. PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
  71. # NOTE: require the app to be build with DEV-RELEASE flag
  72. - name: Prepare E2E test build
  73. run: |
  74. yarn gulp:build && clojure -M:cljs release app electron --config-merge "{:closure-defines {frontend.config/DEV-RELEASE true}}" --debug
  75. # NOTE: should include .shadow-cljs if in dev mode(compile)
  76. - name: Create Archive for build
  77. run: tar czf static.tar.gz static
  78. - name: Upload Artifact
  79. uses: actions/upload-artifact@v3
  80. with:
  81. name: logseq-e2e-artifact
  82. path: static.tar.gz
  83. retention-days: 1
  84. e2e-test-run:
  85. needs: [ e2e-test-build ]
  86. name: Test Shard ${{ matrix.shard }} Repeat ${{ matrix.repeat }}
  87. runs-on: ubuntu-latest
  88. strategy:
  89. matrix:
  90. repeat: [1, 2]
  91. shard: [1, 2, 3]
  92. steps:
  93. - name: Repeat message
  94. run: echo ::info title=StartUp::E2E testing shard ${{ matrix.shard}}/3 repeat ${{ matrix.repeat }}
  95. - name: Checkout
  96. uses: actions/checkout@v2
  97. - name: Download test build artifact
  98. uses: actions/download-artifact@v3
  99. with:
  100. name: logseq-e2e-artifact
  101. - name: Extract test Artifact
  102. run: tar xzf static.tar.gz
  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: Fetch yarn deps for E2E test
  112. run: |
  113. yarn install
  114. (cd static && yarn install && yarn rebuild:all)
  115. env:
  116. PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
  117. - name: Ensure static yarn.lock is up to date
  118. run: git diff --exit-code static/yarn.lock
  119. - name: Run Playwright test
  120. run: xvfb-run -- npx playwright test --reporter github --shard=${{ matrix.shard }}/3
  121. env:
  122. LOGSEQ_CI: true
  123. DEBUG: "pw:api"
  124. RELEASE: true # skip dev only test
  125. - name: Save e2e artifacts
  126. if: ${{ failure() }}
  127. uses: actions/upload-artifact@v3
  128. with:
  129. name: e2e-repeat-report-${{ matrix.shard}}-${{ matrix.repeat }}
  130. path: e2e-dump/*
  131. retention-days: 1