Skip to content

Commit

Permalink
Merge tag 'tags/v3.109.0' into jts/verji-develop-final-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
John Tore Simonsen committed Nov 27, 2024
2 parents 1590092 + 0aa9df2 commit 5d78543
Show file tree
Hide file tree
Showing 813 changed files with 31,022 additions and 18,638 deletions.
25 changes: 19 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ module.exports = {
["*.mxcUrlToHttp", "*.getHttpUriForMxc"],
"Use Media helper instead to centralise access for customisation.",
),
...buildRestrictedPropertiesOptions(["window.setImmediate"], "Use setTimeout instead."),
],
"no-restricted-globals": [
"error",
{
name: "setImmediate",
message: "Use setTimeout instead.",
},
],

"import/no-duplicates": ["error"],
Expand Down Expand Up @@ -70,6 +78,11 @@ module.exports = {
name: "matrix-react-sdk/",
message: "Please use matrix-react-sdk/src/index instead",
},
{
name: "emojibase-regex",
message:
"This regex doesn't actually test for emoji. See the docs at https://emojibase.dev/docs/regex/ and prefer our own EMOJI_REGEX from HtmlUtils.",
},
],
patterns: [
{
Expand Down Expand Up @@ -98,8 +111,6 @@ module.exports = {
"!matrix-js-sdk/src/secret-storage",
"!matrix-js-sdk/src/room-hierarchy",
"!matrix-js-sdk/src/rendezvous",
"!matrix-js-sdk/src/rendezvous/transports",
"!matrix-js-sdk/src/rendezvous/channels",
"!matrix-js-sdk/src/indexeddb-worker",
"!matrix-js-sdk/src/pushprocessor",
"!matrix-js-sdk/src/extensible_events_v1",
Expand All @@ -109,13 +120,9 @@ module.exports = {
"!matrix-js-sdk/src/extensible_events_v1/InvalidEventError",
"!matrix-js-sdk/src/crypto",
"!matrix-js-sdk/src/crypto/aes",
"!matrix-js-sdk/src/crypto/olmlib",
"!matrix-js-sdk/src/crypto/crypto",
"!matrix-js-sdk/src/crypto/keybackup",
"!matrix-js-sdk/src/crypto/RoomList",
"!matrix-js-sdk/src/crypto/deviceinfo",
"!matrix-js-sdk/src/crypto/key_passphrase",
"!matrix-js-sdk/src/crypto/CrossSigning",
"!matrix-js-sdk/src/crypto/recoverykey",
"!matrix-js-sdk/src/crypto/dehydration",
"!matrix-js-sdk/src/oidc",
Expand All @@ -135,9 +142,15 @@ module.exports = {
"!matrix-js-sdk/src/models/read-receipt",
"!matrix-js-sdk/src/models/relations-container",
"!matrix-js-sdk/src/models/related-relations",
"!matrix-js-sdk/src/matrixrtc",
],
message: "Please use matrix-js-sdk/src/matrix instead",
},
{
group: ["emojibase-regex/emoji*"],
message:
"This regex doesn't actually test for emoji. See the docs at https://emojibase.dev/docs/regex/ and prefer our own EMOJI_REGEX from HtmlUtils.",
},
],
},
],
Expand Down
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@
/src/stores/SetupEncryptionStore.ts @matrix-org/element-crypto-web-reviewers
/test/stores/SetupEncryptionStore-test.ts @matrix-org/element-crypto-web-reviewers

# Ignore translations as those will be updated by GHA for Localazy download
/src/i18n/strings
# Ignore the synapse plugin as this is updated by GHA for docker image updating
/playwright/plugins/homeserver/synapse/index.ts
29 changes: 2 additions & 27 deletions .github/workflows/end-to-end-tests-netlify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,38 +21,13 @@ jobs:
statuses: write
deployments: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: actions/setup-node@v4
with:
cache: "yarn"

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Download blob reports from GitHub Actions Artifacts
- name: Download HTML report
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.ELEMENT_BOT_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
pattern: all-blob-reports-*
path: all-blob-reports
merge-multiple: true

- name: Merge into HTML Report
run: yarn playwright merge-reports --reporter=html,./playwright/flaky-reporter.ts ./all-blob-reports
env:
# Only pass creds to the flaky-reporter on main branch runs
GITHUB_TOKEN: ${{ github.event.workflow_run.head_branch == 'develop' && secrets.ELEMENT_BOT_TOKEN || '' }}

- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: html-report--attempt-${{ github.run_attempt }}
name: html-report
path: playwright-report
retention-days: 14

- name: 📤 Deploy to Netlify
uses: matrix-org/netlify-pr-preview@v3
Expand Down
51 changes: 46 additions & 5 deletions .github/workflows/end-to-end-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
build:
name: "Build Element-Web"
runs-on: ubuntu-latest
if: inputs.skip != true
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -55,6 +56,7 @@ jobs:
- uses: actions/setup-node@v4
with:
cache: "yarn"
node-version: "lts/*"

- name: Fetch layered build
id: layered_build
Expand Down Expand Up @@ -102,7 +104,7 @@ jobs:
fail-fast: false
matrix:
# Run multiple instances in parallel to speed up the tests
runner: [1, 2, 3, 4, 5, 6, 7, 8]
runner: [1, 2, 3, 4, 5, 6]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -120,6 +122,7 @@ jobs:
with:
cache: "yarn"
cache-dependency-path: matrix-react-sdk/yarn.lock
node-version: "lts/*"

- name: Install dependencies
working-directory: matrix-react-sdk
Expand All @@ -144,10 +147,8 @@ jobs:
run: yarn playwright install --with-deps

- name: Run Playwright tests
uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a
with:
run: yarn playwright test --shard ${{ matrix.runner }}/${{ strategy.job-total }}
working-directory: matrix-react-sdk
run: yarn playwright test --shard ${{ matrix.runner }}/${{ strategy.job-total }}
working-directory: matrix-react-sdk

- name: Upload blob report to GitHub Actions Artifacts
if: always()
Expand All @@ -163,5 +164,45 @@ jobs:
if: always()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
if: inputs.skip != true
with:
persist-credentials: false
repository: ${{ inputs.react-sdk-repository || github.repository }}

- uses: actions/setup-node@v4
if: inputs.skip != true
with:
cache: "yarn"
node-version: "lts/*"

- name: Install dependencies
if: inputs.skip != true
run: yarn install --frozen-lockfile

- name: Download blob reports from GitHub Actions Artifacts
if: inputs.skip != true
uses: actions/download-artifact@v4
with:
pattern: all-blob-reports-*
path: all-blob-reports
merge-multiple: true

- name: Merge into HTML Report
if: inputs.skip != true
run: yarn playwright merge-reports --reporter=html,./playwright/flaky-reporter.ts,./playwright/stale-screenshot-reporter.ts ./all-blob-reports
env:
# Only pass creds to the flaky-reporter on main branch runs
GITHUB_TOKEN: ${{ github.ref_name == 'develop' && secrets.ELEMENT_BOT_TOKEN || '' }}

# Upload the HTML report even if one of our reporters fails, this can happen when stale screenshots are detected
- name: Upload HTML report
if: always() && inputs.skip != true
uses: actions/upload-artifact@v4
with:
name: html-report
path: playwright-report
retention-days: 14

- if: needs.playwright.result != 'skipped' && needs.playwright.result != 'success'
run: exit 1
45 changes: 45 additions & 0 deletions .github/workflows/playwright-image-updates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Update Playwright docker images
on:
workflow_dispatch: {}
schedule:
- cron: "0 6 * * *" # Every day at 6am UTC
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Update synapse image
run: |
docker pull "$IMAGE"
INSPECT=$(docker inspect --format='{{index .RepoDigests 0}}' "$IMAGE")
DIGEST=${INSPECT#*@}
sed -i "s/const DOCKER_TAG.*/const DOCKER_TAG = \"develop@$DIGEST\";/" playwright/plugins/homeserver/synapse/index.ts
env:
IMAGE: ghcr.io/element-hq/synapse:develop

- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6
with:
token: ${{ secrets.ELEMENT_BOT_TOKEN }}
branch: actions/playwright-image-updates
delete-branch: true
title: Playwright Docker image updates
labels: |
T-Task
- name: Enable automerge
run: gh pr merge --merge --auto "$PR_NUMBER"
if: steps.cpr.outputs.pull-request-operation == 'created'
env:
GH_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
PR_NUMBER: ${{ steps.cpr.outputs.pull-request-number }}

- name: Enable autoapprove
run: |
gh pr review --approve "$PR_NUMBER"
if: steps.cpr.outputs.pull-request-operation == 'created'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ steps.cpr.outputs.pull-request-number }}
16 changes: 16 additions & 0 deletions .github/workflows/pull_request_base_branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Pull Request Base Branch
on:
pull_request:
types: [opened, edited, synchronize]
jobs:
check_base_branch:
name: Check PR base branch
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
const baseBranch = context.payload.pull_request.base.ref;
if (!['develop', 'staging'].includes(baseBranch) && !baseBranch.startsWith('feat/')) {
core.setFailed(`Invalid base branch: ${baseBranch}`);
}
6 changes: 5 additions & 1 deletion .github/workflows/static_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Switch js-sdk to release mode
working-directory: node_modules/matrix-js-sdk
run: |
scripts/switch_package_to_release.js
scripts/switch_package_to_release.cjs
yarn install
yarn run build:compile
yarn run build:types
Expand Down Expand Up @@ -118,6 +118,7 @@ jobs:
- uses: actions/setup-node@v4
with:
cache: "yarn"
node-version: "lts/*"

# Does not need branch matching as only analyses this layer
- name: Install Deps
Expand All @@ -135,6 +136,7 @@ jobs:
- uses: actions/setup-node@v4
with:
cache: "yarn"
node-version: "lts/*"

# Does not need branch matching as only analyses this layer
- name: Install Deps
Expand All @@ -152,6 +154,7 @@ jobs:
- uses: actions/setup-node@v4
with:
cache: "yarn"
node-version: "lts/*"

# Does not need branch matching as only analyses this layer
- name: Install Deps
Expand All @@ -171,6 +174,7 @@ jobs:
- uses: actions/setup-node@v4
with:
cache: "yarn"
node-version: "lts/*"

- name: Install Deps
run: "scripts/ci/layered.sh"
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ jobs:
- name: Yarn cache
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: "yarn"

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

Expand Down Expand Up @@ -117,6 +118,7 @@ jobs:
- uses: actions/setup-node@v4
with:
cache: "yarn"
node-version: "lts/*"

- name: Run tests
run: "./scripts/ci/app-tests.sh"
Expand Down
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged --concurrent false
5 changes: 5 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"*": "prettier --write",
"*.(ts|tsx|js|jsx)": ["eslint --fix"],
"*.pcss": ["stylelint"]
}
File renamed without changes.
Loading

0 comments on commit 5d78543

Please sign in to comment.