e2e.yml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. # TODO: Re-enable when ready to enable tests for file graphs
  11. # pull_request:
  12. # branches: [master]
  13. # paths:
  14. # - 'e2e-tests/**'
  15. env:
  16. CLOJURE_VERSION: '1.11.1.1413'
  17. JAVA_VERSION: '11'
  18. # This is the latest node version we can run.
  19. NODE_VERSION: '18'
  20. BABASHKA_VERSION: '1.0.168'
  21. jobs:
  22. e2e-test-build:
  23. name: Build Test Artifact
  24. runs-on: ubuntu-latest
  25. steps:
  26. - name: Checkout
  27. uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
  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: Shadow-cljs cache
  58. uses: actions/cache@v3
  59. with:
  60. path: .shadow-cljs
  61. # ensure update cache every time
  62. key: ${{ runner.os }}-shadow-cljs-${{ github.sha }}
  63. # will match most recent upload
  64. restore-keys: |
  65. ${{ runner.os }}-shadow-cljs-
  66. - name: Fetch yarn deps
  67. run: yarn install
  68. env:
  69. PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
  70. # NOTE: require the app to be build with DEV-RELEASE flag
  71. - name: Prepare E2E test build
  72. run: |
  73. yarn gulp:build && clojure -M:cljs release app electron --config-merge "{:closure-defines {frontend.config/DEV-RELEASE true}}" --debug
  74. # NOTE: should include .shadow-cljs if in dev mode(compile)
  75. - name: Create Archive for build
  76. run: tar czf static.tar.gz static
  77. - name: Upload Artifact
  78. uses: actions/upload-artifact@v3
  79. with:
  80. name: logseq-e2e-artifact
  81. path: static.tar.gz
  82. retention-days: 1
  83. e2e-test-run:
  84. needs: [ e2e-test-build ]
  85. name: Test Shard ${{ matrix.shard }} Repeat ${{ matrix.repeat }}
  86. runs-on: ubuntu-latest
  87. strategy:
  88. matrix:
  89. repeat: [1, 2]
  90. shard: [1, 2, 3]
  91. steps:
  92. - name: Repeat message
  93. run: echo ::info title=StartUp::E2E testing shard ${{ matrix.shard}}/3 repeat ${{ matrix.repeat }}
  94. - name: Checkout
  95. uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
  96. - name: Download test build artifact
  97. uses: actions/download-artifact@v3
  98. with:
  99. name: logseq-e2e-artifact
  100. - name: Extract test Artifact
  101. run: tar xzf static.tar.gz
  102. - name: Set up Node
  103. uses: actions/setup-node@v3
  104. with:
  105. node-version: ${{ env.NODE_VERSION }}
  106. cache: 'yarn'
  107. cache-dependency-path: |
  108. yarn.lock
  109. static/yarn.lock
  110. - name: Fetch yarn deps for E2E test
  111. run: |
  112. yarn install
  113. (cd static && yarn install && yarn rebuild:all)
  114. env:
  115. PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
  116. - name: Ensure static yarn.lock is up to date
  117. run: git diff --exit-code static/yarn.lock
  118. - name: Install Fluxbox
  119. run: sudo apt-get update && sudo apt-get install -y fluxbox
  120. # Emulate a virtual framebuffer on machines with no display hardware
  121. - name: Run XVFB
  122. run: Xvfb :1 -screen 0 1024x768x24 >/dev/null 2>&1 &
  123. # Start a lightweight window manager to simulate window actions (maximize,restore etc)
  124. - name: Start Fluxbox
  125. run: DISPLAY=:1.0 fluxbox >/dev/null 2>&1 &
  126. - name: Run Playwright test
  127. run: DISPLAY=:1.0 npx playwright test --reporter github --shard=${{ matrix.shard }}/3
  128. env:
  129. LOGSEQ_CI: true
  130. DEBUG: "pw:api"
  131. RELEASE: true # skip dev only test
  132. - name: Save e2e artifacts
  133. if: ${{ failure() }}
  134. uses: actions/upload-artifact@v3
  135. with:
  136. name: e2e-repeat-report-${{ matrix.shard}}-${{ matrix.repeat }}
  137. path: e2e-dump/*
  138. retention-days: 1