From c482a6ab15f4cd352ed24761ee60ffc761e707cf Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 5 Apr 2023 14:48:57 +0100 Subject: [PATCH] Tidy up merge queue automation (#3252) * Tidy up merge queue automation * Iterate * Iterate * Iterate --- .github/workflows/tests.yml | 39 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4e8a6441a..3c230af41 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,6 +8,8 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +env: + ENABLE_COVERAGE: ${{ github.event_name != 'merge_group' }} jobs: jest: name: "Jest [${{ matrix.specs }}] (Node ${{ matrix.node }})" @@ -46,7 +48,8 @@ jobs: - name: Run tests run: | - yarn ${{ github.event_name == 'merge_group' && 'test' || 'coverage' }} \ + yarn test \ + --coverage=${{ env.ENABLE_COVERAGE }} \ --ci \ --reporters github-actions ${{ steps.metrics.outputs.extra-reporter }} \ --max-workers ${{ steps.cpu-cores.outputs.count }} \ @@ -55,11 +58,11 @@ jobs: JEST_SONAR_UNIQUE_OUTPUT_NAME: true - name: Move coverage files into place - if: github.event_name != 'merge_group' + if: env.ENABLE_COVERAGE == 'true' run: mv coverage/lcov.info coverage/${{ matrix.node }}-${{ matrix.specs }}.lcov.info - name: Upload Artifact - if: github.event_name != 'merge_group' + if: env.ENABLE_COVERAGE == 'true' uses: actions/upload-artifact@v3 with: name: coverage @@ -67,22 +70,6 @@ jobs: coverage !coverage/lcov-report - skip_sonar: - name: Skip SonarCloud on merge_queue - if: github.event_name == 'merge_group' - runs-on: ubuntu-latest - needs: jest - steps: - - name: Skip SonarCloud - uses: Sibz/github-status-action@faaa4d96fecf273bd762985e0e7f9f933c774918 # v1 - with: - authToken: ${{ secrets.GITHUB_TOKEN }} - state: success - description: SonarCloud skipped - context: SonarCloud Code Analysis - sha: ${{ github.sha }} - target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - matrix-react-sdk: name: Downstream test matrix-react-sdk if: github.event_name == 'merge_group' @@ -91,7 +78,8 @@ jobs: disable_coverage: true matrix-js-sdk-sha: ${{ github.sha }} - # Hook for branch protection to work outside merge queues + # Hook for branch protection to skip downstream testing outside of merge queues + # and skip sonarcloud coverage within merge queues downstream: name: Downstream tests runs-on: ubuntu-latest @@ -99,5 +87,16 @@ jobs: needs: - matrix-react-sdk steps: + - name: Skip SonarCloud on merge queues + if: env.ENABLE_COVERAGE == 'false' + uses: Sibz/github-status-action@faaa4d96fecf273bd762985e0e7f9f933c774918 # v1 + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + state: success + description: SonarCloud skipped + context: SonarCloud Code Analysis + sha: ${{ github.sha }} + target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + - if: needs.matrix-react-sdk.result != 'skipped' && needs.matrix-react-sdk.result != 'success' run: exit 1