mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 11:58:41 +00:00
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@aws-sdk/client-s3](https://togithub.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3) ([source](https://togithub.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-s3)) | [`3.484.0` -> `3.485.0`](https://renovatebot.com/diffs/npm/@aws-sdk%2fclient-s3/3.484.0/3.485.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [@napi-rs/cli](https://togithub.com/napi-rs/napi-rs) | [`3.0.0-alpha.29` -> `3.0.0-alpha.30`](https://renovatebot.com/diffs/npm/@napi-rs%2fcli/3.0.0-alpha.29/3.0.0-alpha.30) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [@node-rs/jsonwebtoken](https://togithub.com/napi-rs/node-rs) | [`^0.2.3` -> `^0.3.0`](https://renovatebot.com/diffs/npm/@node-rs%2fjsonwebtoken/0.2.3/0.3.1) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [@opentelemetry/instrumentation-socket.io](https://togithub.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-socket.io#readme) ([source](https://togithub.com/open-telemetry/opentelemetry-js-contrib)) | [`^0.34.4` -> `^0.35.0`](https://renovatebot.com/diffs/npm/@opentelemetry%2finstrumentation-socket.io/0.34.4/0.35.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [@storybook/test-runner](https://togithub.com/storybookjs/test-runner) | [`^0.15.2` -> `^0.16.0`](https://renovatebot.com/diffs/npm/@storybook%2ftest-runner/0.15.2/0.16.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [@vitest/coverage-istanbul](https://togithub.com/vitest-dev/vitest/tree/main/packages/coverage-istanbul#readme) ([source](https://togithub.com/vitest-dev/vitest/tree/HEAD/packages/coverage-istanbul)) | [`1.1.1` -> `1.1.2`](https://renovatebot.com/diffs/npm/@vitest%2fcoverage-istanbul/1.1.1/1.1.2) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [@vitest/ui](https://togithub.com/vitest-dev/vitest/tree/main/packages/ui#readme) ([source](https://togithub.com/vitest-dev/vitest/tree/HEAD/packages/ui)) | [`1.1.1` -> `1.1.2`](https://renovatebot.com/diffs/npm/@vitest%2fui/1.1.1/1.1.2) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [vitest](https://togithub.com/vitest-dev/vitest) ([source](https://togithub.com/vitest-dev/vitest/tree/HEAD/packages/vitest)) | [`1.1.1` -> `1.1.2`](https://renovatebot.com/diffs/npm/vitest/1.1.1/1.1.2) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>aws/aws-sdk-js-v3 (@​aws-sdk/client-s3)</summary> ### [`v3.485.0`](https://togithub.com/aws/aws-sdk-js-v3/blob/HEAD/clients/client-s3/CHANGELOG.md#34850-2024-01-03) [Compare Source](https://togithub.com/aws/aws-sdk-js-v3/compare/v3.484.0...v3.485.0) ##### Features - **credential-providers:** add credentialScope field ([#​5606](https://togithub.com/aws/aws-sdk-js-v3/issues/5606)) ([04c1459](04c1459289)) </details> <details> <summary>napi-rs/napi-rs (@​napi-rs/cli)</summary> ### [`v3.0.0-alpha.30`](https://togithub.com/napi-rs/napi-rs/releases/tag/%40napi-rs/cli%403.0.0-alpha.30) [Compare Source](https://togithub.com/napi-rs/napi-rs/compare/@napi-rs/cli@3.0.0-alpha.29...@napi-rs/cli@3.0.0-alpha.30) ##### What's Changed - chore(deps): lock file maintenance by [@​renovate](https://togithub.com/renovate) in [https://github.com/napi-rs/napi-rs/pull/1882](https://togithub.com/napi-rs/napi-rs/pull/1882) - fix(cli): wasi fallback package load logic by [@​Brooooooklyn](https://togithub.com/Brooooooklyn) in [https://github.com/napi-rs/napi-rs/pull/1887](https://togithub.com/napi-rs/napi-rs/pull/1887) - fix(cli): upload to github releases issue by [@​Brooooooklyn](https://togithub.com/Brooooooklyn) in [https://github.com/napi-rs/napi-rs/pull/1888](https://togithub.com/napi-rs/napi-rs/pull/1888) **Full Changelog**: https://github.com/napi-rs/napi-rs/compare/[@​napi-rs/cli](https://togithub.com/napi-rs/cli)[@​3](https://togithub.com/3).0.0-alpha.29...[@​napi-rs/cli](https://togithub.com/napi-rs/cli)[@​3](https://togithub.com/3).0.0-alpha.30 </details> <details> <summary>napi-rs/node-rs (@​node-rs/jsonwebtoken)</summary> ### [`v0.3.1`](https://togithub.com/napi-rs/node-rs/compare/@node-rs/jsonwebtoken@0.3.0...@node-rs/jsonwebtoken@0.3.1) [Compare Source](https://togithub.com/napi-rs/node-rs/compare/@node-rs/jsonwebtoken@0.3.0...@node-rs/jsonwebtoken@0.3.1) ### [`v0.3.0`](https://togithub.com/napi-rs/node-rs/compare/@node-rs/jsonwebtoken@0.2.3...@node-rs/jsonwebtoken@0.3.0) [Compare Source](https://togithub.com/napi-rs/node-rs/compare/@node-rs/jsonwebtoken@0.2.3...@node-rs/jsonwebtoken@0.3.0) </details> <details> <summary>open-telemetry/opentelemetry-js-contrib (@​opentelemetry/instrumentation-socket.io)</summary> ### [`v0.35.0`](efdfc727a4...f81f8a76a8) [Compare Source](a757b5e443...9092823125) </details> <details> <summary>storybookjs/test-runner (@​storybook/test-runner)</summary> ### [`v0.16.0`](https://togithub.com/storybookjs/test-runner/releases/tag/v0.16.0) [Compare Source](https://togithub.com/storybookjs/test-runner/compare/v0.15.2...v0.16.0) ##### 🚀 Enhancement - Introduce logLevel configuration [#​406](https://togithub.com/storybookjs/test-runner/pull/406) ([@​yannbf](https://togithub.com/yannbf)) ##### 🐛 Bug Fix - Filter duplicated error messages in browser logs [#​405](https://togithub.com/storybookjs/test-runner/pull/405) ([@​yannbf](https://togithub.com/yannbf)) - Fix sync issues between tests [#​404](https://togithub.com/storybookjs/test-runner/pull/404) ([@​yannbf](https://togithub.com/yannbf)) - Refactor: Extract the setup page scripts into a separate file [#​403](https://togithub.com/storybookjs/test-runner/pull/403) ([@​yannbf](https://togithub.com/yannbf)) - Docs: Adds feedback form to migration documentation [#​402](https://togithub.com/storybookjs/test-runner/pull/402) ([@​jonniebigodes](https://togithub.com/jonniebigodes)) - Bump `jest-playwright-preset` from `v3.0.1` to `v4.0.0` [#​400](https://togithub.com/storybookjs/test-runner/pull/400) ([@​kemuridama](https://togithub.com/kemuridama)) - Improve type safety and code quality [#​383](https://togithub.com/storybookjs/test-runner/pull/383) ([@​bryanjtc](https://togithub.com/bryanjtc) [@​yannbf](https://togithub.com/yannbf)) - Refactor: Improve internal code [#​378](https://togithub.com/storybookjs/test-runner/pull/378) ([@​bryanjtc](https://togithub.com/bryanjtc) [@​yannbf](https://togithub.com/yannbf)) ##### Authors: 4 - [@​jonniebigodes](https://togithub.com/jonniebigodes) - Bryan Thomas ([@​bryanjtc](https://togithub.com/bryanjtc)) - Ryo Ochiai ([@​kemuridama](https://togithub.com/kemuridama)) - Yann Braga ([@​yannbf](https://togithub.com/yannbf)) </details> <details> <summary>vitest-dev/vitest (@​vitest/coverage-istanbul)</summary> ### [`v1.1.2`](https://togithub.com/vitest-dev/vitest/releases/tag/v1.1.2) [Compare Source](https://togithub.com/vitest-dev/vitest/compare/v1.1.1...v1.1.2) ##### 🐞 Bug Fixes - Remove internal flag from UI option in the config - by [@​sheremet-va](https://togithub.com/sheremet-va) [<samp>(7b4a2)</samp>](https://togithub.com/vitest-dev/vitest/commit/7b4a2fce) - **browser**: - Avoid safaridriver collision - by [@​mbland](https://togithub.com/mbland) in [https://github.com/vitest-dev/vitest/issues/4863](https://togithub.com/vitest-dev/vitest/issues/4863) [<samp>(345a2)</samp>](https://togithub.com/vitest-dev/vitest/commit/345a25d6) - Resolved failure to find arbitrarily-named snapshot files when using `expect(...).toMatchFileSnapshot()` matcher. - by [@​zmullett](https://togithub.com/zmullett), **Zac Mullett** and [@​sheremet-va](https://togithub.com/sheremet-va) in [https://github.com/vitest-dev/vitest/issues/4839](https://togithub.com/vitest-dev/vitest/issues/4839) [<samp>(b8140)</samp>](https://togithub.com/vitest-dev/vitest/commit/b8140fca) - Handle config.base - by [@​mbland](https://togithub.com/mbland) and [@​sheremet-va](https://togithub.com/sheremet-va) in [https://github.com/vitest-dev/vitest/issues/4686](https://togithub.com/vitest-dev/vitest/issues/4686) and [https://github.com/vitest-dev/vitest/issues/4692](https://togithub.com/vitest-dev/vitest/issues/4692) [<samp>(9e345)</samp>](https://togithub.com/vitest-dev/vitest/commit/9e34557e) - **deps**: - Update dependency acorn-walk to ^8.3.1 - by [@​renovate](https://togithub.com/renovate)\[bot] in[https://github.com/vitest-dev/vitest/issues/4837](https://togithub.com/vitest-dev/vitest/issues/4837)7 [<samp>(47bc2)</samp>](https://togithub.com/vitest-dev/vitest/commit/47bc233d) - Update dependency sirv to ^2.0.4 - by [@​renovate](https://togithub.com/renovate)\[bot] in[https://github.com/vitest-dev/vitest/issues/4838](https://togithub.com/vitest-dev/vitest/issues/4838)8 [<samp>(df261)</samp>](https://togithub.com/vitest-dev/vitest/commit/df261ae1) - **runner**: - Fix fixture cleanup for concurrent tests - by [@​hi-ogawa](https://togithub.com/hi-ogawa) in [https://github.com/vitest-dev/vitest/issues/4827](https://togithub.com/vitest-dev/vitest/issues/4827) [<samp>(1fee6)</samp>](https://togithub.com/vitest-dev/vitest/commit/1fee63f2) - **spy**: - Don't allow `Promise` in `mockImplementation` if it's not in the function signature - by [@​sheremet-va](https://togithub.com/sheremet-va) in [https://github.com/vitest-dev/vitest/issues/4859](https://togithub.com/vitest-dev/vitest/issues/4859) [<samp>(072e0)</samp>](https://togithub.com/vitest-dev/vitest/commit/072e02bf) - **vite-node**: - Correctly return cached result - by [@​sheremet-va](https://togithub.com/sheremet-va) in [https://github.com/vitest-dev/vitest/issues/4870](https://togithub.com/vitest-dev/vitest/issues/4870) [<samp>(15bbb)</samp>](https://togithub.com/vitest-dev/vitest/commit/15bbbf81) - **vitest**: - Throw an error if mock was already loaded when `vi.mock` is called - by [@​sheremet-va](https://togithub.com/sheremet-va) in [https://github.com/vitest-dev/vitest/issues/4862](https://togithub.com/vitest-dev/vitest/issues/4862) [<samp>(e12a5)</samp>](https://togithub.com/vitest-dev/vitest/commit/e12a5a36) - Correctly rerun test files on change if server was restarted - by [@​sheremet-va](https://togithub.com/sheremet-va) in [https://github.com/vitest-dev/vitest/issues/4871](https://togithub.com/vitest-dev/vitest/issues/4871) [<samp>(6088b)</samp>](https://togithub.com/vitest-dev/vitest/commit/6088b372) - **vm-threads**: - Don't crash on percentage based `memoryLimit` - by [@​inottn](https://togithub.com/inottn) and [@​AriPerkkio](https://togithub.com/AriPerkkio) in [https://github.com/vitest-dev/vitest/issues/4802](https://togithub.com/vitest-dev/vitest/issues/4802) [<samp>(70e8a)</samp>](https://togithub.com/vitest-dev/vitest/commit/70e8a389) ##### [View changes on GitHub](https://togithub.com/vitest-dev/vitest/compare/v1.1.1...v1.1.2) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMDMuMSIsInVwZGF0ZWRJblZlciI6IjM3LjEyMS4wIiwidGFyZ2V0QnJhbmNoIjoiY2FuYXJ5In0=-->
561 lines
18 KiB
YAML
561 lines
18 KiB
YAML
name: Build & Test
|
||
|
||
on:
|
||
push:
|
||
branches:
|
||
- canary
|
||
- v[0-9]+.[0-9]+.x-staging
|
||
- v[0-9]+.[0-9]+.x
|
||
paths-ignore:
|
||
- README.md
|
||
pull_request:
|
||
|
||
env:
|
||
DEBUG: napi:*
|
||
BUILD_TYPE: canary
|
||
APP_NAME: affine
|
||
AFFINE_ENV: dev
|
||
COVERAGE: true
|
||
MACOSX_DEPLOYMENT_TARGET: '10.13'
|
||
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
|
||
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/node_modules/.cache/ms-playwright
|
||
|
||
concurrency:
|
||
group: ${{ github.workflow }}-${{ github.ref }}
|
||
cancel-in-progress: true
|
||
|
||
jobs:
|
||
analyze:
|
||
name: Analyze
|
||
runs-on: ubuntu-latest
|
||
permissions:
|
||
actions: read
|
||
contents: read
|
||
security-events: write
|
||
|
||
strategy:
|
||
fail-fast: false
|
||
matrix:
|
||
language: ['javascript', 'typescript']
|
||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||
|
||
steps:
|
||
- name: Checkout repository
|
||
uses: actions/checkout@v4
|
||
|
||
# Initializes the CodeQL tools for scanning.
|
||
- name: Initialize CodeQL
|
||
uses: github/codeql-action/init@v3
|
||
with:
|
||
languages: ${{ matrix.language }}
|
||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||
# By default, queries listed here will override any specified in a config file.
|
||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||
|
||
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
||
# queries: security-extended,security-and-quality
|
||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||
# If this step fails, then you should remove it and run the build manually (see below)
|
||
- name: Autobuild
|
||
uses: github/codeql-action/autobuild@v3
|
||
|
||
# ℹ️ Command-line programs to run using the OS shell.
|
||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||
|
||
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
||
|
||
# - run: |
|
||
# echo "Run, Build Application using script"
|
||
# ./location_of_script_within_repo/buildscript.sh
|
||
|
||
- name: Perform CodeQL Analysis
|
||
uses: github/codeql-action/analyze@v3
|
||
lint:
|
||
name: Lint
|
||
runs-on: ubuntu-latest
|
||
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- name: Run oxlint
|
||
# oxlint is fast, so wrong code will fail quickly
|
||
run: yarn dlx $(node -e "console.log(require('./package.json').scripts['lint:ox'].replace('oxlint', 'oxlint@' + require('./package.json').devDependencies.oxlint))")
|
||
- name: Setup Node.js
|
||
uses: ./.github/actions/setup-node
|
||
with:
|
||
electron-install: false
|
||
full-cache: true
|
||
- name: Run i18n codegen
|
||
run: yarn i18n-codegen gen
|
||
- name: Run ESLint
|
||
run: yarn lint:eslint --max-warnings=0
|
||
- name: Run Prettier
|
||
# Set nmMode in `actions/setup-node` will modify the .yarnrc.yml
|
||
run: |
|
||
git checkout .yarnrc.yml
|
||
yarn lint:prettier
|
||
- name: Run Type Check
|
||
run: yarn typecheck
|
||
|
||
check-yarn-binary:
|
||
name: Check yarn binary
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- name: Run check
|
||
run: |
|
||
yarn set version $(node -e "console.log(require('./package.json').packageManager.split('@')[1])")
|
||
git diff --exit-code
|
||
|
||
e2e-test:
|
||
name: E2E Test
|
||
runs-on: ubuntu-latest
|
||
env:
|
||
DISTRIBUTION: browser
|
||
strategy:
|
||
fail-fast: false
|
||
matrix:
|
||
shard: [1, 2, 3, 4, 5]
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- name: Setup Node.js
|
||
uses: ./.github/actions/setup-node
|
||
with:
|
||
playwright-install: true
|
||
electron-install: false
|
||
full-cache: true
|
||
|
||
- name: Run playwright tests
|
||
run: yarn workspace @affine-test/affine-local e2e --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}
|
||
|
||
- name: Upload test results
|
||
if: ${{ failure() }}
|
||
uses: actions/upload-artifact@v4
|
||
with:
|
||
name: test-results-e2e-${{ matrix.shard }}
|
||
path: ./test-results
|
||
if-no-files-found: ignore
|
||
|
||
e2e-migration-test:
|
||
name: E2E Migration Test
|
||
runs-on: ubuntu-latest
|
||
env:
|
||
DISTRIBUTION: browser
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- name: Setup Node.js
|
||
uses: ./.github/actions/setup-node
|
||
with:
|
||
playwright-install: true
|
||
electron-install: false
|
||
full-cache: true
|
||
|
||
- name: Run playwright tests
|
||
run: yarn workspace @affine-test/affine-migration e2e --forbid-only
|
||
|
||
- name: Upload test results
|
||
if: ${{ failure() }}
|
||
uses: actions/upload-artifact@v4
|
||
with:
|
||
name: test-results-e2e-migration
|
||
path: ./tests/affine-migration/test-results
|
||
if-no-files-found: ignore
|
||
|
||
unit-test:
|
||
name: Unit Test
|
||
runs-on: ubuntu-latest
|
||
needs:
|
||
- build-native
|
||
env:
|
||
DISTRIBUTION: browser
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- name: Setup Node.js
|
||
uses: ./.github/actions/setup-node
|
||
with:
|
||
electron-install: false
|
||
full-cache: true
|
||
|
||
- name: Download affine.linux-x64-gnu.node
|
||
uses: actions/download-artifact@v4
|
||
with:
|
||
name: affine.linux-x64-gnu.node
|
||
path: ./packages/frontend/native
|
||
|
||
- name: Unit Test
|
||
run: yarn nx test:coverage @affine/monorepo
|
||
|
||
- name: Upload unit test coverage results
|
||
uses: codecov/codecov-action@v3
|
||
with:
|
||
token: ${{ secrets.CODECOV_TOKEN }}
|
||
files: ./.coverage/store/lcov.info
|
||
flags: unittest
|
||
name: affine
|
||
fail_ci_if_error: false
|
||
|
||
build-native:
|
||
name: Build AFFiNE native (${{ matrix.spec.target }})
|
||
runs-on: ${{ matrix.spec.os }}
|
||
env:
|
||
CARGO_PROFILE_RELEASE_DEBUG: '1'
|
||
strategy:
|
||
fail-fast: false
|
||
matrix:
|
||
spec:
|
||
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu }
|
||
- { os: windows-latest, target: x86_64-pc-windows-msvc }
|
||
- { os: macos-latest, target: x86_64-apple-darwin }
|
||
- { os: macos-latest, target: aarch64-apple-darwin }
|
||
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- name: Setup Node.js
|
||
uses: ./.github/actions/setup-node
|
||
with:
|
||
extra-flags: workspaces focus @affine/native
|
||
electron-install: false
|
||
- name: Setup filename
|
||
id: filename
|
||
shell: bash
|
||
run: |
|
||
export PLATFORM_ARCH_ABI=$(node -e "console.log(require('@napi-rs/cli').parseTriple('${{ matrix.spec.target }}').platformArchABI)")
|
||
echo "filename=affine.$PLATFORM_ARCH_ABI.node" >> "$GITHUB_OUTPUT"
|
||
- name: Build AFFiNE native
|
||
uses: ./.github/actions/build-rust
|
||
with:
|
||
target: ${{ matrix.spec.target }}
|
||
package: '@affine/native'
|
||
nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
|
||
- name: Upload ${{ steps.filename.outputs.filename }}
|
||
uses: actions/upload-artifact@v4
|
||
with:
|
||
name: ${{ steps.filename.outputs.filename }}
|
||
path: ./packages/frontend/native/${{ steps.filename.outputs.filename }}
|
||
if-no-files-found: error
|
||
|
||
build-storage:
|
||
name: Build Storage
|
||
runs-on: ubuntu-latest
|
||
env:
|
||
CARGO_PROFILE_RELEASE_DEBUG: '1'
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- name: Setup Node.js
|
||
uses: ./.github/actions/setup-node
|
||
with:
|
||
extra-flags: workspaces focus @affine/storage
|
||
electron-install: false
|
||
- name: Build Rust
|
||
uses: ./.github/actions/build-rust
|
||
with:
|
||
target: 'x86_64-unknown-linux-gnu'
|
||
package: '@affine/storage'
|
||
nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
|
||
- name: Upload storage.node
|
||
uses: actions/upload-artifact@v4
|
||
with:
|
||
name: storage.node
|
||
path: ./packages/backend/storage/storage.node
|
||
if-no-files-found: error
|
||
|
||
build-core:
|
||
name: Build @affine/core
|
||
runs-on: ubuntu-latest
|
||
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- name: Setup Node.js
|
||
uses: ./.github/actions/setup-node
|
||
with:
|
||
electron-install: false
|
||
full-cache: true
|
||
- name: Build Core
|
||
# always skip cache because its fast, and cache configuration is always changing
|
||
run: yarn nx build @affine/core --skip-nx-cache
|
||
- name: zip core
|
||
run: tar -czf dist.tar.gz --directory=packages/frontend/core/dist .
|
||
- name: Upload core artifact
|
||
uses: actions/upload-artifact@v4
|
||
with:
|
||
name: core
|
||
path: dist.tar.gz
|
||
if-no-files-found: error
|
||
|
||
server-test:
|
||
name: Server Test
|
||
runs-on: ubuntu-latest
|
||
needs: build-storage
|
||
env:
|
||
DISTRIBUTION: browser
|
||
services:
|
||
postgres:
|
||
image: postgres
|
||
env:
|
||
POSTGRES_PASSWORD: affine
|
||
options: >-
|
||
--health-cmd pg_isready
|
||
--health-interval 10s
|
||
--health-timeout 5s
|
||
--health-retries 5
|
||
ports:
|
||
- 5432:5432
|
||
mailer:
|
||
image: mailhog/mailhog
|
||
ports:
|
||
- 1025:1025
|
||
- 8025:8025
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
|
||
- name: Setup Node.js
|
||
uses: ./.github/actions/setup-node
|
||
with:
|
||
electron-install: false
|
||
full-cache: true
|
||
|
||
- name: Download storage.node
|
||
uses: actions/download-artifact@v4
|
||
with:
|
||
name: storage.node
|
||
path: ./packages/backend/server
|
||
|
||
- name: Initialize database
|
||
run: |
|
||
psql -h localhost -U postgres -c "CREATE DATABASE affine;"
|
||
psql -h localhost -U postgres -c "CREATE USER affine WITH PASSWORD 'affine';"
|
||
psql -h localhost -U postgres -c "ALTER USER affine WITH SUPERUSER;"
|
||
env:
|
||
PGPASSWORD: affine
|
||
|
||
- name: Generate prisma client
|
||
run: |
|
||
yarn workspace @affine/server exec prisma generate
|
||
yarn workspace @affine/server exec prisma db push
|
||
env:
|
||
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
|
||
|
||
- name: Run init-db script
|
||
run: |
|
||
yarn workspace @affine/server data-migration run
|
||
yarn workspace @affine/server exec node --loader ts-node/esm/transpile-only ./scripts/init-db.ts
|
||
env:
|
||
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
|
||
|
||
- name: Run server tests
|
||
run: yarn workspace @affine/server test:coverage
|
||
env:
|
||
CARGO_TARGET_DIR: '${{ github.workspace }}/target'
|
||
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
|
||
|
||
- name: Upload server test coverage results
|
||
uses: codecov/codecov-action@v3
|
||
with:
|
||
token: ${{ secrets.CODECOV_TOKEN }}
|
||
files: ./packages/backend/server/.coverage/lcov.info
|
||
flags: server-test
|
||
name: affine
|
||
fail_ci_if_error: false
|
||
|
||
server-e2e-test:
|
||
name: ${{ matrix.tests.name }}
|
||
runs-on: ubuntu-latest
|
||
env:
|
||
DISTRIBUTION: browser
|
||
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
|
||
strategy:
|
||
fail-fast: false
|
||
matrix:
|
||
tests:
|
||
- name: 'Server E2E Test 1/3'
|
||
script: yarn workspace @affine-test/affine-cloud e2e --forbid-only --shard=1/3
|
||
- name: 'Server E2E Test 2/3'
|
||
script: yarn workspace @affine-test/affine-cloud e2e --forbid-only --shard=2/3
|
||
- name: 'Server E2E Test 3/3'
|
||
script: yarn workspace @affine-test/affine-cloud e2e --forbid-only --shard=3/3
|
||
- name: 'Server Desktop E2E Test'
|
||
script: |
|
||
yarn workspace @affine/electron build:dev
|
||
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn workspace @affine-test/affine-desktop-cloud e2e
|
||
needs:
|
||
- build-storage
|
||
- build-native
|
||
services:
|
||
postgres:
|
||
image: postgres
|
||
env:
|
||
POSTGRES_PASSWORD: affine
|
||
options: >-
|
||
--health-cmd pg_isready
|
||
--health-interval 10s
|
||
--health-timeout 5s
|
||
--health-retries 5
|
||
ports:
|
||
- 5432:5432
|
||
mailer:
|
||
image: mailhog/mailhog
|
||
ports:
|
||
- 1025:1025
|
||
- 8025:8025
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
|
||
- name: Setup Node.js
|
||
uses: ./.github/actions/setup-node
|
||
with:
|
||
playwright-install: true
|
||
hard-link-nm: false
|
||
|
||
- name: Download storage.node
|
||
uses: actions/download-artifact@v4
|
||
with:
|
||
name: storage.node
|
||
path: ./packages/backend/server
|
||
|
||
- name: Download affine.linux-x64-gnu.node
|
||
uses: actions/download-artifact@v4
|
||
with:
|
||
name: affine.linux-x64-gnu.node
|
||
path: ./packages/frontend/native
|
||
|
||
- name: Initialize database
|
||
run: |
|
||
psql -h localhost -U postgres -c "CREATE DATABASE affine;"
|
||
psql -h localhost -U postgres -c "CREATE USER affine WITH PASSWORD 'affine';"
|
||
psql -h localhost -U postgres -c "ALTER USER affine WITH SUPERUSER;"
|
||
env:
|
||
PGPASSWORD: affine
|
||
|
||
- name: Generate prisma client
|
||
run: |
|
||
yarn workspace @affine/server exec prisma generate
|
||
yarn workspace @affine/server exec prisma db push
|
||
env:
|
||
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
|
||
|
||
- name: Run init-db script
|
||
run: |
|
||
yarn workspace @affine/server data-migration run
|
||
yarn workspace @affine/server exec node --loader ts-node/esm/transpile-only ./scripts/init-db.ts
|
||
|
||
- name: ${{ matrix.tests.name }}
|
||
run: |
|
||
${{ matrix.tests.script }}
|
||
env:
|
||
DEV_SERVER_URL: http://localhost:8080
|
||
ENABLE_LOCAL_EMAIL: true
|
||
|
||
- name: Upload test results
|
||
if: ${{ failure() }}
|
||
uses: actions/upload-artifact@v4
|
||
with:
|
||
name: test-results-e2e-server
|
||
path: ./tests/affine-cloud/test-results
|
||
if-no-files-found: ignore
|
||
|
||
desktop-test:
|
||
name: Desktop Test (${{ matrix.spec.os }}, ${{ matrix.spec.platform }}, ${{ matrix.spec.arch }}, ${{ matrix.spec.target }}, ${{ matrix.spec.test }})
|
||
runs-on: ${{ matrix.spec.os }}
|
||
strategy:
|
||
fail-fast: false
|
||
# all combinations: macos-latest x64, macos-latest arm64, windows-latest x64, ubuntu-latest x64
|
||
matrix:
|
||
spec:
|
||
- {
|
||
os: macos-latest,
|
||
platform: macos,
|
||
arch: x64,
|
||
target: x86_64-apple-darwin,
|
||
test: true,
|
||
}
|
||
- {
|
||
os: macos-latest,
|
||
platform: macos,
|
||
arch: arm64,
|
||
target: aarch64-apple-darwin,
|
||
test: false,
|
||
}
|
||
- {
|
||
os: ubuntu-latest,
|
||
platform: linux,
|
||
arch: x64,
|
||
target: x86_64-unknown-linux-gnu,
|
||
test: true,
|
||
}
|
||
- {
|
||
os: windows-latest,
|
||
platform: windows,
|
||
arch: x64,
|
||
target: x86_64-pc-windows-msvc,
|
||
test: true,
|
||
}
|
||
needs:
|
||
- build-core
|
||
- build-native
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- name: Setup Node.js
|
||
uses: ./.github/actions/setup-node
|
||
timeout-minutes: 10
|
||
with:
|
||
extra-flags: workspaces focus @affine/electron @affine/monorepo @affine-test/affine-desktop
|
||
playwright-install: true
|
||
hard-link-nm: false
|
||
enableScripts: false
|
||
|
||
- name: Setup filename
|
||
id: filename
|
||
shell: bash
|
||
run: |
|
||
export PLATFORM_ARCH_ABI=$(node -e "console.log(require('@napi-rs/cli').parseTriple('${{ matrix.spec.target }}').platformArchABI)")
|
||
echo "filename=affine.$PLATFORM_ARCH_ABI.node" >> "$GITHUB_OUTPUT"
|
||
|
||
- name: Download ${{ steps.filename.outputs.filename }}
|
||
uses: actions/download-artifact@v4
|
||
with:
|
||
name: ${{ steps.filename.outputs.filename }}
|
||
path: ./packages/frontend/native
|
||
|
||
- name: Run unit tests
|
||
if: ${{ matrix.spec.test }}
|
||
shell: bash
|
||
run: yarn workspace @affine/electron vitest
|
||
|
||
- name: Download core artifact
|
||
uses: ./.github/actions/download-core
|
||
with:
|
||
path: packages/frontend/electron/resources/web-static
|
||
|
||
- name: Build Desktop Layers
|
||
run: yarn workspace @affine/electron build
|
||
|
||
- name: Run desktop tests
|
||
if: ${{ matrix.spec.test && matrix.spec.os == 'ubuntu-latest' }}
|
||
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn workspace @affine-test/affine-desktop e2e
|
||
|
||
- name: Run desktop tests
|
||
if: ${{ matrix.spec.test && matrix.spec.os != 'ubuntu-latest' }}
|
||
run: yarn workspace @affine-test/affine-desktop e2e
|
||
|
||
- name: Make bundle
|
||
if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }}
|
||
env:
|
||
SKIP_BUNDLE: true
|
||
SKIP_WEB_BUILD: true
|
||
HOIST_NODE_MODULES: 1
|
||
run: yarn workspace @affine/electron package --platform=darwin --arch=arm64
|
||
|
||
- name: Output check
|
||
if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }}
|
||
run: |
|
||
yarn workspace @affine/electron exec node --loader ts-node/esm/transpile-only ./scripts/macos-arm64-output-check.ts
|
||
|
||
- name: Upload test results
|
||
if: ${{ failure() }}
|
||
uses: actions/upload-artifact@v4
|
||
with:
|
||
name: test-results-e2e-${{ matrix.spec.os }}-${{ matrix.spec.arch }}
|
||
path: ./test-results
|
||
if-no-files-found: ignore
|