Browse Source
* Tidy workflows * Update get-version-from-git.sh * Run tests in Actions * Upload coverage to SonarCloud * Run linters in Actions * Run builds in Actions, consolidating with sentry uploader * Update sonar-project.properties * chmod +x * Iterate * Use new env vars * Delete yarn-sub.js * Use re-usable sonarqube action * Add README badges * Match realitypull/22223/head
18 changed files with 384 additions and 131 deletions
@ -0,0 +1,26 @@
|
||||
name: Build and Package |
||||
on: |
||||
pull_request: { } |
||||
push: |
||||
branches: [ master ] |
||||
# develop pushes and repository_dispatch handled in build_develop.yaml |
||||
env: |
||||
# These must be set for fetchdep.sh to get the right branch |
||||
REPOSITORY: ${{ github.repository }} |
||||
PR_NUMBER: ${{ github.event.pull_request.number }} |
||||
jobs: |
||||
build: |
||||
name: "Build" |
||||
runs-on: ubuntu-latest |
||||
steps: |
||||
- uses: actions/checkout@v2 |
||||
|
||||
- uses: actions/setup-node@v3 |
||||
with: |
||||
cache: 'yarn' |
||||
|
||||
- name: Install Dependencies |
||||
run: "./scripts/layered.sh" |
||||
|
||||
- name: Build & Package |
||||
run: "./scripts/ci_package.sh" |
@ -0,0 +1,31 @@
|
||||
# Separate to the main build workflow for access to develop |
||||
# environment secrets, largely similar to build.yaml. |
||||
name: Build and Package develop |
||||
on: |
||||
push: |
||||
branches: [ develop ] |
||||
repository_dispatch: |
||||
types: [ element-web-notify ] |
||||
jobs: |
||||
build: |
||||
name: "Build & Upload source maps to Sentry" |
||||
runs-on: ubuntu-latest |
||||
environment: develop |
||||
steps: |
||||
- uses: actions/checkout@v2 |
||||
|
||||
- uses: actions/setup-node@v3 |
||||
with: |
||||
cache: 'yarn' |
||||
|
||||
- name: Install Dependencies |
||||
run: "./scripts/layered.sh" |
||||
|
||||
- name: Build, Package & Upload sourcemaps |
||||
run: "./scripts/ci_package.sh" |
||||
env: |
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} |
||||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} |
||||
SENTRY_URL: ${{ secrets.SENTRY_URL }} |
||||
SENTRY_ORG: sentry |
||||
SENTRY_PROJECT: riot-web |
@ -1,26 +0,0 @@
|
||||
name: Upload Sentry Sourcemaps |
||||
on: |
||||
push: |
||||
branches: |
||||
- develop |
||||
repository_dispatch: |
||||
types: [ element-web-notify ] |
||||
jobs: |
||||
upload-sentry-sourcemaps: |
||||
runs-on: ubuntu-latest |
||||
environment: develop |
||||
steps: |
||||
- uses: actions/checkout@v2 |
||||
- uses: actions/setup-node@v2 |
||||
with: |
||||
node-version: '14' |
||||
cache: 'yarn' |
||||
- run: ./scripts/fetch-develop.deps.sh --depth 1 |
||||
- run: yarn install |
||||
- run: ./scripts/ci_package.sh |
||||
env: |
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} |
||||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} |
||||
SENTRY_URL: ${{ secrets.SENTRY_URL }} |
||||
SENTRY_ORG: sentry |
||||
SENTRY_PROJECT: riot-web |
@ -0,0 +1,94 @@
|
||||
name: Static Analysis |
||||
on: |
||||
pull_request: { } |
||||
push: |
||||
branches: [ develop, master ] |
||||
repository_dispatch: |
||||
types: [ element-web-notify ] |
||||
env: |
||||
# These must be set for fetchdep.sh to get the right branch |
||||
REPOSITORY: ${{ github.repository }} |
||||
PR_NUMBER: ${{ github.event.pull_request.number }} |
||||
jobs: |
||||
ts_lint: |
||||
name: "Typescript Syntax Check" |
||||
runs-on: ubuntu-latest |
||||
steps: |
||||
- uses: actions/checkout@v2 |
||||
|
||||
- uses: actions/setup-node@v3 |
||||
with: |
||||
cache: 'yarn' |
||||
|
||||
- name: Install Dependencies |
||||
run: "./scripts/layered.sh" |
||||
|
||||
- name: Typecheck |
||||
run: "yarn run lint:types" |
||||
|
||||
i18n_lint: |
||||
name: "i18n Check" |
||||
runs-on: ubuntu-latest |
||||
permissions: |
||||
pull-requests: read |
||||
steps: |
||||
- uses: actions/checkout@v2 |
||||
|
||||
- name: "Get modified files" |
||||
id: changed_files |
||||
if: github.event_name == 'pull_request' |
||||
uses: tj-actions/changed-files@v19 |
||||
with: |
||||
files: | |
||||
src/i18n/strings/* |
||||
files_ignore: | |
||||
src/i18n/strings/en_EN.json |
||||
- name: "Assert only en_EN was modified" |
||||
if: github.event_name == 'pull_request' && steps.changed_files.outputs.any_modified == 'true' |
||||
run: | |
||||
echo "You can only modify en_EN.json, do not touch any of the other i18n files as Weblate will be confused" |
||||
exit 1 |
||||
- uses: actions/setup-node@v3 |
||||
with: |
||||
cache: 'yarn' |
||||
|
||||
# Does not need branch matching as only analyses this layer |
||||
- name: Install Deps |
||||
run: "yarn install --pure-lockfile" |
||||
|
||||
- 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 --pure-lockfile" |
||||
|
||||
- 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 --pure-lockfile" |
||||
|
||||
- name: Run Linter |
||||
run: "yarn run lint:style" |
@ -0,0 +1,37 @@
|
||||
name: Tests |
||||
on: |
||||
pull_request: { } |
||||
push: |
||||
branches: [ develop, master ] |
||||
repository_dispatch: |
||||
types: [ element-web-notify ] |
||||
env: |
||||
# These must be set for fetchdep.sh to get the right branch |
||||
REPOSITORY: ${{ github.repository }} |
||||
PR_NUMBER: ${{ github.event.pull_request.number }} |
||||
jobs: |
||||
jest: |
||||
name: Jest |
||||
runs-on: ubuntu-latest |
||||
steps: |
||||
- name: Checkout code |
||||
uses: actions/checkout@v2 |
||||
|
||||
- name: Yarn cache |
||||
uses: actions/setup-node@v3 |
||||
with: |
||||
cache: 'yarn' |
||||
|
||||
- name: Install Dependencies |
||||
run: "./scripts/layered.sh" |
||||
|
||||
- name: Run tests with coverage |
||||
run: "yarn coverage --ci" |
||||
|
||||
- name: Upload Artifact |
||||
uses: actions/upload-artifact@v2 |
||||
with: |
||||
name: coverage |
||||
path: | |
||||
coverage |
||||
!coverage/lcov-report |
@ -0,0 +1,49 @@
|
||||
#!/bin/bash |
||||
|
||||
set -x |
||||
|
||||
# Creates a layered environment with the full repo for the app and SDKs cloned |
||||
# and linked. This gives an element-web dev environment ready to build with |
||||
# matching branches of react-sdk's dependencies so that changes can be tested |
||||
# in element-web. |
||||
|
||||
# Note that this style is different from the recommended developer setup: this |
||||
# file nests js-sdk and matrix-react-sdk inside element-web, while the local |
||||
# development setup places them all at the same level. We are nesting them here |
||||
# because some CI systems do not allow moving to a directory above the checkout |
||||
# for the primary repo (element-web in this case). |
||||
|
||||
# Install dependencies, as we'll be using fetchdep.sh from matrix-react-sdk |
||||
yarn install --pure-lockfile |
||||
|
||||
# Pass appropriate repo to fetchdep.sh |
||||
export PR_ORG=vector-im |
||||
export PR_REPO=element-web |
||||
|
||||
# Set up the js-sdk first |
||||
node_modules/matrix-react-sdk/scripts/fetchdep.sh matrix-org matrix-js-sdk |
||||
pushd matrix-js-sdk |
||||
yarn link |
||||
yarn install --pure-lockfile |
||||
popd |
||||
|
||||
# Also set up matrix-analytics-events so we get the latest from |
||||
# the main branch or a branch with matching name |
||||
node_modules/matrix-react-sdk/scripts/fetchdep.sh matrix-org matrix-analytics-events main |
||||
pushd matrix-analytics-events |
||||
yarn link |
||||
yarn install --pure-lockfile |
||||
popd |
||||
|
||||
# Now set up the react-sdk |
||||
node_modules/matrix-react-sdk/scripts/fetchdep.sh matrix-org matrix-react-sdk |
||||
pushd matrix-react-sdk |
||||
yarn link |
||||
yarn link matrix-js-sdk |
||||
yarn link matrix-analytics-events |
||||
yarn install --pure-lockfile |
||||
popd |
||||
|
||||
# Link the layers into element-web |
||||
yarn link matrix-js-sdk |
||||
yarn link matrix-react-sdk |
@ -1,22 +0,0 @@
|
||||
const path = require('path'); |
||||
const child_process = require('child_process'); |
||||
|
||||
const moduleName = process.argv[2]; |
||||
if (!moduleName) { |
||||
console.error("Expected module name"); |
||||
process.exit(1); |
||||
} |
||||
|
||||
const argString = process.argv.length > 3 ? process.argv.slice(3).join(" ") : ""; |
||||
if (!argString) { |
||||
console.error("Expected an yarn argument string to use"); |
||||
process.exit(1); |
||||
} |
||||
|
||||
const modulePath = path.dirname(require.resolve(`${moduleName}/package.json`)); |
||||
|
||||
child_process.execSync("yarn " + argString, { |
||||
env: process.env, |
||||
cwd: modulePath, |
||||
stdio: ['inherit', 'inherit', 'inherit'], |
||||
}); |
@ -0,0 +1,14 @@
|
||||
sonar.projectKey=element-web |
||||
sonar.organization=new_vector_ltd_organization |
||||
|
||||
# Encoding of the source code. Default is default system encoding |
||||
#sonar.sourceEncoding=UTF-8 |
||||
|
||||
sonar.sources=src,res |
||||
sonar.tests=test |
||||
sonar.exclusions=__mocks__,docs,element.io,nginx |
||||
|
||||
sonar.typescript.tsconfigPath=./tsconfig.json |
||||
sonar.javascript.lcov.reportPaths=coverage/lcov.info |
||||
sonar.coverage.exclusions=test/**/* |
||||
sonar.testExecutionReportPaths=coverage/test-report.xml |
Loading…
Reference in new issue