Move more stuff from BK to GHA (#8372)

pull/28217/head
Michael Telatynski 2022-04-21 12:55:32 +01:00 committed by GitHub
parent dd880df6ae
commit 146bcdd6a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 336 additions and 210 deletions

View File

@ -21,3 +21,6 @@ insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.{yml,yaml}]
indent_size = 2

View File

@ -3,17 +3,36 @@
# as an artifact and run integration tests.
name: Element Web - Build and Test
on:
pull_request:
pull_request: { }
push:
branches: [ develop, master ]
repository_dispatch:
types: [ upstream-sdk-notify ]
jobs:
build:
name: "Build Element-Web"
runs-on: ubuntu-latest
env:
# This must be set for fetchdep.sh to get the right branch
PR_NUMBER: ${{github.event.number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
cache: 'yarn'
- name: Fetch layered build
run: scripts/ci/layered.sh
- name: Copy config
run: cp element.io/develop/config.json config.json
working-directory: ./element-web
- name: Build
run: scripts/ci/layered.sh && cd element-web && cp element.io/develop/config.json config.json && CI_PACKAGE=true yarn build
run: CI_PACKAGE=true yarn build
working-directory: ./element-web
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
@ -21,16 +40,20 @@ jobs:
path: element-web/webapp
# We'll only use this in a triggered job, then we're done with it
retention-days: 1
cypress:
name: "Cypress End to End Tests"
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download build
uses: actions/download-artifact@v3
with:
name: previewbuild
path: webapp
- name: Run Cypress tests
uses: cypress-io/github-action@v2
with:
@ -38,6 +61,7 @@ jobs:
# to run the tests, so use chrome.
browser: chrome
start: npx serve -p 8080 webapp
- name: Upload Artifact
if: failure()
uses: actions/upload-artifact@v2
@ -47,3 +71,19 @@ jobs:
cypress/screenshots
cypress/videos
cypress/synapselogs
app-tests:
name: Element Web Integration Tests
runs-on: ubuntu-latest
env:
# This must be set for fetchdep.sh to get the right branch
PR_NUMBER: ${{github.event.number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
cache: 'yarn'
- name: Run tests
run: "./scripts/ci/app-tests.sh"

View File

@ -7,6 +7,8 @@ on:
branches: [ develop ]
pull_request:
branches: [ develop ]
repository_dispatch:
types: [ upstream-sdk-notify ]
jobs:
end-to-end:
runs-on: ubuntu-latest
@ -17,10 +19,17 @@ jobs:
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() }}
@ -29,11 +38,13 @@ jobs:
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:

View File

@ -26,6 +26,7 @@ jobs:
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:
@ -49,8 +50,10 @@ jobs:
});
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/actions-netlify@v1.2
@ -65,6 +68,7 @@ jobs:
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:
@ -74,4 +78,3 @@ jobs:
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.

View File

@ -2,14 +2,17 @@ name: Notify element-web
on:
push:
branches: [ develop ]
repository_dispatch:
types: [ upstream-sdk-notify ]
jobs:
notify-element-web:
name: "Notify Element Web"
runs-on: ubuntu-latest
environment: develop
steps:
- name: Notify element-web repo that a new SDK build is on develop
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.ELEMENT_WEB_NOTIFY_TOKEN }}
token: ${{ secrets.ELEMENT_BOT_TOKEN }}
repository: vector-im/element-web
event-type: element-web-notify

88
.github/workflows/static_analysis.yaml vendored Normal file
View File

@ -0,0 +1,88 @@
name: Static Analysis
on:
pull_request: { }
push:
branches: [ develop, master ]
repository_dispatch:
types: [ upstream-sdk-notify ]
jobs:
ts_lint:
name: "Typescript Syntax Check"
runs-on: ubuntu-latest
env:
# This must be set for fetchdep.sh to get the right branch
PR_NUMBER: ${{github.event.number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
cache: 'yarn'
- name: Install Deps
run: "./scripts/ci/install-deps.sh --ignore-scripts"
- name: Typecheck
run: "yarn run lint:types"
- name: Switch js-sdk to release mode
run: |
scripts/ci/js-sdk-to-release.js
cd node_modules/matrix-js-sdk
yarn install
yarn run build:compile
yarn run build:types
- name: Typecheck (release mode)
run: "yarn run lint:types"
i18n_lint:
name: "i18n Diff Check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
cache: 'yarn'
# Does not need branch matching as only analyses this layer
- name: Install Deps
run: "yarn install"
- name: i18n Check
run: "yarn run diff-i18n"
js_lint:
name: "ESLint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
cache: 'yarn'
# Does not need branch matching as only analyses this layer
- name: Install Deps
run: "yarn install"
- name: Run Linter
run: "yarn run lint:js"
style_lint:
name: "Style Lint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
cache: 'yarn'
# Does not need branch matching as only analyses this layer
- name: Install Deps
run: "yarn install"
- name: Run Linter
run: "yarn run lint:style"

View File

@ -1,10 +1,13 @@
name: Test coverage
name: Tests
on:
pull_request: { }
push:
branches: [develop, main, master]
branches: [ develop, master ]
repository_dispatch:
types: [ upstream-sdk-notify ]
jobs:
test-coverage:
jest:
name: Jest with Codecov
runs-on: ubuntu-latest
env:
# This must be set for fetchdep.sh to get the right branch
@ -19,13 +22,15 @@ jobs:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || '' }}
- name: Yarn cache
uses: c-hive/gha-yarn-cache@v2
uses: actions/setup-node@v3
with:
cache: 'yarn'
- name: Install Deps
run: "./scripts/ci/install-deps.sh --ignore-scripts"
- name: Run tests with coverage
run: "yarn install && yarn coverage"
run: "yarn coverage"
- name: Upload coverage
uses: codecov/codecov-action@v2

View File

@ -1,27 +0,0 @@
name: Type Check
on:
pull_request:
branches: [develop]
jobs:
build:
runs-on: ubuntu-latest
env:
# This must be set for fetchdep.sh to get the right branch
PR_NUMBER: ${{github.event.number}}
steps:
- uses: actions/checkout@v2
- uses: c-hive/gha-yarn-cache@v2
- name: Install Deps
run: "./scripts/ci/install-deps.sh --ignore-scripts"
- name: Typecheck
run: "yarn run lint:types"
- name: Switch js-sdk to release mode
run: |
scripts/ci/js-sdk-to-release.js
cd node_modules/matrix-js-sdk
yarn install
yarn run build:compile
yarn run build:types
- name: Typecheck (release mode)
run: "yarn run lint:types"