There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
ci: check macOS arm64 bundle output (#3012)
Alex Yanga06ba403d058
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex 96fe81f57d..fbe8daa75b 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -376,6 +376,17 @@ jobs:env:COVERAGE: true+ - name: Make bundle+ if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }}+ run: yarn workspace @affine/electron make --platform=darwin --arch=arm64++ - name: Bundle output check+ if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }}+ run: |+ ./scripts/unzip-macos-arm64.sh+ yarn ts-node-esm ./scripts/macos-arm64-output-check.mts+ working-directory: apps/electron+- name: Collect code coverage reportif: ${{ matrix.spec.test }}run: yarn exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcovdiff --git a/apps/electron/.gitignore b/apps/electron/.gitignoreindex 72afe66b1b..cc2c41bb7f 100644--- a/apps/electron/.gitignore+++ b/apps/electron/.gitignore@@ -13,3 +13,5 @@ resources/web-static!.yarn/sdks!.yarn/versionsdev.json++zip-outdiff --git a/apps/electron/scripts/macos-arm64-output-check.mts b/apps/electron/scripts/macos-arm64-output-check.mtsnew file mode 100644index 0000000000..15e0ff7900--- /dev/null+++ b/apps/electron/scripts/macos-arm64-output-check.mts@@ -0,0 +1,42 @@+import { fileURLToPath } from 'node:url';+import { readdir } from 'node:fs/promises';++const outputRoot = fileURLToPath(+ new URL(+ '../zip-out/AFFiNE-canary.app/Contents/Resources/app',+ import.meta.url+ )+);+const outputList = [+ [+ 'dist',+ [+ 'main.js',+ 'helper.js',+ 'preload.js',+ 'affine.darwin-arm64.node',+ 'plugins',+ 'workers',+ ],+ ],+ ['dist/plugins', ['bookmark-block']],+ ['dist/plugins/bookmark-block', ['index.mjs']],+ ['dist/workers', ['plugin.worker.js']],+ [+ 'node_modules/@toeverything/plugin-infra/dist',+ ['manager.js', 'manager.cjs'],+ ],+] as [entry: string, expected: string[]][];++await Promise.all(+ outputList.map(async ([entry, output]) => {+ const files = await readdir(`${outputRoot}/${entry}`);+ output.forEach(file => {+ if (!files.includes(file)) {+ throw new Error(`File ${entry}/${file} not found`);+ }+ });+ })+);++console.log('Output check passed');diff --git a/apps/electron/scripts/unzip-macos-arm64.sh b/apps/electron/scripts/unzip-macos-arm64.shnew file mode 100755index 0000000000..1790fcbd97--- /dev/null+++ b/apps/electron/scripts/unzip-macos-arm64.sh@@ -0,0 +1,16 @@+#!/bin/bash++# Set the directory+dir="./out/canary/make/zip/darwin/arm64"++# Get the first file+file=$(ls -1 $dir | head -n 1)++# Check if file exists and is a zip file+if [ -f "$dir/$file" ] && [ ${file: -4} == ".zip" ]+then+ # Unzip the file+ unzip "$dir/$file" -d "zip-out"+else+ echo "No zip file found"+fidiff --git a/apps/electron/tsconfig.node.json b/apps/electron/tsconfig.node.jsonindex bba6c23afc..94614e8be5 100644--- a/apps/electron/tsconfig.node.json+++ b/apps/electron/tsconfig.node.json@@ -7,7 +7,8 @@"resolveJsonModule": true,"moduleResolution": "Node","allowSyntheticDefaultImports": true,- "noEmit": false+ "noEmit": false,+ "outDir": "./lib/scripts"},"include": ["./scripts", "esbuild.main.config.ts", "esbuild.plugin.config.ts"]}