Skip to content

Commit 2ff2ff8

Browse files
committed
Merge remote-tracking branch 'origin/t3chguy/consolidate-build-test-ci' into t3chguy/consolidate-build-test-ci
2 parents ed7afd9 + 5da49bc commit 2ff2ff8

231 files changed

Lines changed: 421 additions & 622 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build_desktop_macos.yaml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,21 +128,22 @@ jobs:
128128
working-directory: apps/desktop
129129
run: pnpm run build:native:universal
130130

131-
- name: "Build App"
131+
# We split these because electron-builder gets upset if we set CSC_LINK even to an empty string
132+
- name: "[Signed] Build App"
133+
if: inputs.sign != ''
132134
working-directory: apps/desktop
133-
run: pnpm run build:universal --publish never -m ${TARGETS}
135+
run: |
136+
pnpm run build:universal --publish never -m ${TARGETS}
134137
env:
135-
# Code signing parameters
136-
CSC_IDENTITY_AUTO_DISCOVERY: ${{ inputs.sign != '' }}
137-
APPLE_TEAM_ID: ${{ case(inputs.sign != '', vars.APPLE_TEAM_ID, '') }}
138-
APPLE_ID: ${{ case(inputs.sign != '', secrets.APPLE_ID, '') }}
139-
APPLE_APP_SPECIFIC_PASSWORD: ${{ case(inputs.sign != '', secrets.APPLE_ID_PASSWORD, '') }}
140-
CSC_KEY_PASSWORD: ${{ case(inputs.sign != '', secrets.APPLE_CSC_KEY_PASSWORD, '') }}
141-
CSC_LINK: ${{ case(inputs.sign != '', secrets.APPLE_CSC_LINK, '') }}
138+
APPLE_TEAM_ID: ${{ vars.APPLE_TEAM_ID }}
139+
APPLE_ID: ${{ secrets.APPLE_ID }}
140+
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
141+
CSC_KEY_PASSWORD: ${{ secrets.APPLE_CSC_KEY_PASSWORD }}
142+
CSC_LINK: ${{ secrets.APPLE_CSC_LINK }}
142143
VARIANT_PATH: variant.json
143-
TARGETS: ${{ inputs.targets }}
144144
# Only set for Nightly builds
145145
VERSION: ${{ inputs.version }}
146+
TARGETS: ${{ inputs.targets }}
146147

147148
- name: Check app was signed & notarised successfully
148149
if: inputs.sign != ''
@@ -153,6 +154,16 @@ jobs:
153154
spctl -a -vvv -t install /Volumes/Element/*.app
154155
hdiutil detach /Volumes/Element
155156
157+
- name: "[Unsigned] Build App"
158+
if: inputs.sign == ''
159+
working-directory: apps/desktop
160+
run: |
161+
pnpm run build:universal --publish never -m ${TARGETS}
162+
env:
163+
CSC_IDENTITY_AUTO_DISCOVERY: false
164+
VARIANT_PATH: variant.json
165+
TARGETS: ${{ inputs.targets }}
166+
156167
- name: Generate releases.json
157168
if: inputs.base-url
158169
working-directory: apps/desktop

.github/workflows/build_desktop_prepare.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ jobs:
111111
- name: "[Nightly] Calculate version"
112112
id: versions
113113
if: inputs.nightly
114+
working-directory: apps/desktop
114115
run: |
116+
set -e
117+
115118
# Find all latest Nightly versions
116119
aws s3 cp s3://$R2_BUCKET/nightly/update/macos/releases.json - --endpoint-url $R2_URL --region auto | jq -r .currentRelease >> VERSIONS
117120
aws s3 cp s3://$R2_BUCKET/debian/dists/default/main/binary-amd64/Packages - --endpoint-url $R2_URL --region auto | grep "Package: element-nightly" -A 50 | grep Version -m1 | sed -n 's/Version: //p' >> VERSIONS
@@ -164,6 +167,8 @@ jobs:
164167
if: inputs.nightly
165168
working-directory: apps/desktop
166169
run: |
170+
set -e
171+
167172
BUNDLE_HASH=$(npx asar l webapp.asar | grep /bundles/ | head -n 1 | sed 's|.*/||')
168173
WEBAPP_VERSION=$(./scripts/get-version.ts)
169174
WEB_VERSION=${WEBAPP_VERSION:0:12}

apps/desktop/.eslintrc.cjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ module.exports = {
4646
// Things we do that break the ideal style
4747
"prefer-promise-reject-errors": "off",
4848
"quotes": "off",
49+
"n/file-extension-in-import": "off",
4950

5051
"@typescript-eslint/no-explicit-any": "off",
5152
// We're okay with assertion errors when we ask for them
@@ -62,6 +63,7 @@ module.exports = {
6263
// Things we do that break the ideal style
6364
"prefer-promise-reject-errors": "off",
6465
"quotes": "off",
66+
"n/file-extension-in-import": "off",
6567

6668
"@typescript-eslint/no-explicit-any": "off",
6769
// We're okay with assertion errors when we ask for them

apps/desktop/electron-builder.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as os from "node:os";
22
import * as fs from "node:fs";
33
import * as path from "node:path";
4-
import { type Configuration as BaseConfiguration, type Protocol } from "electron-builder";
4+
import { type Configuration as BaseConfiguration } from "electron-builder";
55

66
/**
77
* This script has different outputs depending on your os platform.
@@ -38,6 +38,7 @@ interface Metadata {
3838
interface ExtraMetadata extends Metadata {
3939
electron_appId: string;
4040
electron_protocol: string;
41+
electron_windows_cert_sn?: string;
4142
}
4243

4344
/**
@@ -208,6 +209,7 @@ if (variant["linux.deb.name"]) {
208209
if (process.env.ED_SIGNTOOL_SUBJECT_NAME && process.env.ED_SIGNTOOL_THUMBPRINT) {
209210
config.win.signtoolOptions!.certificateSubjectName = process.env.ED_SIGNTOOL_SUBJECT_NAME;
210211
config.win.signtoolOptions!.certificateSha1 = process.env.ED_SIGNTOOL_THUMBPRINT;
212+
config.extraMetadata.electron_windows_cert_sn = config.win.signtoolOptions!.certificateSubjectName;
211213
}
212214

213215
if (os.platform() === "linux") {

apps/desktop/hak/matrix-seshat/build.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
66
Please see LICENSE files in the repository root for full details.
77
*/
88

9-
import type HakEnv from "../../scripts/hak/hakEnv.js";
10-
import type { DependencyInfo } from "../../scripts/hak/dep.js";
9+
import type HakEnv from "../../scripts/hak/hakEnv.ts";
10+
import type { DependencyInfo } from "../../scripts/hak/dep.ts";
1111

1212
export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
1313
const env = hakEnv.makeGypEnv();

apps/desktop/hak/matrix-seshat/check.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Please see LICENSE files in the repository root for full details.
99
import childProcess from "node:child_process";
1010
import fsProm from "node:fs/promises";
1111

12-
import type HakEnv from "../../scripts/hak/hakEnv.js";
13-
import type { Tool } from "../../scripts/hak/hakEnv.js";
14-
import type { DependencyInfo } from "../../scripts/hak/dep.js";
12+
import type HakEnv from "../../scripts/hak/hakEnv.ts";
13+
import type { Tool } from "../../scripts/hak/hakEnv.ts";
14+
import type { DependencyInfo } from "../../scripts/hak/dep.ts";
1515

1616
export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
1717
const tools: Tool[] = [["rustc", "--version"]];

apps/desktop/hak/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"sourceMap": false,
77
"strict": true,
88
"lib": ["es2022"],
9-
"types": ["node"]
9+
"types": ["node"],
10+
"allowImportingTsExtensions": true
1011
},
1112
"include": ["../scripts/@types/*.d.ts", "./**/*.ts"]
1213
}

apps/desktop/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
"type": "module",
1919
"files": [],
2020
"engines": {
21-
"node": ">=18.0.0"
21+
"node": ">=22.18"
2222
},
2323
"scripts": {
2424
"i18n": "matrix-gen-i18n && pnpm i18n:sort && pnpm i18n:lint",
2525
"i18n:sort": "matrix-sort-i18n src/i18n/strings/en_EN.json",
2626
"i18n:lint": "prettier --log-level=silent --write src/i18n/strings/ --ignore-path /dev/null",
2727
"i18n:diff": "cp src/i18n/strings/en_EN.json src/i18n/strings/en_EN_orig.json && pnpm i18n && matrix-compare-i18n-files src/i18n/strings/en_EN_orig.json src/i18n/strings/en_EN.json",
2828
"mkdirs": "mkdirp packages deploys",
29-
"fetch": "pnpm run mkdirs && tsx scripts/fetch-package.ts",
29+
"fetch": "pnpm run mkdirs && node scripts/fetch-package.ts",
3030
"asar-webapp": "asar p webapp webapp.asar",
3131
"start": "pnpm run build:ts && pnpm run build:res && electron .",
3232
"lint": "pnpm lint:types && pnpm lint:js",
@@ -44,13 +44,13 @@
4444
"build:universal": "pnpm run build:ts && pnpm run build:res && electron-builder --universal",
4545
"build": "pnpm run build:ts && pnpm run build:res && electron-builder",
4646
"build:ts": "tsc",
47-
"build:res": "tsx scripts/copy-res.ts",
47+
"build:res": "node scripts/copy-res.ts",
4848
"docker:setup": "docker build --platform linux/amd64 -t element-desktop-dockerbuild -f dockerbuild/Dockerfile .",
4949
"docker:build:native": "scripts/in-docker.sh pnpm run hak",
5050
"docker:build": "scripts/in-docker.sh pnpm run build",
5151
"docker:install": "scripts/in-docker.sh pnpm install",
5252
"clean": "rimraf webapp.asar dist packages deploys lib",
53-
"hak": "tsx scripts/hak/index.ts",
53+
"hak": "node scripts/hak/index.ts",
5454
"test": "playwright test",
5555
"test:open": "pnpm test --ui",
5656
"test:screenshots:build": "docker build playwright -t element-desktop-playwright --platform linux/amd64",
@@ -102,7 +102,6 @@
102102
"prettier": "^3.0.0",
103103
"rimraf": "^6.0.0",
104104
"tar": "^7.5.8",
105-
"tsx": "^4.19.2",
106105
"typescript": "5.9.3"
107106
},
108107
"hakDependencies": {

apps/desktop/scripts/copy-res.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env -S npx tsx
1+
#!/usr/bin/env node
22

33
// copies resources into the lib directory.
44

apps/desktop/scripts/fetch-package.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env -S npx tsx --resolveJsonModule
1+
#!/usr/bin/env node
22

33
import * as path from "node:path";
44
import { createWriteStream, promises as fs } from "node:fs";
@@ -7,8 +7,8 @@ import * as tar from "tar";
77
import * as asar from "@electron/asar";
88
import { promises as stream } from "node:stream";
99

10-
import riotDesktopPackageJson from "../package.json";
11-
import { setPackageVersion } from "./set-version.js";
10+
import riotDesktopPackageJson from "../package.json" with { type: "json" };
11+
import { setPackageVersion } from "./set-version.ts";
1212

1313
const PUB_KEY_URL = "https://packages.riot.im/element-release-key.asc";
1414
const PACKAGE_URL_PREFIX = "https://github.com/element-hq/element-web/releases/download/";

0 commit comments

Comments
 (0)