Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/28192/head
Michael Telatynski 2024-10-15 19:16:13 +01:00
parent 0f31b15573
commit 0007d3de32
No known key found for this signature in database
GPG Key ID: A2B008A5F49F5D0D
5 changed files with 8 additions and 92 deletions

View File

@ -24,10 +24,6 @@ on:
type: string type: string
required: false required: false
description: "The Git SHA of matrix-js-sdk to build against. By default, will use a matching branch name if it exists, or develop." description: "The Git SHA of matrix-js-sdk to build against. By default, will use a matching branch name if it exists, or develop."
element-web-sha:
type: string
required: false
description: "The Git SHA of element-web to build against. By default, will use a matching branch name if it exists, or develop."
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
@ -58,16 +54,14 @@ jobs:
env: env:
# tell layered.sh to check out the right sha of the JS-SDK & EW, if they were given one # tell layered.sh to check out the right sha of the JS-SDK & EW, if they were given one
JS_SDK_GITHUB_BASE_REF: ${{ inputs.matrix-js-sdk-sha }} JS_SDK_GITHUB_BASE_REF: ${{ inputs.matrix-js-sdk-sha }}
ELEMENT_WEB_GITHUB_BASE_REF: ${{ inputs.element-web-sha }}
run: | run: |
scripts/ci/layered.sh scripts/layered.sh
JSSDK_SHA=$(git -C matrix-js-sdk rev-parse --short=12 HEAD) JSSDK_SHA=$(git -C matrix-js-sdk rev-parse --short=12 HEAD)
VECTOR_SHA=$(git rev-parse --short=12 HEAD) VECTOR_SHA=$(git rev-parse --short=12 HEAD)
echo "VERSION=$VECTOR_SHA--js-$JSSDK_SHA" >> $GITHUB_OUTPUT echo "VERSION=$VECTOR_SHA--js-$JSSDK_SHA" >> $GITHUB_OUTPUT
- name: Copy config - name: Copy config
run: cp element.io/develop/config.json config.json run: cp element.io/develop/config.json config.json
working-directory: ./element-web
- name: Build - name: Build
env: env:
@ -76,13 +70,12 @@ jobs:
run: | run: |
yarn build yarn build
echo $VERSION > webapp/version echo $VERSION > webapp/version
working-directory: ./element-web
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: webapp name: webapp
path: element-web/webapp path: webapp
retention-days: 1 retention-days: 1
playwright: playwright:
@ -103,7 +96,6 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
persist-credentials: false persist-credentials: false
path: element-web
repository: element-hq/element-web repository: element-hq/element-web
- name: 📥 Download artifact - name: 📥 Download artifact
@ -115,16 +107,14 @@ jobs:
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
cache: "yarn" cache: "yarn"
cache-dependency-path: element-web/yarn.lock cache-dependency-path: yarn.lock
node-version: "lts/*" node-version: "lts/*"
- name: Install dependencies - name: Install dependencies
working-directory: element-web
run: yarn install --frozen-lockfile run: yarn install --frozen-lockfile
- name: Get installed Playwright version - name: Get installed Playwright version
id: playwright id: playwright
working-directory: element-web
run: echo "version=$(yarn list --pattern @playwright/test --depth=0 --json --non-interactive --no-progress | jq -r '.data.trees[].name')" >> $GITHUB_OUTPUT run: echo "version=$(yarn list --pattern @playwright/test --depth=0 --json --non-interactive --no-progress | jq -r '.data.trees[].name')" >> $GITHUB_OUTPUT
- name: Cache playwright binaries - name: Cache playwright binaries
@ -137,19 +127,17 @@ jobs:
- name: Install Playwright browsers - name: Install Playwright browsers
if: steps.playwright-cache.outputs.cache-hit != 'true' if: steps.playwright-cache.outputs.cache-hit != 'true'
working-directory: element-web
run: yarn playwright install --with-deps run: yarn playwright install --with-deps
- name: Run Playwright tests - name: Run Playwright tests
run: yarn playwright test --shard ${{ matrix.runner }}/${{ strategy.job-total }} run: yarn playwright test --shard ${{ matrix.runner }}/${{ strategy.job-total }}
working-directory: element-web
- name: Upload blob report to GitHub Actions Artifacts - name: Upload blob report to GitHub Actions Artifacts
if: always() if: always()
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: all-blob-reports-${{ matrix.runner }} name: all-blob-reports-${{ matrix.runner }}
path: element-web/blob-report path: blob-report
retention-days: 1 retention-days: 1
complete: complete:

View File

@ -48,7 +48,7 @@ jobs:
cache: "yarn" cache: "yarn"
- name: Install Deps - name: Install Deps
run: "./scripts/ci/install-deps.sh" run: "./scripts/layered.sh"
env: env:
JS_SDK_GITHUB_BASE_REF: ${{ inputs.matrix-js-sdk-sha }} JS_SDK_GITHUB_BASE_REF: ${{ inputs.matrix-js-sdk-sha }}

View File

@ -1,32 +0,0 @@
#!/bin/bash
# This installs other Matrix dependencies that are often
# developed in parallel with react-sdk, using fetchdep.sh
# for branch matching.
# This will set up a working react-sdk environment, so is
# used for running react-sdk standalone tests. To set up a
# build of element-web, use layered.sh
set -ex
scripts/fetchdep.sh matrix-org matrix-js-sdk develop
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 --frozen-lockfile $@
popd
scripts/fetchdep.sh matrix-org matrix-analytics-events
# We don't pass a default branch so cloning may fail when we are not in a PR
# This is expected as this project does not share a release cycle but we still branch match it
if [ -d matrix-analytics-events ]; then
pushd matrix-analytics-events
yarn link
yarn install --frozen-lockfile $@
yarn build:ts
popd
fi
yarn link matrix-js-sdk
[ -d matrix-analytics-events ] && yarn link @matrix-org/analytics-events
yarn install --frozen-lockfile $@

View File

@ -1,43 +0,0 @@
#!/bin/bash
set -ex
# Creates a layered environment with the full repo for the app and SDKs cloned
# and linked. This gives an element-web dev environment ready to build with
# the current react-sdk branch and any matching branches of react-sdk's dependencies
# so that changes can be tested in element-web.
# Note that this style is different from the recommended developer setup: this
# file nests js-sdk inside element-web, while the local
# development setup places them all at the same level. We are nesting them here
# because some CI systems do not allow moving to a directory above the checkout
# for the primary repo (react-sdk in this case).
# Set up the js-sdk first
scripts/fetchdep.sh matrix-org matrix-js-sdk develop
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 --frozen-lockfile
popd
# Also set up matrix-analytics-events for branch with matching name
scripts/fetchdep.sh matrix-org matrix-analytics-events
# We don't pass a default branch so cloning may fail when we are not in a PR
# This is expected as this project does not share a release cycle but we still branch match it
if [ -d matrix-analytics-events ]; then
pushd matrix-analytics-events
yarn link
yarn install --frozen-lockfile
yarn build:ts
popd
fi
# Finally, set up element-web
scripts/fetchdep.sh vector-im element-web develop
pushd element-web
[ -n "$ELEMENT_WEB_GITHUB_BASE_REF" ] && git fetch --depth 1 origin $ELEMENT_WEB_GITHUB_BASE_REF && git checkout $ELEMENT_WEB_GITHUB_BASE_REF
yarn link matrix-js-sdk
yarn install --frozen-lockfile
yarn build:res
popd

View File

@ -23,6 +23,7 @@ export PR_REPO=element-web
# Set up the js-sdk first # Set up the js-sdk first
scripts/fetchdep.sh matrix-org matrix-js-sdk develop scripts/fetchdep.sh matrix-org matrix-js-sdk develop
pushd 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 link
yarn install --frozen-lockfile yarn install --frozen-lockfile
popd popd
@ -41,3 +42,5 @@ fi
# Link the layers into element-web # Link the layers into element-web
yarn link matrix-js-sdk yarn link matrix-js-sdk
[ -d matrix-analytics-events ] && yarn link @matrix-org/analytics-events
yarn install --frozen-lockfile $@