Skip to content

Commit 937f370

Browse files
authored
Run matrix-react-sdk tests on merge queue (#3161)
* First attempt at merge queues for downstream testing * Debug * delint * Fix typo * Test * Iterate * Fix checkout * rerun * experiment * Iterate * Iterate * iterate * Iterate * Finalise * Disable coverage for downstream tests * Update tests.yml * Apply merge_queue trigger to other CI * delint * delint * Add exception
1 parent a8ad3ed commit 937f370

File tree

4 files changed

+36
-15
lines changed

4 files changed

+36
-15
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ indent_size = 4
2323
trim_trailing_whitespace = true
2424

2525
[*.{yml,yaml}]
26-
indent_size = 2
26+
indent_size = 4

.github/workflows/pull_request.yaml

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@ name: Pull Request
22
on:
33
pull_request_target:
44
types: [opened, edited, labeled, unlabeled, synchronize]
5+
merge_group:
6+
types: [checks_requested]
57
workflow_call:
6-
inputs:
7-
labels:
8-
type: string
9-
default: "T-Defect,T-Deprecation,T-Enhancement,T-Task"
10-
required: false
11-
description: "No longer used, uses allchange logic now, will be removed at a later date"
128
secrets:
139
ELEMENT_BOT_TOKEN:
1410
required: true
@@ -19,6 +15,7 @@ jobs:
1915
runs-on: ubuntu-latest
2016
steps:
2117
- uses: matrix-org/allchange@main
18+
if: github.event_name != 'merge_group'
2219
with:
2320
ghToken: ${{ secrets.GITHUB_TOKEN }}
2421
requireLabel: true

.github/workflows/static_analysis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Static Analysis
22
on:
33
pull_request: {}
4+
merge_group:
5+
types: [checks_requested]
46
push:
57
branches: [develop, master]
68
concurrency:

.github/workflows/tests.yml

+30-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Tests
22
on:
33
pull_request: {}
4+
merge_group:
5+
types: [checks_requested]
46
push:
57
branches: [develop, master]
68
concurrency:
@@ -36,18 +38,19 @@ jobs:
3638
id: cpu-cores
3739
uses: SimenB/github-actions-cpu-cores@v1
3840

39-
- name: Run tests with coverage and metrics
41+
- name: Load metrics reporter
42+
id: metrics
4043
if: github.ref == 'refs/heads/develop'
4144
run: |
42-
yarn coverage --ci --reporters github-actions '--reporters=<rootDir>/spec/slowReporter.js' --max-workers ${{ steps.cpu-cores.outputs.count }} ./spec/${{ matrix.specs }}
43-
mv coverage/lcov.info coverage/${{ matrix.node }}-${{ matrix.specs }}.lcov.info
44-
env:
45-
JEST_SONAR_UNIQUE_OUTPUT_NAME: true
45+
echo "extra-reporter='--reporters=<rootDir>/spec/slowReporter.js'" >> $GITHUB_OUTPUT
4646
47-
- name: Run tests with coverage
48-
if: github.ref != 'refs/heads/develop'
47+
- name: Run tests
4948
run: |
50-
yarn coverage --ci --reporters github-actions --max-workers ${{ steps.cpu-cores.outputs.count }} ./spec/${{ matrix.specs }}
49+
yarn coverage \
50+
--ci \
51+
--reporters github-actions ${{ steps.metrics.outputs.extra-reporter }} \
52+
--max-workers ${{ steps.cpu-cores.outputs.count }} \
53+
./spec/${{ matrix.specs }}
5154
mv coverage/lcov.info coverage/${{ matrix.node }}-${{ matrix.specs }}.lcov.info
5255
env:
5356
JEST_SONAR_UNIQUE_OUTPUT_NAME: true
@@ -59,3 +62,22 @@ jobs:
5962
path: |
6063
coverage
6164
!coverage/lcov-report
65+
66+
matrix-react-sdk:
67+
name: Downstream test matrix-react-sdk
68+
if: github.event_name == 'merge_group'
69+
uses: matrix-org/matrix-react-sdk/.github/workflows/tests.yml@develop
70+
with:
71+
disable_coverage: true
72+
matrix-js-sdk-sha: ${{ github.sha }}
73+
74+
# Hook for branch protection to work outside merge queues
75+
downstream:
76+
name: Downstream tests
77+
runs-on: ubuntu-latest
78+
if: always()
79+
needs:
80+
- matrix-react-sdk
81+
steps:
82+
- if: needs.matrix-react-sdk.result != 'skipped' && needs.matrix-react-sdk.result != 'success'
83+
run: exit 1

0 commit comments

Comments
 (0)