Attempt all of the CI

t3chguy/ci3
Michael Telatynski 2022-04-27 07:53:30 +01:00
parent 5adf38c87f
commit fe8c583e09
5 changed files with 203 additions and 9 deletions

42
.github/workflows/build.yaml vendored Normal file
View File

@ -0,0 +1,42 @@
name: Build
on:
pull_request: { }
push:
branches: [ master, develop ]
repository_dispatch:
types: [ element-web-notify ]
jobs:
build:
name: "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: actions/setup-node@v3
with:
cache: 'yarn'
- name: Install SDKs
run: "./scripts/fetch-develop.deps.sh --depth 1"
- name: Install Dependencies
run: "yarn install"
- name: Build & Package
run: "./scripts/ci_package.sh"
- name: Upload webpack-stats.json
uses: actions/upload-artifact@v2
with:
path: webpack-state.json
retention-days: 28
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: previewbuild
path: dist/*.tar.gz
retention-days: ${{ github.ref == 'develop' && 1 || 28 }}

View File

@ -1,17 +1,60 @@
name: Trigger deployment to develop.element.io
name: Deploy develop.element.io
concurrency: develop_deploy
on:
pull_request: { } # TEMP
push:
branches: [ develop ]
repository_dispatch:
types: [ element-web-notify ]
workflow_run:
workflows: [ "Build" ]
types:
- completed
jobs:
trigger:
deploy:
runs-on: ubuntu-latest
# if: github.ref == 'develop'
steps:
- name: Create Deployment ID
uses: altinukshini/deployment-action@releases/v1
id: deployment
with:
token: "${{ github.token }}"
target_url: https://develop.element.io
environment: production
- name: Find Artifact ID
uses: actions/github-script@v3.1.0
id: find_artifact
with:
result-encoding: string
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];
return matchArtifact.id;
# TODO
- name: Invoke deployment hook
uses: distributhor/workflow-webhook@v2
env:
webhook_url: https://test.tun.bit.ovh
webhook_secret: FooBar
data: '{ "tarball_url": "foobar" }'
data: '{ "artifact_id": "${{steps.find_artifact.outputs.result}}" }'
- name: Update deployment status (success)
if: success()
uses: altinukshini/deployment-status@releases/v1
with:
token: "${{ github.token }}"
target_url: https://develop.element.io
state: "success"
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
- name: Update deployment status (failure)
if: failure()
uses: altinukshini/deployment-status@releases/v1
with:
token: "${{ github.token }}"
target_url: https://develop.element.io
state: "failure"
deployment_id: ${{ steps.deployment.outputs.deployment_id }}

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

@ -0,0 +1,80 @@
name: Static Analysis
on:
pull_request: { }
push:
branches: [ develop, master ]
repository_dispatch:
types: [ element-web-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 SDKs
run: "./scripts/fetch-develop.deps.sh --depth 1"
- name: Install Dependencies
run: "yarn install"
- name: Typecheck
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"

29
.github/workflows/test.yaml vendored Normal file
View File

@ -0,0 +1,29 @@
name: Test
on:
pull_request: { }
push:
branches: [ master, develop ]
repository_dispatch:
types: [ element-web-notify ]
jobs:
test:
name: "Test"
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 SDKs
run: "./scripts/fetch-develop.deps.sh --depth 1"
- name: Install Dependencies
run: "yarn install"
- name: Run Tests
run: "yarn test"

View File

@ -9,7 +9,7 @@ else
fi
yarn clean
VERSION=$version yarn build
VERSION=$version yarn build-stats
# include the sample config in the tarball. Arguably this should be done by
# `yarn build`, but it's just too painful.