浏览代码

feat: divide test suites on a higher level

Karol Sójko 1 年之前
父节点
当前提交
2ccaf490df
共有 4 个文件被更改,包括 43 次插入13 次删除
  1. 8 6
      .github/workflows/common-e2e.yml
  2. 6 1
      .github/workflows/e2e-test-suite.yml
  3. 13 2
      .github/workflows/pr.yml
  4. 16 4
      .github/workflows/publish.yml

+ 8 - 6
.github/workflows/common-e2e.yml

@@ -7,6 +7,10 @@ on:
         type: string
         default: latest
         description: The Docker image tag used for SNJS container
+      suite:
+        type: string
+        default: all
+        description: The test suite to run
     secrets:
       DOCKER_USERNAME:
         required: true
@@ -23,7 +27,6 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        suite: ['base', 'vaults']
         secondary_db_enabled: [true, false]
     runs-on: ubuntu-latest
 
@@ -56,13 +59,13 @@ jobs:
       run: docker/is-available.sh http://localhost:3123 $(pwd)/logs
 
     - name: Run E2E Test Suite
-      run: yarn dlx mocha-headless-chrome --timeout 3600000 -f http://localhost:9001/mocha/test.html?suite=${{ matrix.suite }}
+      run: yarn dlx mocha-headless-chrome --timeout 3600000 -f http://localhost:9001/mocha/test.html?suite=${{ inputs.suite }}
 
     - name: Archive failed run logs
       if: ${{ failure() }}
       uses: actions/upload-artifact@v3
       with:
-        name: self-hosted-failure-logs-${{ matrix.suite }}-${{ matrix.secondary_db_enabled }}
+        name: self-hosted-failure-logs-${{ inputs.suite }}-${{ matrix.secondary_db_enabled }}
         retention-days: 5
         path: |
           logs/*.err
@@ -73,7 +76,6 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        suite: ['base', 'vaults']
         db_type: [mysql, sqlite]
         cache_type: [redis, memory]
         secondary_db_enabled: [true, false]
@@ -163,13 +165,13 @@ jobs:
       run: for i in {1..30}; do curl -s http://localhost:3123/healthcheck && break || sleep 1; done
 
     - name: Run E2E Test Suite
-      run: yarn dlx mocha-headless-chrome --timeout 3600000 -f http://localhost:9001/mocha/test.html?suite=${{ matrix.suite }}
+      run: yarn dlx mocha-headless-chrome --timeout 3600000 -f http://localhost:9001/mocha/test.html?suite=${{ inputs.suite }}
 
     - name: Archive failed run logs
       if: ${{ failure() }}
       uses: actions/upload-artifact@v3
       with:
-        name: home-server-failure-logs-${{ matrix.suite }}-${{ matrix.db_type }}-${{ matrix.cache_type }}-${{ matrix.secondary_db_enabled }}
+        name: home-server-failure-logs-${{ inputs.suite }}-${{ matrix.db_type }}-${{ matrix.cache_type }}-${{ matrix.secondary_db_enabled }}
         retention-days: 5
         path: |
           logs/output.log

+ 6 - 1
.github/workflows/e2e-test-suite.yml

@@ -1,4 +1,4 @@
-name: E2E Test Suite On Self Hosted Server
+name: E2E Test Suite
 
 run-name: E2E Test Suite against ${{ inputs.ref_name }} by ${{ inputs.author }}
 
@@ -11,6 +11,10 @@ on:
         type: string
         default: latest
         description: The Docker image tag used for SNJS container
+      suite:
+        type: string
+        default: all
+        description: The test suite to run
       author:
         type: string
         default: unknown
@@ -26,4 +30,5 @@ jobs:
     uses: standardnotes/server/.github/workflows/common-e2e.yml@main
     with:
       snjs_image_tag: ${{ inputs.snjs_image_tag || 'latest' }}
+      suite: ${{ inputs.suite || 'all' }}
     secrets: inherit

+ 13 - 2
.github/workflows/pr.yml

@@ -95,9 +95,20 @@ jobs:
     - name: Test
       run: yarn test
 
-  e2e:
+  e2e-base:
     needs: build
+    name: E2E Base Suite
+    uses: standardnotes/server/.github/workflows/common-e2e.yml@main
+    with:
+      snjs_image_tag: 'latest'
+      suite: 'base'
+    secrets: inherit
 
-    name: E2E
+  e2e-vaults:
+    needs: build
+    name: E2E Vaults Suite
     uses: standardnotes/server/.github/workflows/common-e2e.yml@main
+    with:
+      snjs_image_tag: 'latest'
+      suite: 'vaults'
     secrets: inherit

+ 16 - 4
.github/workflows/publish.yml

@@ -95,20 +95,32 @@ jobs:
     - name: Test
       run: yarn test
 
-  e2e:
+  e2e-base:
     needs: build
-    name: E2E
+    name: E2E Base Suite
     uses: standardnotes/server/.github/workflows/common-e2e.yml@main
+    with:
+      snjs_image_tag: 'latest'
+      suite: 'base'
+    secrets: inherit
+
+  e2e-vaults:
+    needs: build
+    name: E2E Vaults Suite
+    uses: standardnotes/server/.github/workflows/common-e2e.yml@main
+    with:
+      snjs_image_tag: 'latest'
+      suite: 'vaults'
     secrets: inherit
 
   publish-self-hosting:
-    needs: [ test, lint, e2e ]
+    needs: [ test, lint, e2e-base, e2e-vaults ]
     name: Publish Self Hosting Docker Image
     uses: standardnotes/server/.github/workflows/common-self-hosting.yml@main
     secrets: inherit
 
   publish-services:
-    needs: [ test, lint, e2e ]
+    needs: [ test, lint, e2e-base, e2e-vaults ]
 
     runs-on: ubuntu-latest