From 2ccaf490df2950517df3835b07d3ec2a5a826e46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20S=C3=B3jko?= Date: Mon, 2 Oct 2023 13:47:32 +0200 Subject: [PATCH] feat: divide test suites on a higher level --- .github/workflows/common-e2e.yml | 14 ++++++++------ .github/workflows/e2e-test-suite.yml | 7 ++++++- .github/workflows/pr.yml | 17 ++++++++++++++--- .github/workflows/publish.yml | 20 ++++++++++++++++---- 4 files changed, 44 insertions(+), 14 deletions(-) diff --git a/.github/workflows/common-e2e.yml b/.github/workflows/common-e2e.yml index bb6637e52..81f277296 100644 --- a/.github/workflows/common-e2e.yml +++ b/.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 diff --git a/.github/workflows/e2e-test-suite.yml b/.github/workflows/e2e-test-suite.yml index 60e2127cf..6172c2453 100644 --- a/.github/workflows/e2e-test-suite.yml +++ b/.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 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 0ada9c650..7e9c3ead5 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -95,9 +95,20 @@ 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 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 96c27abcc..9b217fdbf 100644 --- a/.github/workflows/publish.yml +++ b/.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