Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit a09e105

Browse files
authored
Make workflows reusable for downstream testing (#10174)
1 parent d3771f8 commit a09e105

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

.github/workflows/tests.yml

+15
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ on:
55
branches: [develop, master]
66
repository_dispatch:
77
types: [upstream-sdk-notify]
8+
workflow_call:
9+
inputs:
10+
matrix-js-sdk-sha:
11+
type: string
12+
required: false
13+
description: "The matrix-js-sdk SHA to use"
814
env:
915
# These must be set for fetchdep.sh to get the right branch
1016
REPOSITORY: ${{ github.repository }}
@@ -16,6 +22,8 @@ jobs:
1622
steps:
1723
- name: Checkout code
1824
uses: actions/checkout@v3
25+
with:
26+
repository: ${{ inputs.matrix-js-sdk-sha && 'matrix-org/matrix-react-sdk' || github.repository }}
1927

2028
- name: Yarn cache
2129
uses: actions/setup-node@v3
@@ -24,6 +32,8 @@ jobs:
2432

2533
- name: Install Deps
2634
run: "./scripts/ci/install-deps.sh --ignore-scripts"
35+
env:
36+
JS_SDK_GITHUB_BASE_REF: ${{ inputs.matrix-js-sdk-sha }}
2737

2838
- name: Get number of CPU cores
2939
id: cpu-cores
@@ -38,6 +48,7 @@ jobs:
3848
run: "yarn coverage --ci --reporters github-actions --max-workers ${{ steps.cpu-cores.outputs.count }}"
3949

4050
- name: Upload Artifact
51+
if: inputs.matrix-js-sdk-sha == ''
4152
uses: actions/upload-artifact@v3
4253
with:
4354
name: coverage
@@ -50,10 +61,14 @@ jobs:
5061
runs-on: ubuntu-latest
5162
steps:
5263
- uses: actions/checkout@v3
64+
with:
65+
repository: ${{ inputs.matrix-js-sdk-sha && 'matrix-org/matrix-react-sdk' || github.repository }}
5366

5467
- uses: actions/setup-node@v3
5568
with:
5669
cache: "yarn"
5770

5871
- name: Run tests
5972
run: "./scripts/ci/app-tests.sh"
73+
env:
74+
JS_SDK_GITHUB_BASE_REF: ${{ inputs.matrix-js-sdk-sha }}

scripts/ci/install-deps.sh

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ set -ex
1111

1212
scripts/fetchdep.sh matrix-org matrix-js-sdk
1313
pushd matrix-js-sdk
14+
[ -n "$JS_SDK_GITHUB_BASE_REF" ] && git fetch --depth 1 origin $JS_SDK_GITHUB_BASE_REF && git checkout $JS_SDK_GITHUB_BASE_REF
1415
yarn link
1516
yarn install --pure-lockfile $@
1617
popd

scripts/ci/layered.sh

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ set -ex
1616
# Set up the js-sdk first
1717
scripts/fetchdep.sh matrix-org matrix-js-sdk
1818
pushd matrix-js-sdk
19+
[ -n "$JS_SDK_GITHUB_BASE_REF" ] && git fetch --depth 1 origin $JS_SDK_GITHUB_BASE_REF && git checkout $JS_SDK_GITHUB_BASE_REF
1920
yarn link
2021
yarn install --pure-lockfile
2122
popd

0 commit comments

Comments
 (0)