Skip to content

Commit

Permalink
Tidy up merge queue automation (#3252)
Browse files Browse the repository at this point in the history
* Tidy up merge queue automation

* Iterate

* Iterate

* Iterate
  • Loading branch information
t3chguy authored Apr 5, 2023
1 parent 2daa429 commit c482a6a
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }})"
Expand Down Expand Up @@ -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 }} \
Expand All @@ -55,34 +58,18 @@ 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
path: |
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'
Expand All @@ -91,13 +78,25 @@ 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
if: always()
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

0 comments on commit c482a6a

Please sign in to comment.