Tidy & consolidate workflows (#32517)
* Rebuild static_analysis as ci.yaml using matrix strategy Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Disable fail-fast Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Delete long-unused pending reviews automation EW lacks the header to show it anymore Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -1,92 +0,0 @@
|
|||||||
name: Pending reviews automation
|
|
||||||
on:
|
|
||||||
# The bot exceeded its API rate limit. Disabling for now (adding workflow dispatch so the workflow file stays valid & we can test to see if it starts working again)
|
|
||||||
workflow_dispatch: {}
|
|
||||||
# We run it on a schedule instead of on pull_request_* events to not create confusing messaging in the PR
|
|
||||||
#schedule:
|
|
||||||
# - cron: "*/10 * * * *"
|
|
||||||
concurrency: ${{ github.workflow }}
|
|
||||||
permissions: {} # We use ELEMENT_BOT_TOKEN instead
|
|
||||||
jobs:
|
|
||||||
bot:
|
|
||||||
name: Pending reviews bot
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
environment: Matrix
|
|
||||||
env:
|
|
||||||
URL: "https://github.com/pulls?q=is%3Apr+is%3Aopen+repo%3Amatrix-org%2Fmatrix-js-sdk+repo%3Amatrix-org%2Fmatrix-react-sdk+repo%3Aelement-hq%2Felement-web+repo%3Aelement-hq%2Felement-desktop+review-requested%3A%40me+sort%3Aupdated-desc+"
|
|
||||||
RELEASE_BLOCKERS_URL: "https://github.com/pulls?q=is%3Aopen+repo%3Amatrix-org%2Fmatrix-js-sdk+repo%3Amatrix-org%2Fmatrix-react-sdk+repo%3Aelement-hq%2Felement-web+repo%3Aelement-hq%2Felement-desktop+sort%3Aupdated-desc+label%3AX-Release-Blocker+"
|
|
||||||
steps:
|
|
||||||
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
|
|
||||||
env:
|
|
||||||
HS_URL: ${{ secrets.BETABOT_HS_URL }}
|
|
||||||
ROOM_ID: ${{ secrets.ROOM_ID }}
|
|
||||||
TOKEN: ${{ secrets.BETABOT_ACCESS_TOKEN }}
|
|
||||||
with:
|
|
||||||
# PAT needed as the GITHUB_TOKEN won't be able to see cross-references from other orgs (matrix-org)
|
|
||||||
github-token: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
|
||||||
script: |
|
|
||||||
const { HS_URL, ROOM_ID, TOKEN, URL, RELEASE_BLOCKERS_URL } = process.env;
|
|
||||||
|
|
||||||
async function updateCounter(counter, link, severity, title, value, clearOnZero) {
|
|
||||||
const apiUrl = `${HS_URL}/_matrix/client/v3/rooms/${ROOM_ID}/state/re.jki.counter/${counter}`;
|
|
||||||
const headers = {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"Authorization": `Bearer ${TOKEN}`,
|
|
||||||
};
|
|
||||||
const res = await fetch(apiUrl, {
|
|
||||||
method: "GET",
|
|
||||||
headers,
|
|
||||||
});
|
|
||||||
|
|
||||||
const data = await res.json();
|
|
||||||
|
|
||||||
if (data.value === issueCount) {
|
|
||||||
console.log("Pending review count already correct");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let body = {};
|
|
||||||
if (issueCount || !clearOnZero) {
|
|
||||||
body = JSON.stringify({
|
|
||||||
link,
|
|
||||||
severity,
|
|
||||||
title,
|
|
||||||
value,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
await fetch(apiUrl, {
|
|
||||||
method: "PUT",
|
|
||||||
body,
|
|
||||||
headers,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const repos = [
|
|
||||||
"element-hq/element-desktop",
|
|
||||||
"element-hq/element-web",
|
|
||||||
"matrix-org/matrix-js-sdk",
|
|
||||||
];
|
|
||||||
const teams = [
|
|
||||||
"matrix-org/element-web-team",
|
|
||||||
"matrix-org/element-web-reviewers",
|
|
||||||
"element-hq/element-web-team",
|
|
||||||
"element-hq/element-web-reviewers",
|
|
||||||
];
|
|
||||||
|
|
||||||
let issueCount = 0;
|
|
||||||
for (const team of teams) {
|
|
||||||
const org = team.split("/", 2)[0];
|
|
||||||
const reposInOrg = repos.filter(repo => repo.startsWith(org + "/"));
|
|
||||||
const { data } = await github.rest.search.issuesAndPullRequests({
|
|
||||||
q: `is:pr is:open review:required ${reposInOrg.map(r => `repo:${r}`).join(" ")} team-review-requested:${team}`,
|
|
||||||
});
|
|
||||||
issueCount += data.total_count;
|
|
||||||
}
|
|
||||||
await updateCounter("gh_reviews", URL, "warning", "Pending reviews", issueCount);
|
|
||||||
|
|
||||||
const { data } = await github.rest.search.issuesAndPullRequests({
|
|
||||||
q: `is:open ${repos.map(repo => `repo:${repo}`).join(" ")} label:X-Release-Blocker`,
|
|
||||||
});
|
|
||||||
const blockerCount = data.total_count;
|
|
||||||
await updateCounter("release_blockers", RELEASE_BLOCKERS_URL, "alert", "Release Blockers", blockerCount, true);
|
|
||||||
@@ -19,8 +19,30 @@ env:
|
|||||||
permissions: {} # No permissions required
|
permissions: {} # No permissions required
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ts_lint:
|
lint:
|
||||||
name: "Typescript Syntax Check"
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- name: Typescript Syntax Check
|
||||||
|
install: layered
|
||||||
|
command: "lint:types"
|
||||||
|
- name: ESLint
|
||||||
|
install: normal
|
||||||
|
command: "lint:js"
|
||||||
|
- name: Style Lint
|
||||||
|
install: normal
|
||||||
|
command: "lint:style"
|
||||||
|
- name: Workflow Lint
|
||||||
|
install: normal
|
||||||
|
command: "lint:workflows"
|
||||||
|
- name: Analyse Dead Code
|
||||||
|
install: normal
|
||||||
|
command: "lint:knip"
|
||||||
|
- name: Rethemendex Check
|
||||||
|
command: "rethemendex"
|
||||||
|
assert-diff: true
|
||||||
|
name: ${{ matrix.name }}
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||||
@@ -31,130 +53,56 @@ jobs:
|
|||||||
cache: "pnpm"
|
cache: "pnpm"
|
||||||
node-version: "lts/*"
|
node-version: "lts/*"
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies (layered)
|
||||||
|
if: matrix.install == 'layered'
|
||||||
run: "./scripts/layered.sh"
|
run: "./scripts/layered.sh"
|
||||||
|
- name: Install Dependencies (normal)
|
||||||
|
if: matrix.install == 'normal'
|
||||||
|
run: "pnpm install --frozen-lockfile"
|
||||||
|
|
||||||
- name: Typecheck
|
- name: Run ${{ matrix.command }}
|
||||||
run: "pnpm run lint:types"
|
run: pnpm run "$CMD" && pnpm -r --if-present run "$CMD"
|
||||||
|
env:
|
||||||
|
CMD: ${{ matrix.command }}
|
||||||
|
|
||||||
- name: Typecheck Shared Components
|
- name: Assert no changes
|
||||||
run: "pnpm --dir packages/shared-components run lint:types"
|
run: git diff --exit-code
|
||||||
|
if: matrix.assert-diff
|
||||||
|
|
||||||
i18n_lint_ew:
|
i18n:
|
||||||
name: "i18n Check (Element Web)"
|
strategy:
|
||||||
uses: matrix-org/matrix-web-i18n/.github/workflows/i18n_check.yml@abf186831e2acb3e98fca13a0711a3fa1364d2b1
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- name: Element Web
|
||||||
|
allowed-hardcoded-keys: |
|
||||||
|
console_dev_note
|
||||||
|
labs|element_call_video_rooms
|
||||||
|
labs|feature_disable_call_per_sender_encryption
|
||||||
|
voip|element_call
|
||||||
|
error|invalid_json
|
||||||
|
error|misconfigured
|
||||||
|
welcome_to_element
|
||||||
|
devtools|settings|elementCallUrl
|
||||||
|
labs|sliding_sync_description
|
||||||
|
settings|voip|noise_suppression_description
|
||||||
|
settings|voip|echo_cancellation_description
|
||||||
|
- name: Shared Components
|
||||||
|
path: "packages/shared-components"
|
||||||
|
name: "i18n Check (${{ matrix.name }})"
|
||||||
|
uses: matrix-org/matrix-web-i18n/.github/workflows/i18n_check.yml@main
|
||||||
permissions:
|
permissions:
|
||||||
pull-requests: read
|
pull-requests: read
|
||||||
with:
|
with:
|
||||||
hardcoded-words: "Element"
|
hardcoded-words: "Element"
|
||||||
packageManager: pnpm
|
packageManager: pnpm
|
||||||
allowed-hardcoded-keys: |
|
path: ${{ matrix.path }}
|
||||||
console_dev_note
|
allowed-hardcoded-keys: ${{ matrix.allowed-hardcoded-keys }}
|
||||||
labs|element_call_video_rooms
|
|
||||||
labs|feature_disable_call_per_sender_encryption
|
|
||||||
voip|element_call
|
|
||||||
error|invalid_json
|
|
||||||
error|misconfigured
|
|
||||||
welcome_to_element
|
|
||||||
devtools|settings|elementCallUrl
|
|
||||||
labs|sliding_sync_description
|
|
||||||
settings|voip|noise_suppression_description
|
|
||||||
settings|voip|echo_cancellation_description
|
|
||||||
|
|
||||||
i18n_lint_shared_components:
|
# Dummy job to simplify branch protections
|
||||||
name: "i18n Check (Shared Components)"
|
ci:
|
||||||
uses: matrix-org/matrix-web-i18n/.github/workflows/i18n_check.yml@abf186831e2acb3e98fca13a0711a3fa1364d2b1
|
name: Static Analysis
|
||||||
permissions:
|
needs: [lint, i18n]
|
||||||
pull-requests: read
|
|
||||||
with:
|
|
||||||
path: "packages/shared-components"
|
|
||||||
hardcoded-words: "Element"
|
|
||||||
packageManager: pnpm
|
|
||||||
|
|
||||||
rethemendex_lint:
|
|
||||||
name: "Rethemendex Check"
|
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- run: echo "Ok"
|
||||||
|
|
||||||
- run: ./res/css/rethemendex.sh
|
|
||||||
|
|
||||||
- run: git diff --exit-code
|
|
||||||
|
|
||||||
js_lint:
|
|
||||||
name: "ESLint"
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
||||||
|
|
||||||
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
|
|
||||||
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
|
|
||||||
with:
|
|
||||||
cache: "pnpm"
|
|
||||||
node-version: "lts/*"
|
|
||||||
|
|
||||||
# Does not need branch matching as only analyses this layer
|
|
||||||
- name: Install Deps
|
|
||||||
run: "pnpm install --frozen-lockfile"
|
|
||||||
|
|
||||||
- name: Run Linter
|
|
||||||
run: "pnpm run lint:js"
|
|
||||||
|
|
||||||
- name: Run Linter
|
|
||||||
run: "pnpm --dir packages/shared-components run lint:js"
|
|
||||||
|
|
||||||
style_lint:
|
|
||||||
name: "Style Lint"
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
||||||
|
|
||||||
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
|
|
||||||
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
|
|
||||||
with:
|
|
||||||
cache: "pnpm"
|
|
||||||
node-version: "lts/*"
|
|
||||||
|
|
||||||
# Does not need branch matching as only analyses this layer
|
|
||||||
- name: Install Deps
|
|
||||||
run: "pnpm install"
|
|
||||||
|
|
||||||
- name: Run Linter
|
|
||||||
run: "pnpm run lint:style"
|
|
||||||
|
|
||||||
workflow_lint:
|
|
||||||
name: "Workflow Lint"
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
||||||
|
|
||||||
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
|
|
||||||
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
|
|
||||||
with:
|
|
||||||
cache: "pnpm"
|
|
||||||
node-version: "lts/*"
|
|
||||||
|
|
||||||
# Does not need branch matching as only analyses this layer
|
|
||||||
- name: Install Deps
|
|
||||||
run: "pnpm install --frozen-lockfile"
|
|
||||||
|
|
||||||
- name: Run Linter
|
|
||||||
run: "pnpm lint:workflows"
|
|
||||||
|
|
||||||
analyse_dead_code:
|
|
||||||
name: "Analyse Dead Code"
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
||||||
|
|
||||||
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
|
|
||||||
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
|
|
||||||
with:
|
|
||||||
cache: "pnpm"
|
|
||||||
node-version: "lts/*"
|
|
||||||
|
|
||||||
- name: Install Deps
|
|
||||||
run: "pnpm install --frozen-lockfile"
|
|
||||||
|
|
||||||
- name: Run linter
|
|
||||||
run: "pnpm run lint:knip"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user