mirror of
https://github.com/vector-im/element-web.git
synced 2025-12-25 11:11:31 +01:00
* Make shared component build work in isolation * Add deps that were missing because they were getting picked up from element-web main but shared-components needs itself * Exclude test files from dts generation * Bump version * Change all the shared-component import to be the built artifact * Don't randomly inhale eslint configs in parent dirs please * maybe we don't need this anymore? * maybe fix build * Maybe fix docker build * More build faff * build:res on the parent as part of shared component prepare * link shared component repo inn docker build * 💅 * 💅x2 * Try converting the translation keys to a .d.ts file manually so it gets bundled rather than left as a relative import to the json file * add the script * Add this back for 2nd time now I think * Shouldn't need this anymore * patch-package on prepare because we're patching a dev dependency so it won't be there if we're installed as a dependency * Unused import * Prettier compliance * Only use counterpart from shared components as per comment * Import shared components CSS * Prettier * Call the one from shared components rather than recurse infinitely * Hopefully make tests work * wake up, comment goes before import * Fix lint errors * Fix dupe TranslationKey export * Update compound-web to fix type error An update to @types.react adds the 'hint' value to the enum of the 'popover' attribute and this version of compound-web uses the maching verson of @types/react so they don't conflict. * Maybe, hopefully, get the types working? Please? * Add copyright header to i18nkeys as eslint complains otherwise since it's now in src * prettier * stop running shared-component tests in EW * update snapshots because flex is now from an external stylesheet I guess * More snapshots * Manual class update * Avoid bundling compound bits Because a) it's silly and b) it means we end up bundling a copy of floating-ui too which causes absolute madness with its useDelayGroup contexts. * ignore test util files for coverage * Add !important because the styles are being applied in a different order now * Another !important because css order has changed * Try adding it here to make the test files ignored * More !important * commit yarn lock change * Add shared components coverage file * Update snapshots Because the line height was being overridden to 22.5px somehow by something I can't find, and now isn't: surely the normal 1.5rem is more sensible. * Update snapshots, attempt 2 * Another !important * More snapshot updates * Add test for i18n wrappers & add test script * lint * Prettier * Hopefully run shared component tests * don't need this bit for non-matrix * install ew deps * rigfht coverage location * Rename job here too * Try different coverage filename * Fix copyrights & comment * Typo Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> --------- Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
168 lines
6.1 KiB
YAML
168 lines
6.1 KiB
YAML
name: Tests
|
|
on:
|
|
pull_request: {}
|
|
merge_group:
|
|
types: [checks_requested]
|
|
push:
|
|
branches: [develop, master]
|
|
repository_dispatch:
|
|
types: [element-web-notify]
|
|
workflow_call:
|
|
inputs:
|
|
disable_coverage:
|
|
type: boolean
|
|
required: false
|
|
description: "Specify true to skip generating and uploading coverage for tests"
|
|
matrix-js-sdk-sha:
|
|
type: string
|
|
required: false
|
|
description: "The matrix-js-sdk SHA to use"
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
ENABLE_COVERAGE: ${{ github.event_name != 'merge_group' && inputs.disable_coverage != 'true' }}
|
|
# fetchdep.sh needs to know our PR number
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
jest_ew:
|
|
name: Jest (Element Web)
|
|
runs-on: ubuntu-24.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# Run multiple instances in parallel to speed up the tests
|
|
runner: [1, 2]
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
|
with:
|
|
repository: ${{ inputs.matrix-js-sdk-sha && 'element-hq/element-web' || github.repository }}
|
|
|
|
- name: Yarn cache
|
|
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
|
|
with:
|
|
node-version: "lts/*"
|
|
cache: "yarn"
|
|
|
|
- name: Install Deps
|
|
run: "./scripts/layered.sh"
|
|
env:
|
|
JS_SDK_GITHUB_BASE_REF: ${{ inputs.matrix-js-sdk-sha }}
|
|
|
|
- name: Jest Cache
|
|
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
|
with:
|
|
path: /tmp/jest_cache
|
|
key: ${{ hashFiles('**/yarn.lock') }}
|
|
|
|
- name: Get number of CPU cores
|
|
id: cpu-cores
|
|
uses: SimenB/github-actions-cpu-cores@97ba232459a8e02ff6121db9362b09661c875ab8 # v2
|
|
|
|
- name: Run tests
|
|
run: |
|
|
yarn test \
|
|
--coverage=${{ env.ENABLE_COVERAGE }} \
|
|
--ci \
|
|
--max-workers ${{ steps.cpu-cores.outputs.count }} \
|
|
--shard ${{ matrix.runner }}/${{ strategy.job-total }} \
|
|
--cacheDirectory /tmp/jest_cache
|
|
env:
|
|
JEST_SONAR_UNIQUE_OUTPUT_NAME: true
|
|
|
|
# tell jest to use coloured output
|
|
FORCE_COLOR: true
|
|
|
|
- name: Move coverage files into place
|
|
if: env.ENABLE_COVERAGE == 'true'
|
|
run: mv coverage/lcov.info coverage/${{ steps.setupNode.outputs.node-version }}-${{ matrix.runner }}.lcov.info
|
|
|
|
- name: Upload Artifact
|
|
if: env.ENABLE_COVERAGE == 'true'
|
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
|
|
with:
|
|
name: coverage-${{ matrix.runner }}
|
|
path: |
|
|
coverage
|
|
!coverage/lcov-report
|
|
|
|
complete:
|
|
name: jest-tests
|
|
needs: jest_ew
|
|
if: always()
|
|
runs-on: ubuntu-24.04
|
|
permissions:
|
|
statuses: write
|
|
steps:
|
|
- if: needs.jest_ew.result != 'skipped' && needs.jest_ew.result != 'success'
|
|
run: exit 1
|
|
|
|
- name: Skip SonarCloud in merge queue
|
|
if: github.event_name == 'merge_group' || inputs.disable_coverage == 'true'
|
|
uses: guibranco/github-status-action-v2@5530c593759f489bba08272e96986ffc571c1ea1
|
|
with:
|
|
authToken: ${{ secrets.GITHUB_TOKEN }}
|
|
state: success
|
|
description: SonarCloud skipped
|
|
context: SonarCloud Code Analysis
|
|
sha: ${{ github.sha }}
|
|
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
|
|
jest_sc:
|
|
name: Jest (Shared Components)
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
|
with:
|
|
repository: ${{ inputs.matrix-js-sdk-sha && 'element-hq/element-web' || github.repository }}
|
|
|
|
- name: Yarn cache
|
|
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
|
|
with:
|
|
node-version: "lts/*"
|
|
cache: "yarn"
|
|
|
|
- name: Install EW Deps
|
|
run: "yarn install"
|
|
|
|
- name: Install Shared Component Deps
|
|
working-directory: "packages/shared-components"
|
|
run: "yarn install"
|
|
|
|
- name: Jest Cache
|
|
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
|
with:
|
|
path: /tmp/jest_cache
|
|
key: ${{ hashFiles('**/yarn.lock') }}
|
|
|
|
- name: Get number of CPU cores
|
|
id: cpu-cores
|
|
uses: SimenB/github-actions-cpu-cores@97ba232459a8e02ff6121db9362b09661c875ab8 # v2
|
|
|
|
- name: Run tests
|
|
working-directory: "packages/shared-components"
|
|
run: |
|
|
yarn test \
|
|
--coverage=${{ env.ENABLE_COVERAGE }} \
|
|
--ci \
|
|
--max-workers ${{ steps.cpu-cores.outputs.count }} \
|
|
--cacheDirectory /tmp/jest_cache
|
|
env:
|
|
# tell jest to use coloured output
|
|
FORCE_COLOR: true
|
|
|
|
- name: Upload Artifact
|
|
if: env.ENABLE_COVERAGE == 'true'
|
|
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
|
|
with:
|
|
name: coverage-sharedcomponents
|
|
path: |
|
|
packages/shared-components/coverage
|
|
!packages/shared-components/coverage/lcov-report
|