This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 833
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
1,539 additions
and
1,086 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,58 @@ | ||
name: End-to-end Tests | ||
on: | ||
# These tests won't work for non-develop branches at the moment as they | ||
# won't pull in the right versions of other repos, so they're only enabled | ||
# on develop. | ||
push: | ||
branches: [develop] | ||
pull_request: | ||
branches: [develop] | ||
# These tests won't work for non-develop branches at the moment as they | ||
# won't pull in the right versions of other repos, so they're only enabled | ||
# on develop. | ||
push: | ||
branches: [ develop ] | ||
pull_request: | ||
branches: [ develop ] | ||
repository_dispatch: | ||
types: [ upstream-sdk-notify ] | ||
jobs: | ||
end-to-end: | ||
runs-on: ubuntu-latest | ||
env: | ||
# This must be set for fetchdep.sh to get the right branch | ||
PR_NUMBER: ${{github.event.number}} | ||
container: vectorim/element-web-ci-e2etests-env:latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Prepare End-to-End tests | ||
run: ./scripts/ci/prepare-end-to-end-tests.sh | ||
- name: Run End-to-End tests | ||
run: ./scripts/ci/run-end-to-end-tests.sh | ||
- name: Archive logs | ||
uses: actions/upload-artifact@v2 | ||
if: ${{ always() }} | ||
with: | ||
path: | | ||
test/end-to-end-tests/logs/**/* | ||
test/end-to-end-tests/synapse/installations/consent/homeserver.log | ||
retention-days: 14 | ||
- name: Download previous benchmark data | ||
uses: actions/cache@v1 | ||
with: | ||
path: ./cache | ||
key: ${{ runner.os }}-benchmark | ||
- name: Store benchmark result | ||
uses: matrix-org/github-action-benchmark@jsperfentry-1 | ||
with: | ||
tool: 'jsperformanceentry' | ||
output-file-path: test/end-to-end-tests/performance-entries.json | ||
fail-on-alert: false | ||
comment-on-alert: false | ||
# Only temporary to monitor where failures occur | ||
alert-comment-cc-users: '@gsouquet' | ||
github-token: ${{ secrets.DEPLOY_GH_PAGES }} | ||
auto-push: ${{ github.ref == 'refs/heads/develop' }} | ||
end-to-end: | ||
runs-on: ubuntu-latest | ||
env: | ||
# This must be set for fetchdep.sh to get the right branch | ||
PR_NUMBER: ${{github.event.number}} | ||
container: vectorim/element-web-ci-e2etests-env:latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: 'yarn' | ||
|
||
- name: Prepare End-to-End tests | ||
run: ./scripts/ci/prepare-end-to-end-tests.sh | ||
|
||
- name: Run End-to-End tests | ||
run: ./scripts/ci/run-end-to-end-tests.sh | ||
|
||
- name: Archive logs | ||
uses: actions/upload-artifact@v2 | ||
if: ${{ always() }} | ||
with: | ||
path: | | ||
test/end-to-end-tests/logs/**/* | ||
test/end-to-end-tests/synapse/installations/consent/homeserver.log | ||
retention-days: 14 | ||
- name: Download previous benchmark data | ||
uses: actions/cache@v1 | ||
with: | ||
path: ./cache | ||
key: ${{ runner.os }}-benchmark | ||
|
||
- name: Store benchmark result | ||
uses: matrix-org/github-action-benchmark@jsperfentry-1 | ||
with: | ||
tool: 'jsperformanceentry' | ||
output-file-path: test/end-to-end-tests/performance-entries.json | ||
fail-on-alert: false | ||
comment-on-alert: false | ||
# Only temporary to monitor where failures occur | ||
alert-comment-cc-users: '@gsouquet' | ||
github-token: ${{ secrets.DEPLOY_GH_PAGES }} | ||
auto-push: ${{ github.ref == 'refs/heads/develop' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,76 +2,79 @@ | |
# and uploading it to netlify | ||
name: Upload Preview Build to Netlify | ||
on: | ||
workflow_run: | ||
workflows: ["Element Web - Build and Test"] | ||
types: | ||
- completed | ||
workflow_run: | ||
workflows: [ "Element Web - Build and Test" ] | ||
types: | ||
- completed | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: > | ||
${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }} | ||
steps: | ||
- name: "🔍 Read PR number" | ||
id: readctx | ||
# we need to find the PR number that corresponds to the branch, which we do by | ||
# searching the GH API | ||
# The workflow_run event includes a list of pull requests, but it doesn't get populated for | ||
# forked PRs: https://docs.github.com/en/rest/reference/checks#create-a-check-run | ||
run: | | ||
head_branch='${{github.event.workflow_run.head_repository.owner.login}}:${{github.event.workflow_run.head_branch}}' | ||
echo "head branch: $head_branch" | ||
pulls_uri="https://api.github.com/repos/${{ github.repository }}/pulls?head=$(jq -Rr '@uri' <<<$head_branch)" | ||
pr_number=$(curl -s -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' "$pulls_uri" | | ||
jq -r '.[] | .number') | ||
echo "PR number: $pr_number" | ||
echo "::set-output name=prnumber::$pr_number" | ||
# There's a 'download artifact' action but it hasn't been updated for the | ||
# workflow_run action (https://github.com/actions/download-artifact/issues/60) | ||
# so instead we get this mess: | ||
- name: 'Download artifact' | ||
uses: actions/[email protected] | ||
with: | ||
script: | | ||
var artifacts = await github.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: ${{github.event.workflow_run.id }}, | ||
}); | ||
var matchArtifact = artifacts.data.artifacts.filter((artifact) => { | ||
return artifact.name == "previewbuild" | ||
})[0]; | ||
var download = await github.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifact.id, | ||
archive_format: 'zip', | ||
}); | ||
var fs = require('fs'); | ||
fs.writeFileSync('${{github.workspace}}/previewbuild.zip', Buffer.from(download.data)); | ||
- name: Extract Artifacts | ||
run: unzip -d webapp previewbuild.zip && rm previewbuild.zip | ||
- name: Deploy to Netlify | ||
id: netlify | ||
uses: nwtgck/[email protected] | ||
with: | ||
publish-dir: webapp | ||
deploy-message: "Deploy from GitHub Actions" | ||
# These don't work because we're in workflow_run | ||
enable-pull-request-comment: false | ||
enable-commit-comment: false | ||
alias: pr${{ steps.readctx.outputs.prnumber }} | ||
env: | ||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | ||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | ||
timeout-minutes: 1 | ||
- name: Edit PR Description | ||
uses: Beakyn/gha-comment-pull-request@2167a7aee24f9e61ce76a23039f322e49a990409 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
pull-request-number: ${{ steps.readctx.outputs.prnumber }} | ||
description-message: | | ||
Preview: ${{ steps.netlify.outputs.deploy-url }} | ||
⚠️ Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts. | ||
build: | ||
runs-on: ubuntu-latest | ||
if: > | ||
${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }} | ||
steps: | ||
- name: "🔍 Read PR number" | ||
id: readctx | ||
# we need to find the PR number that corresponds to the branch, which we do by | ||
# searching the GH API | ||
# The workflow_run event includes a list of pull requests, but it doesn't get populated for | ||
# forked PRs: https://docs.github.com/en/rest/reference/checks#create-a-check-run | ||
run: | | ||
head_branch='${{github.event.workflow_run.head_repository.owner.login}}:${{github.event.workflow_run.head_branch}}' | ||
echo "head branch: $head_branch" | ||
pulls_uri="https://api.github.com/repos/${{ github.repository }}/pulls?head=$(jq -Rr '@uri' <<<$head_branch)" | ||
pr_number=$(curl -s -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' "$pulls_uri" | | ||
jq -r '.[] | .number') | ||
echo "PR number: $pr_number" | ||
echo "::set-output name=prnumber::$pr_number" | ||
# There's a 'download artifact' action but it hasn't been updated for the | ||
# workflow_run action (https://github.com/actions/download-artifact/issues/60) | ||
# so instead we get this mess: | ||
- name: 'Download artifact' | ||
uses: actions/[email protected] | ||
with: | ||
script: | | ||
var artifacts = await github.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: ${{github.event.workflow_run.id }}, | ||
}); | ||
var matchArtifact = artifacts.data.artifacts.filter((artifact) => { | ||
return artifact.name == "previewbuild" | ||
})[0]; | ||
var download = await github.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifact.id, | ||
archive_format: 'zip', | ||
}); | ||
var fs = require('fs'); | ||
fs.writeFileSync('${{github.workspace}}/previewbuild.zip', Buffer.from(download.data)); | ||
- name: Extract Artifacts | ||
run: unzip -d webapp previewbuild.zip && rm previewbuild.zip | ||
|
||
- name: Deploy to Netlify | ||
id: netlify | ||
uses: nwtgck/[email protected] | ||
with: | ||
publish-dir: webapp | ||
deploy-message: "Deploy from GitHub Actions" | ||
# These don't work because we're in workflow_run | ||
enable-pull-request-comment: false | ||
enable-commit-comment: false | ||
alias: pr${{ steps.readctx.outputs.prnumber }} | ||
env: | ||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | ||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | ||
timeout-minutes: 1 | ||
|
||
- name: Edit PR Description | ||
uses: Beakyn/gha-comment-pull-request@2167a7aee24f9e61ce76a23039f322e49a990409 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
pull-request-number: ${{ steps.readctx.outputs.prnumber }} | ||
description-message: | | ||
Preview: ${{ steps.netlify.outputs.deploy-url }} | ||
⚠️ Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts. |
Oops, something went wrong.