mirror of
https://github.com/vector-im/element-call.git
synced 2026-12-04 10:21:10 +08:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d49f4640f7 | ||
|
|
42bd2fc2d4 | ||
|
|
21b3ebbd19 | ||
|
|
6e791c3e85 | ||
|
|
2223586408 |
@@ -7,7 +7,7 @@ on:
|
||||
type: string
|
||||
package:
|
||||
type: string # This would ideally be a `choice` type, but that isn't supported yet
|
||||
description: The package type to be built. Must be one of 'full', 'embedded', or 'widget-rtc-sdk'
|
||||
description: The package type to be built. Must be one of 'full', 'embedded', 'widget-rtc-sdk' or 'component'
|
||||
required: true
|
||||
build_mode:
|
||||
type: string # This would ideally be a `choice` type, but that isn't supported yet
|
||||
@@ -59,11 +59,21 @@ jobs:
|
||||
NODE_OPTIONS: "--max-old-space-size=4096"
|
||||
PACKAGE: ${{ inputs.package }}
|
||||
BUILD_MODE: ${{ inputs.build_mode }}
|
||||
- name: Pack component
|
||||
# A tarball a host installs like the npm release. Stripped as in
|
||||
# publish-component.yaml, so the install does not run `prepare` and
|
||||
# rebuild it.
|
||||
if: inputs.package == 'component'
|
||||
working-directory: component
|
||||
run: |
|
||||
jq 'del(.devEngines, .scripts)' package.json > package.json.tmp && mv package.json.tmp package.json
|
||||
mkdir -p ../component-pack
|
||||
npm pack --pack-destination ../component-pack
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||
with:
|
||||
name: build-output-${{ inputs.package }}
|
||||
path: dist
|
||||
path: ${{ inputs.package == 'component' && 'component-pack' || 'dist' }}
|
||||
if-no-files-found: error
|
||||
# We'll only use this in a triggered job, then we're done with it
|
||||
retention-days: 1
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
# Element Web develop with this commit's component in place of the npm release
|
||||
# it pins, and the component embedding forced on. Deployed to
|
||||
# element-web--element-call.netlify.app by deploy_element_web_with_ec_component
|
||||
# for main, and to pr<N>-element-web--element-call.netlify.app by pr-deploy.yaml.
|
||||
#
|
||||
# A workflow of its own rather than part of Build: pr-deploy.yaml runs once per
|
||||
# finished workflow, so the Element Call previews do not wait for this slower
|
||||
# build, and a broken Element Web develop does not hold them back.
|
||||
name: Build Element Web
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- synchronize
|
||||
- opened
|
||||
- labeled
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
permissions: {}
|
||||
|
||||
# A newer push to a PR cancels its running build. A label event that builds
|
||||
# nothing gets a group of its own: concurrency applies before the jobs' `if`,
|
||||
# so in the PR's group it would cancel a real build and then skip.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ (github.event.action == 'labeled' && github.event.label.name != 'development build') && github.run_id || github.event.pull_request.number || github.sha }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
build_component_element_call:
|
||||
# The React component package, as a tarball for build_element_web_with_ec_component
|
||||
# Of the labels only `development build` changes the build
|
||||
if: github.event.action != 'labeled' || github.event.label.name == 'development build'
|
||||
permissions:
|
||||
contents: read
|
||||
uses: $/.github/workflows/build-element-call.yaml
|
||||
with:
|
||||
package: component
|
||||
vite_app_version: ${{ github.sha }}
|
||||
build_mode: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'development build') && 'development' || 'production' }}
|
||||
secrets:
|
||||
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
||||
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|
||||
SENTRY_URL: ${{ secrets.SENTRY_URL }}
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
build_element_web_with_ec_component:
|
||||
# The steps follow the prepare job of Element Web's build-and-test.yaml.
|
||||
name: Build Element Web with the Element Call component
|
||||
needs: build_component_element_call
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout Element Web
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
||||
with:
|
||||
repository: element-hq/element-web
|
||||
ref: develop
|
||||
persist-credentials: false
|
||||
# Also installs the Node of Element Web's .node-version
|
||||
- uses: pnpm/setup@731dfb6463bbd11c11fd0ee11fe00ed0e36d48a1 # v3.2.0
|
||||
with:
|
||||
cache: true
|
||||
save-cache: false
|
||||
install: false
|
||||
- name: Fetch layered build
|
||||
id: layered
|
||||
run: |
|
||||
./scripts/layered.sh
|
||||
VERSION=$(scripts/get-version-from-git.sh)
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
- name: Download the component
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
|
||||
with:
|
||||
name: build-output-component
|
||||
path: ec-component
|
||||
- name: Install the component
|
||||
# The same tarball install Element Web's layered.sh does for matrix-js-sdk
|
||||
run: pnpm -C apps/web install "$PWD"/ec-component/*.tgz
|
||||
- name: Write config
|
||||
# The setting prefers the config's value, so this forces it on
|
||||
working-directory: apps/web
|
||||
run: jq '.features.feature_element_call_react = true' element.io/develop/config.json > config.json
|
||||
- name: Build
|
||||
env:
|
||||
CI_PACKAGE: true
|
||||
VERSION: ${{ steps.layered.outputs.version }}
|
||||
working-directory: apps/web
|
||||
run: pnpm run build
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||
with:
|
||||
name: build-output-element-web-with-ec-component
|
||||
path: apps/web/webapp
|
||||
if-no-files-found: error
|
||||
# We'll only use this in a deploy job, then we're done with it
|
||||
retention-days: 1
|
||||
|
||||
deploy_element_web_with_ec_component:
|
||||
# PRs are deployed by pr-deploy.yaml, which keeps the secrets away from PR code
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
needs: build_element_web_with_ec_component
|
||||
permissions:
|
||||
deployments: write
|
||||
uses: $/.github/workflows/deploy-to-netlify.yaml
|
||||
with:
|
||||
package: element-web-with-ec-component
|
||||
deployment_ref: ${{ github.sha }}
|
||||
secrets:
|
||||
ELEMENT_BOT_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
@@ -2,14 +2,17 @@ name: Deploy to Netlify
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
# Optional so that main can deploy element-web-with-ec-component,
|
||||
# which then uses the alias `element-web`. Every other package needs
|
||||
# pr_number (for its alias) and full needs pr_head_* (for its config).
|
||||
pr_number:
|
||||
required: true
|
||||
required: false
|
||||
type: string
|
||||
pr_head_full_name:
|
||||
required: true
|
||||
required: false
|
||||
type: string
|
||||
pr_head_ref:
|
||||
required: true
|
||||
required: false
|
||||
type: string
|
||||
deployment_ref:
|
||||
required: true
|
||||
@@ -17,7 +20,7 @@ on:
|
||||
package:
|
||||
required: true
|
||||
type: string
|
||||
description: Which package to deploy - 'full', 'embedded', 'widget-rtc-sdk', or 'storybook'
|
||||
description: Which package to deploy - 'full', 'embedded', 'widget-rtc-sdk', 'storybook' or 'element-web-with-ec-component'
|
||||
artifact_run_id:
|
||||
required: false
|
||||
type: string
|
||||
@@ -59,8 +62,9 @@ jobs:
|
||||
|
||||
- name: Add redirects file
|
||||
# We fetch from github directly as we don't bother checking out the repo
|
||||
# Not needed for storybook deployments
|
||||
if: inputs.package != 'storybook'
|
||||
# Not needed for storybook deployments, nor for Element Web, which
|
||||
# routes with the URL fragment
|
||||
if: inputs.package != 'storybook' && inputs.package != 'element-web-with-ec-component'
|
||||
run: curl -s https://raw.githubusercontent.com/element-hq/element-call/main/config/netlify_redirects > webapp/_redirects
|
||||
|
||||
- name: Add config file
|
||||
@@ -84,11 +88,13 @@ jobs:
|
||||
with:
|
||||
publish-dir: webapp
|
||||
deploy-message: "Deploy from GitHub Actions"
|
||||
alias: ${{ inputs.package == 'widget-rtc-sdk' && format('pr{0}-widget-rtc-sdk', inputs.pr_number) || inputs.package == 'storybook' && format('pr{0}-storybook', inputs.pr_number) || format('pr{0}', inputs.pr_number) }}
|
||||
# Element Web with the component deploys for main too, without a PR number
|
||||
alias: ${{ inputs.package == 'widget-rtc-sdk' && format('pr{0}-widget-rtc-sdk', inputs.pr_number) || inputs.package == 'storybook' && format('pr{0}-storybook', inputs.pr_number) || inputs.package == 'element-web-with-ec-component' && (inputs.pr_number && format('pr{0}-element-web', inputs.pr_number) || 'element-web') || format('pr{0}', inputs.pr_number) }}
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
timeout-minutes: 1
|
||||
# Element Web has many times the files of Element Call to upload
|
||||
timeout-minutes: ${{ inputs.package == 'element-web-with-ec-component' && 10 || 1 }}
|
||||
|
||||
- name: 🚦 Update deployment status
|
||||
uses: bobheadxi/deployments@648679e8e4915b27893bd7dbc35cb504dc915bc8 # v1
|
||||
|
||||
@@ -2,8 +2,10 @@ name: Deploy previews for PRs
|
||||
on:
|
||||
# zizmor: ignore[dangerous-triggers]
|
||||
# Reason: This is now restricted to internal PRs only using the 'if' condition below.
|
||||
# Runs once per finished workflow, and deploys only what that workflow built,
|
||||
# so each preview goes up as soon as its own build is done
|
||||
workflow_run:
|
||||
workflows: ["Build"]
|
||||
workflows: ["Build", "Build Element Web"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
@@ -12,7 +14,7 @@ permissions: {}
|
||||
jobs:
|
||||
prdetails:
|
||||
# Logic:
|
||||
# 1. Build must be successful
|
||||
# 1. The build workflow must be successful
|
||||
# 2. Event must be a pull_request
|
||||
# 3. Head repository must be the SAME as the base repository (No Forks!)
|
||||
if: >
|
||||
@@ -34,6 +36,7 @@ jobs:
|
||||
branch: ${{ github.event.workflow_run.head_branch }}
|
||||
|
||||
netlify-full:
|
||||
if: github.event.workflow_run.name == 'Build'
|
||||
needs: prdetails
|
||||
permissions:
|
||||
deployments: write
|
||||
@@ -51,6 +54,7 @@ jobs:
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
|
||||
netlify-widget-rtc-sdk:
|
||||
if: github.event.workflow_run.name == 'Build'
|
||||
needs: prdetails
|
||||
permissions:
|
||||
deployments: write
|
||||
@@ -67,9 +71,48 @@ jobs:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
|
||||
element-web-built:
|
||||
# A Build Element Web run started by a label it ignores skips every job
|
||||
# and uploads nothing to deploy
|
||||
if: github.event.workflow_run.name == 'Build Element Web'
|
||||
needs: prdetails
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
actions: read
|
||||
outputs:
|
||||
built: ${{ steps.check.outputs.built }}
|
||||
steps:
|
||||
- id: check
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RUN_ID: ${{ github.event.workflow_run.id }}
|
||||
run: |
|
||||
count=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$RUN_ID/artifacts?name=build-output-element-web-with-ec-component" --jq '.total_count')
|
||||
if [ "$count" -gt 0 ]; then built=true; else built=false; fi
|
||||
echo "built=$built" >> "$GITHUB_OUTPUT"
|
||||
|
||||
netlify-element-web-with-ec-component:
|
||||
# Element Web with this PR's component
|
||||
if: needs.element-web-built.outputs.built == 'true'
|
||||
needs: [prdetails, element-web-built]
|
||||
permissions:
|
||||
deployments: write
|
||||
uses: $/.github/workflows/deploy-to-netlify.yaml
|
||||
with:
|
||||
artifact_run_id: ${{ github.event.workflow_run.id || github.run_id }}
|
||||
pr_number: ${{ needs.prdetails.outputs.pr_number }}
|
||||
pr_head_full_name: ${{ github.event.workflow_run.head_repository.full_name }}
|
||||
pr_head_ref: ${{ needs.prdetails.outputs.pr_data_json && fromJSON(needs.prdetails.outputs.pr_data_json).head.ref }}
|
||||
deployment_ref: ${{ needs.prdetails.outputs.pr_data_json && fromJSON(needs.prdetails.outputs.pr_data_json).head.sha || github.ref || github.head_ref }}
|
||||
package: element-web-with-ec-component
|
||||
secrets:
|
||||
ELEMENT_BOT_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
|
||||
netlify-storybook:
|
||||
needs: prdetails
|
||||
if: ${{ needs.prdetails.outputs.pr_data_json && contains(fromJSON(needs.prdetails.outputs.pr_data_json).labels.*.name, 'storybook build') }}
|
||||
if: ${{ github.event.workflow_run.name == 'Build' && needs.prdetails.outputs.pr_data_json && contains(fromJSON(needs.prdetails.outputs.pr_data_json).labels.*.name, 'storybook build') }}
|
||||
permissions:
|
||||
deployments: write
|
||||
uses: $/.github/workflows/deploy-to-netlify.yaml
|
||||
@@ -86,7 +129,7 @@ jobs:
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
|
||||
docker:
|
||||
if: ${{ needs.prdetails.outputs.pr_data_json && contains(fromJSON(needs.prdetails.outputs.pr_data_json).labels.*.name, 'docker build') }}
|
||||
if: ${{ github.event.workflow_run.name == 'Build' && needs.prdetails.outputs.pr_data_json && contains(fromJSON(needs.prdetails.outputs.pr_data_json).labels.*.name, 'docker build') }}
|
||||
needs: prdetails
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
@@ -36,13 +36,13 @@ export interface AudioOutputSwitcher {
|
||||
* The Snapshot combines all fields required to populate the view.
|
||||
*
|
||||
* It is a combination of Actions and State.
|
||||
* All Actions and State will be wrappen in behaviors.
|
||||
* This has the advantage, that actions can mutate.
|
||||
* (example: a device gets disconnected, the swicht action is not possible anymore, the actions becomes undefined)
|
||||
* With it being reactive we can use the existance of the action to update the rendering without
|
||||
* All Actions and State will be wrapped in behaviors.
|
||||
* This has the advantage that actions can mutate.
|
||||
* (example: a device gets disconnected, the switch action is not possible anymore, the action becomes undefined)
|
||||
* With it being reactive we can use the existence of the action to update the rendering without
|
||||
* requiring additional state.
|
||||
*
|
||||
* Comment: It might not make sense to seperate the two interfaces. Hence the seperation
|
||||
* Comment: It might not make sense to separate the two interfaces. Hence the separation
|
||||
* just happens on the syntax level with the `type = ... & ...` notation.
|
||||
*/
|
||||
export type FooterSnapshot = FooterActions & FooterState;
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ export interface WidgetHelpers {
|
||||
* @returns A point of access to the widget API, or null if Element Call is not
|
||||
* running as a widget.
|
||||
*/
|
||||
// this needs to be a seperate call and cannot be done on import to allow us to spy on methods in here before
|
||||
// this needs to be a separate call and cannot be done on import to allow us to spy on methods in here before
|
||||
// execution.
|
||||
export const initializeWidget = (
|
||||
rtcApplication: string = "m.call",
|
||||
|
||||
Reference in New Issue
Block a user