Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit aa7bd70

Browse files
authored
Merge branch 'develop' into AccessSecretStorageDialog
2 parents c326943 + 146bcdd commit aa7bd70

File tree

9 files changed

+336
-210
lines changed

9 files changed

+336
-210
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ insert_final_newline = true
2121
indent_style = space
2222
indent_size = 4
2323
trim_trailing_whitespace = true
24+
25+
[*.{yml,yaml}]
26+
indent_size = 2

.github/workflows/element-build-and-test.yaml

Lines changed: 83 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,87 @@
33
# as an artifact and run integration tests.
44
name: Element Web - Build and Test
55
on:
6-
pull_request:
6+
pull_request: { }
7+
push:
8+
branches: [ develop, master ]
9+
repository_dispatch:
10+
types: [ upstream-sdk-notify ]
711
jobs:
8-
build:
9-
runs-on: ubuntu-latest
10-
env:
11-
# This must be set for fetchdep.sh to get the right branch
12-
PR_NUMBER: ${{github.event.number}}
13-
steps:
14-
- uses: actions/checkout@v2
15-
- name: Build
16-
run: scripts/ci/layered.sh && cd element-web && cp element.io/develop/config.json config.json && CI_PACKAGE=true yarn build
17-
- name: Upload Artifact
18-
uses: actions/upload-artifact@v2
19-
with:
20-
name: previewbuild
21-
path: element-web/webapp
22-
# We'll only use this in a triggered job, then we're done with it
23-
retention-days: 1
24-
cypress:
25-
needs: build
26-
runs-on: ubuntu-latest
27-
steps:
28-
- uses: actions/checkout@v2
29-
- name: Download build
30-
uses: actions/download-artifact@v3
31-
with:
32-
name: previewbuild
33-
path: webapp
34-
- name: Run Cypress tests
35-
uses: cypress-io/github-action@v2
36-
with:
37-
# The built in Electron runner seems to grind to a halt trying
38-
# to run the tests, so use chrome.
39-
browser: chrome
40-
start: npx serve -p 8080 webapp
41-
- name: Upload Artifact
42-
if: failure()
43-
uses: actions/upload-artifact@v2
44-
with:
45-
name: cypress-results
46-
path: |
47-
cypress/screenshots
48-
cypress/videos
49-
cypress/synapselogs
12+
build:
13+
name: "Build Element-Web"
14+
runs-on: ubuntu-latest
15+
env:
16+
# This must be set for fetchdep.sh to get the right branch
17+
PR_NUMBER: ${{github.event.number}}
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- uses: actions/setup-node@v3
22+
with:
23+
cache: 'yarn'
24+
25+
- name: Fetch layered build
26+
run: scripts/ci/layered.sh
27+
28+
- name: Copy config
29+
run: cp element.io/develop/config.json config.json
30+
working-directory: ./element-web
31+
32+
- name: Build
33+
run: CI_PACKAGE=true yarn build
34+
working-directory: ./element-web
35+
36+
- name: Upload Artifact
37+
uses: actions/upload-artifact@v2
38+
with:
39+
name: previewbuild
40+
path: element-web/webapp
41+
# We'll only use this in a triggered job, then we're done with it
42+
retention-days: 1
43+
44+
cypress:
45+
name: "Cypress End to End Tests"
46+
needs: build
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v2
50+
51+
- name: Download build
52+
uses: actions/download-artifact@v3
53+
with:
54+
name: previewbuild
55+
path: webapp
56+
57+
- name: Run Cypress tests
58+
uses: cypress-io/github-action@v2
59+
with:
60+
# The built in Electron runner seems to grind to a halt trying
61+
# to run the tests, so use chrome.
62+
browser: chrome
63+
start: npx serve -p 8080 webapp
64+
65+
- name: Upload Artifact
66+
if: failure()
67+
uses: actions/upload-artifact@v2
68+
with:
69+
name: cypress-results
70+
path: |
71+
cypress/screenshots
72+
cypress/videos
73+
cypress/synapselogs
74+
75+
app-tests:
76+
name: Element Web Integration Tests
77+
runs-on: ubuntu-latest
78+
env:
79+
# This must be set for fetchdep.sh to get the right branch
80+
PR_NUMBER: ${{github.event.number}}
81+
steps:
82+
- uses: actions/checkout@v2
83+
84+
- uses: actions/setup-node@v3
85+
with:
86+
cache: 'yarn'
87+
88+
- name: Run tests
89+
run: "./scripts/ci/app-tests.sh"
Lines changed: 55 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,58 @@
11
name: End-to-end Tests
22
on:
3-
# These tests won't work for non-develop branches at the moment as they
4-
# won't pull in the right versions of other repos, so they're only enabled
5-
# on develop.
6-
push:
7-
branches: [develop]
8-
pull_request:
9-
branches: [develop]
3+
# These tests won't work for non-develop branches at the moment as they
4+
# won't pull in the right versions of other repos, so they're only enabled
5+
# on develop.
6+
push:
7+
branches: [ develop ]
8+
pull_request:
9+
branches: [ develop ]
10+
repository_dispatch:
11+
types: [ upstream-sdk-notify ]
1012
jobs:
11-
end-to-end:
12-
runs-on: ubuntu-latest
13-
env:
14-
# This must be set for fetchdep.sh to get the right branch
15-
PR_NUMBER: ${{github.event.number}}
16-
container: vectorim/element-web-ci-e2etests-env:latest
17-
steps:
18-
- name: Checkout code
19-
uses: actions/checkout@v2
20-
- name: Prepare End-to-End tests
21-
run: ./scripts/ci/prepare-end-to-end-tests.sh
22-
- name: Run End-to-End tests
23-
run: ./scripts/ci/run-end-to-end-tests.sh
24-
- name: Archive logs
25-
uses: actions/upload-artifact@v2
26-
if: ${{ always() }}
27-
with:
28-
path: |
29-
test/end-to-end-tests/logs/**/*
30-
test/end-to-end-tests/synapse/installations/consent/homeserver.log
31-
retention-days: 14
32-
- name: Download previous benchmark data
33-
uses: actions/cache@v1
34-
with:
35-
path: ./cache
36-
key: ${{ runner.os }}-benchmark
37-
- name: Store benchmark result
38-
uses: matrix-org/github-action-benchmark@jsperfentry-1
39-
with:
40-
tool: 'jsperformanceentry'
41-
output-file-path: test/end-to-end-tests/performance-entries.json
42-
fail-on-alert: false
43-
comment-on-alert: false
44-
# Only temporary to monitor where failures occur
45-
alert-comment-cc-users: '@gsouquet'
46-
github-token: ${{ secrets.DEPLOY_GH_PAGES }}
47-
auto-push: ${{ github.ref == 'refs/heads/develop' }}
13+
end-to-end:
14+
runs-on: ubuntu-latest
15+
env:
16+
# This must be set for fetchdep.sh to get the right branch
17+
PR_NUMBER: ${{github.event.number}}
18+
container: vectorim/element-web-ci-e2etests-env:latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v2
22+
23+
- uses: actions/setup-node@v3
24+
with:
25+
cache: 'yarn'
26+
27+
- name: Prepare End-to-End tests
28+
run: ./scripts/ci/prepare-end-to-end-tests.sh
29+
30+
- name: Run End-to-End tests
31+
run: ./scripts/ci/run-end-to-end-tests.sh
32+
33+
- name: Archive logs
34+
uses: actions/upload-artifact@v2
35+
if: ${{ always() }}
36+
with:
37+
path: |
38+
test/end-to-end-tests/logs/**/*
39+
test/end-to-end-tests/synapse/installations/consent/homeserver.log
40+
retention-days: 14
41+
42+
- name: Download previous benchmark data
43+
uses: actions/cache@v1
44+
with:
45+
path: ./cache
46+
key: ${{ runner.os }}-benchmark
47+
48+
- name: Store benchmark result
49+
uses: matrix-org/github-action-benchmark@jsperfentry-1
50+
with:
51+
tool: 'jsperformanceentry'
52+
output-file-path: test/end-to-end-tests/performance-entries.json
53+
fail-on-alert: false
54+
comment-on-alert: false
55+
# Only temporary to monitor where failures occur
56+
alert-comment-cc-users: '@gsouquet'
57+
github-token: ${{ secrets.DEPLOY_GH_PAGES }}
58+
auto-push: ${{ github.ref == 'refs/heads/develop' }}

.github/workflows/netlify.yaml

Lines changed: 74 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2,76 +2,79 @@
22
# and uploading it to netlify
33
name: Upload Preview Build to Netlify
44
on:
5-
workflow_run:
6-
workflows: ["Element Web - Build and Test"]
7-
types:
8-
- completed
5+
workflow_run:
6+
workflows: [ "Element Web - Build and Test" ]
7+
types:
8+
- completed
99
jobs:
10-
build:
11-
runs-on: ubuntu-latest
12-
if: >
13-
${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }}
14-
steps:
15-
- name: "🔍 Read PR number"
16-
id: readctx
17-
# we need to find the PR number that corresponds to the branch, which we do by
18-
# searching the GH API
19-
# The workflow_run event includes a list of pull requests, but it doesn't get populated for
20-
# forked PRs: https://docs.github.com/en/rest/reference/checks#create-a-check-run
21-
run: |
22-
head_branch='${{github.event.workflow_run.head_repository.owner.login}}:${{github.event.workflow_run.head_branch}}'
23-
echo "head branch: $head_branch"
24-
pulls_uri="https://api.github.com/repos/${{ github.repository }}/pulls?head=$(jq -Rr '@uri' <<<$head_branch)"
25-
pr_number=$(curl -s -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' "$pulls_uri" |
26-
jq -r '.[] | .number')
27-
echo "PR number: $pr_number"
28-
echo "::set-output name=prnumber::$pr_number"
29-
# There's a 'download artifact' action but it hasn't been updated for the
30-
# workflow_run action (https://github.com/actions/download-artifact/issues/60)
31-
# so instead we get this mess:
32-
- name: 'Download artifact'
33-
uses: actions/[email protected]
34-
with:
35-
script: |
36-
var artifacts = await github.actions.listWorkflowRunArtifacts({
37-
owner: context.repo.owner,
38-
repo: context.repo.repo,
39-
run_id: ${{github.event.workflow_run.id }},
40-
});
41-
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
42-
return artifact.name == "previewbuild"
43-
})[0];
44-
var download = await github.actions.downloadArtifact({
45-
owner: context.repo.owner,
46-
repo: context.repo.repo,
47-
artifact_id: matchArtifact.id,
48-
archive_format: 'zip',
49-
});
50-
var fs = require('fs');
51-
fs.writeFileSync('${{github.workspace}}/previewbuild.zip', Buffer.from(download.data));
52-
- name: Extract Artifacts
53-
run: unzip -d webapp previewbuild.zip && rm previewbuild.zip
54-
- name: Deploy to Netlify
55-
id: netlify
56-
uses: nwtgck/[email protected]
57-
with:
58-
publish-dir: webapp
59-
deploy-message: "Deploy from GitHub Actions"
60-
# These don't work because we're in workflow_run
61-
enable-pull-request-comment: false
62-
enable-commit-comment: false
63-
alias: pr${{ steps.readctx.outputs.prnumber }}
64-
env:
65-
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
66-
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
67-
timeout-minutes: 1
68-
- name: Edit PR Description
69-
uses: Beakyn/gha-comment-pull-request@2167a7aee24f9e61ce76a23039f322e49a990409
70-
env:
71-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72-
with:
73-
pull-request-number: ${{ steps.readctx.outputs.prnumber }}
74-
description-message: |
75-
Preview: ${{ steps.netlify.outputs.deploy-url }}
76-
⚠️ Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts.
10+
build:
11+
runs-on: ubuntu-latest
12+
if: >
13+
${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }}
14+
steps:
15+
- name: "🔍 Read PR number"
16+
id: readctx
17+
# we need to find the PR number that corresponds to the branch, which we do by
18+
# searching the GH API
19+
# The workflow_run event includes a list of pull requests, but it doesn't get populated for
20+
# forked PRs: https://docs.github.com/en/rest/reference/checks#create-a-check-run
21+
run: |
22+
head_branch='${{github.event.workflow_run.head_repository.owner.login}}:${{github.event.workflow_run.head_branch}}'
23+
echo "head branch: $head_branch"
24+
pulls_uri="https://api.github.com/repos/${{ github.repository }}/pulls?head=$(jq -Rr '@uri' <<<$head_branch)"
25+
pr_number=$(curl -s -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' "$pulls_uri" |
26+
jq -r '.[] | .number')
27+
echo "PR number: $pr_number"
28+
echo "::set-output name=prnumber::$pr_number"
7729
30+
# There's a 'download artifact' action but it hasn't been updated for the
31+
# workflow_run action (https://github.com/actions/download-artifact/issues/60)
32+
# so instead we get this mess:
33+
- name: 'Download artifact'
34+
uses: actions/[email protected]
35+
with:
36+
script: |
37+
var artifacts = await github.actions.listWorkflowRunArtifacts({
38+
owner: context.repo.owner,
39+
repo: context.repo.repo,
40+
run_id: ${{github.event.workflow_run.id }},
41+
});
42+
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
43+
return artifact.name == "previewbuild"
44+
})[0];
45+
var download = await github.actions.downloadArtifact({
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
artifact_id: matchArtifact.id,
49+
archive_format: 'zip',
50+
});
51+
var fs = require('fs');
52+
fs.writeFileSync('${{github.workspace}}/previewbuild.zip', Buffer.from(download.data));
53+
54+
- name: Extract Artifacts
55+
run: unzip -d webapp previewbuild.zip && rm previewbuild.zip
56+
57+
- name: Deploy to Netlify
58+
id: netlify
59+
uses: nwtgck/[email protected]
60+
with:
61+
publish-dir: webapp
62+
deploy-message: "Deploy from GitHub Actions"
63+
# These don't work because we're in workflow_run
64+
enable-pull-request-comment: false
65+
enable-commit-comment: false
66+
alias: pr${{ steps.readctx.outputs.prnumber }}
67+
env:
68+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
69+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
70+
timeout-minutes: 1
71+
72+
- name: Edit PR Description
73+
uses: Beakyn/gha-comment-pull-request@2167a7aee24f9e61ce76a23039f322e49a990409
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
with:
77+
pull-request-number: ${{ steps.readctx.outputs.prnumber }}
78+
description-message: |
79+
Preview: ${{ steps.netlify.outputs.deploy-url }}
80+
⚠️ Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts.

0 commit comments

Comments
 (0)