diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5c2a8bfcaa..d8975c8904 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,9 +57,11 @@ jobs: run: ./scripts/layered.sh - name: Copy config + working-directory: apps/web run: cp element.io/develop/config.json config.json - name: Build + working-directory: apps/web env: CI_PACKAGE: true run: VERSION=$(scripts/get-version-from-git.sh) pnpm build @@ -68,5 +70,5 @@ jobs: uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 with: name: webapp-${{ matrix.image }} - path: webapp + path: apps/web/webapp retention-days: 1 diff --git a/.github/workflows/build_debian.yaml b/.github/workflows/build_debian.yaml index b1a897e037..91d01611fd 100644 --- a/.github/workflows/build_debian.yaml +++ b/.github/workflows/build_debian.yaml @@ -17,11 +17,13 @@ jobs: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Download package + working-directory: apps/web run: | wget "https://github.com/element-hq/element-web/releases/download/$VERSION/element-$VERSION.tar.gz" wget "https://github.com/element-hq/element-web/releases/download/$VERSION/element-$VERSION.tar.gz.asc" - name: Check GPG signature + working-directory: apps/web run: | wget "https://packages.element.io/element-release-key.gpg" gpg --import element-release-key.gpg @@ -31,6 +33,7 @@ jobs: FINGERPRINT: ${{ vars.GPG_FINGERPRINT }} - name: Prepare + working-directory: apps/web run: | mkdir -p debian/tmp/DEBIAN find debian -maxdepth 1 -type f -exec cp "{}" debian/tmp/DEBIAN/ \; @@ -41,6 +44,7 @@ jobs: ln -s /etc/element-web/config.json debian/tmp/usr/share/element-web/config.json - name: Write changelog + working-directory: apps/web run: | VERSION=$(cat package.json | jq -r .version) TIME=$(date -d "$PUBLISHED_AT" -R) @@ -57,6 +61,7 @@ jobs: PUBLISHED_AT: ${{ github.event.release.published_at }} - name: Build deb package + working-directory: apps/web run: | VERSION=$(cat package.json | jq -r .version) dpkg-gencontrol -v"$VERSION" -ldebian/tmp/DEBIAN/changelog @@ -65,14 +70,14 @@ jobs: - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 with: name: element-web.deb - path: element-web.deb + path: apps/web/element-web.deb retention-days: 14 - name: Publish to packages.element.io if: github.event.release.prerelease == false uses: element-hq/packages.element.io@master with: - file: element-web.deb + file: apps/web/element-web.deb github-token: ${{ secrets.ELEMENT_BOT_TOKEN }} bucket-api: ${{ vars.CF_R2_S3_API }} bucket-key-id: ${{ secrets.CF_R2_ACCESS_KEY_ID }} diff --git a/.github/workflows/build_develop.yml b/.github/workflows/build_develop.yml index fb54fb6829..bd76a5baa0 100644 --- a/.github/workflows/build_develop.yml +++ b/.github/workflows/build_develop.yml @@ -40,6 +40,7 @@ jobs: run: "./scripts/layered.sh" - name: Build, Package & Upload sourcemaps + working-directory: apps/web run: "./scripts/ci_package.sh" env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} @@ -55,20 +56,22 @@ jobs: CSP_EXTRA_SOURCE: ${{ env.R2_PUBLIC_URL }} - run: mv dist/element-*.tar.gz dist/develop.tar.gz + working-directory: apps/web - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 with: name: webapp - path: dist/develop.tar.gz + path: apps/web/dist/develop.tar.gz retention-days: 1 - name: Extract webapp run: | mkdir _deploy - tar xf dist/develop.tar.gz -C _deploy --strip-components=1 + tar xf apps/web/dist/develop.tar.gz -C _deploy --strip-components=1 - name: Copy config - run: cp element.io/develop/config.json _deploy/config.json + working-directory: apps/web + run: cp apps/web/element.io/develop/config.json _deploy/config.json - name: Populate 404.html run: echo "404 Not Found" > _deploy/404.html @@ -115,7 +118,7 @@ jobs: # Checksum algorithm specified as per https://developers.cloudflare.com/r2/examples/aws/aws-cli/ - name: Deploy to R2 run: | - aws s3 cp dist/develop.tar.gz s3://$R2_BUCKET/develop.tar.gz --endpoint-url $R2_URL --region=auto --checksum-algorithm CRC32 + aws s3 cp apps/web/dist/develop.tar.gz s3://$R2_BUCKET/develop.tar.gz --endpoint-url $R2_URL --region=auto --checksum-algorithm CRC32 aws s3 cp _deploy/ s3://$R2_BUCKET/ --recursive --endpoint-url $R2_URL --region=auto --checksum-algorithm CRC32 env: AWS_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1a9c9fd057..ab09eb9fc4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -70,7 +70,7 @@ jobs: run: cp -vnpr _current_version/bundles/* _deploy/bundles/ - name: Copy config - run: cp element.io/app/config.json _deploy/config.json + run: cp apps/web/element.io/app/config.json _deploy/config.json - name: Populate 404.html run: echo "404 Not Found" > _deploy/404.html diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 37635d29f5..c3943b1a40 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -41,6 +41,7 @@ jobs: uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6 with: context: . + file: apps/web/Dockerfile load: true - name: Test the image @@ -151,6 +152,7 @@ jobs: if: github.event_name != 'pull_request' with: context: . + file: apps/web/Dockerfile push: true platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/end-to-end-tests.yaml b/.github/workflows/end-to-end-tests.yaml index ccf994d516..2eb40950ef 100644 --- a/.github/workflows/end-to-end-tests.yaml +++ b/.github/workflows/end-to-end-tests.yaml @@ -68,18 +68,20 @@ jobs: run: scripts/layered.sh - name: Copy config + working-directory: apps/web run: cp element.io/develop/config.json config.json - name: Build env: CI_PACKAGE: true + working-directory: apps/web run: VERSION=$(scripts/get-version-from-git.sh) pnpm build - name: Upload Artifact uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 with: name: webapp - path: webapp + path: apps/web/webapp retention-days: 1 - name: Calculate runner variables @@ -133,7 +135,7 @@ jobs: uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7 with: name: webapp - path: webapp + path: apps/web/webapp - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4 - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6 @@ -167,6 +169,7 @@ jobs: # We skip tests tagged with @mergequeue when running on PRs, but run them in MQ and everywhere else - name: Run Playwright tests + working-directory: apps/web run: | pnpm playwright test \ --shard "${{ matrix.runner }}/${{ needs.build.outputs.num-runners }}" \ @@ -178,7 +181,7 @@ jobs: uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 with: name: all-blob-reports-${{ matrix.project }}-${{ matrix.runner }} - path: blob-report + path: apps/web/blob-report retention-days: 1 downstream-modules: @@ -225,7 +228,7 @@ jobs: - name: Merge into HTML Report if: inputs.skip != true - run: pnpm playwright merge-reports --reporter=html,./playwright/flaky-reporter.ts,@element-hq/element-web-playwright-common/lib/stale-screenshot-reporter.js ./all-blob-reports + run: pnpm playwright merge-reports --reporter=html,./apps/web/playwright/flaky-reporter.ts,@element-hq/element-web-playwright-common/lib/stale-screenshot-reporter.js ./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 || '' }} diff --git a/.github/workflows/release-gitflow.yml b/.github/workflows/release-gitflow.yml index 128c6a1e05..a776a12987 100644 --- a/.github/workflows/release-gitflow.yml +++ b/.github/workflows/release-gitflow.yml @@ -11,5 +11,6 @@ jobs: secrets: ELEMENT_BOT_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }} with: + dir: apps/web dependencies: | matrix-js-sdk diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 78383e8bf5..c182aa8661 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,6 +29,7 @@ jobs: gpg-fingerprint: ${{ vars.GPG_FINGERPRINT }} asset-path: dist/*.tar.gz expected-asset-count: 3 + dir: apps/web notify-downstream: name: Trigger release drafter downstream diff --git a/.github/workflows/static_analysis.yaml b/.github/workflows/static_analysis.yaml index dec51c2754..5409d55b8a 100644 --- a/.github/workflows/static_analysis.yaml +++ b/.github/workflows/static_analysis.yaml @@ -27,6 +27,9 @@ jobs: - name: Typescript Syntax Check install: layered command: "lint:types" + - name: Prettier + install: normal + command: "lint:prettier" - name: ESLint install: normal command: "lint:js" @@ -62,7 +65,7 @@ jobs: run: "pnpm install --frozen-lockfile" - name: Run ${{ matrix.command }} - run: pnpm run "$CMD" && pnpm -r --if-present run "$CMD" + run: pnpm --if-present run "$CMD" && pnpm -r --if-present run "$CMD" env: CMD: ${{ matrix.command }} @@ -76,6 +79,7 @@ jobs: matrix: include: - name: Element Web + path: "apps/web" allowed-hardcoded-keys: | console_dev_note labs|element_call_video_rooms diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f4542684ea..1623f6cc32 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -67,6 +67,7 @@ jobs: uses: SimenB/github-actions-cpu-cores@97ba232459a8e02ff6121db9362b09661c875ab8 # v2 - name: Run tests + working-directory: apps/web run: | pnpm test \ --coverage=${{ env.ENABLE_COVERAGE }} \ @@ -82,6 +83,7 @@ jobs: - name: Move coverage files into place if: env.ENABLE_COVERAGE == 'true' + working-directory: apps/web run: mv coverage/lcov.info coverage/${{ steps.setupNode.outputs.node-version }}-${{ matrix.runner }}.lcov.info - name: Upload Artifact @@ -90,8 +92,8 @@ jobs: with: name: coverage-${{ matrix.runner }} path: | - coverage - !coverage/lcov-report + apps/web/coverage + !apps/web/coverage/lcov-report complete: name: jest-tests diff --git a/.github/workflows/update-jitsi.yml b/.github/workflows/update-jitsi.yml index ed35450e8a..f4f4409190 100644 --- a/.github/workflows/update-jitsi.yml +++ b/.github/workflows/update-jitsi.yml @@ -21,6 +21,7 @@ jobs: run: "pnpm install --frozen-lockfile" - name: Fetch Jitsi + working-directory: apps/web run: "pnpm vendor:jitsi" - name: Create Pull Request diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index ad36b7255d..0402e9c0a6 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -17,7 +17,7 @@ RUN pnpm install RUN /src/scripts/docker-package.sh # Copy the config now so that we don't create another layer in the app image -RUN cp /src/config.sample.json /src/webapp/config.json +RUN cp /src/apps/web/config.sample.json /src/apps/web/webapp/config.json # App FROM nginxinc/nginx-unprivileged:alpine-slim@sha256:c9448f9aaf2dee3dccfe0d2e51d6927cc9fbfdbcada66b0b01c0759816d86a5b @@ -28,12 +28,12 @@ USER root # Install jq and moreutils for sponge, both used by our entrypoints RUN apk add jq moreutils -COPY --from=builder /src/webapp /app +COPY --from=builder /src/apps/web/webapp /app # Override default nginx config. Templates in `/etc/nginx/templates` are passed # through `envsubst` by the nginx docker image entry point. -COPY /docker/nginx-templates/* /etc/nginx/templates/ -COPY /docker/docker-entrypoint.d/* /docker-entrypoint.d/ +COPY /apps/web/docker/nginx-templates/* /etc/nginx/templates/ +COPY /apps/web/docker/docker-entrypoint.d/* /docker-entrypoint.d/ RUN rm -rf /usr/share/nginx/html \ && ln -s /app /usr/share/nginx/html