Make workflows reusable for downstream testing (#10174)

t3chguy/dedup-icons-17oct
Michael Telatynski 2023-02-20 11:41:36 +00:00 committed by GitHub
parent d3771f8a9f
commit a09e105c23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

View File

@ -5,6 +5,12 @@ on:
branches: [develop, master]
repository_dispatch:
types: [upstream-sdk-notify]
workflow_call:
inputs:
matrix-js-sdk-sha:
type: string
required: false
description: "The matrix-js-sdk SHA to use"
env:
# These must be set for fetchdep.sh to get the right branch
REPOSITORY: ${{ github.repository }}
@ -16,6 +22,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
repository: ${{ inputs.matrix-js-sdk-sha && 'matrix-org/matrix-react-sdk' || github.repository }}
- name: Yarn cache
uses: actions/setup-node@v3
@ -24,6 +32,8 @@ jobs:
- name: Install Deps
run: "./scripts/ci/install-deps.sh --ignore-scripts"
env:
JS_SDK_GITHUB_BASE_REF: ${{ inputs.matrix-js-sdk-sha }}
- name: Get number of CPU cores
id: cpu-cores
@ -38,6 +48,7 @@ jobs:
run: "yarn coverage --ci --reporters github-actions --max-workers ${{ steps.cpu-cores.outputs.count }}"
- name: Upload Artifact
if: inputs.matrix-js-sdk-sha == ''
uses: actions/upload-artifact@v3
with:
name: coverage
@ -50,6 +61,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: ${{ inputs.matrix-js-sdk-sha && 'matrix-org/matrix-react-sdk' || github.repository }}
- uses: actions/setup-node@v3
with:
@ -57,3 +70,5 @@ jobs:
- name: Run tests
run: "./scripts/ci/app-tests.sh"
env:
JS_SDK_GITHUB_BASE_REF: ${{ inputs.matrix-js-sdk-sha }}

View File

@ -11,6 +11,7 @@ set -ex
scripts/fetchdep.sh matrix-org matrix-js-sdk
pushd matrix-js-sdk
[ -n "$JS_SDK_GITHUB_BASE_REF" ] && git fetch --depth 1 origin $JS_SDK_GITHUB_BASE_REF && git checkout $JS_SDK_GITHUB_BASE_REF
yarn link
yarn install --pure-lockfile $@
popd

View File

@ -16,6 +16,7 @@ set -ex
# Set up the js-sdk first
scripts/fetchdep.sh matrix-org matrix-js-sdk
pushd matrix-js-sdk
[ -n "$JS_SDK_GITHUB_BASE_REF" ] && git fetch --depth 1 origin $JS_SDK_GITHUB_BASE_REF && git checkout $JS_SDK_GITHUB_BASE_REF
yarn link
yarn install --pure-lockfile
popd