Skip to content

Commit

Permalink
chore: update commands
Browse files Browse the repository at this point in the history
  • Loading branch information
forehalo committed Dec 20, 2024
1 parent a3f19cd commit ed1ca53
Show file tree
Hide file tree
Showing 22 changed files with 107 additions and 122 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ corepack prepare yarn@stable --activate
yarn install

# Build Server Dependencies
yarn workspace @affine/server-native build
yarn affine @affine/server-native build

# Create database
yarn workspace @affine/server prisma db push
yarn affine @affine/server prisma db push
3 changes: 1 addition & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@
}
},
"updateContentCommand": "bash ./.devcontainer/build.sh",
"postCreateCommand": "bash ./.devcontainer/setup-user.sh",
"postStartCommand": ["yarn dev", "yarn workspace @affine/server dev"]
"postCreateCommand": "bash ./.devcontainer/setup-user.sh"
}
2 changes: 1 addition & 1 deletion .github/actions/build-rust/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ runs:
- name: Build
shell: bash
run: |
yarn workspace ${{ inputs.package }} build --target ${{ inputs.target }} --use-napi-cross
yarn affine ${{ inputs.package }} build --target ${{ inputs.target }} --use-napi-cross
env:
DEBUG: 'napi:*'
2 changes: 1 addition & 1 deletion .github/actions/copilot-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: 'Run Copilot E2E Test'
inputs:
script:
description: 'Script to run'
default: 'yarn workspace @affine-test/affine-cloud-copilot e2e --forbid-only'
default: 'yarn affine @affine-test/affine-cloud-copilot e2e --forbid-only'
required: false
openai-key:
description: 'OpenAI secret key'
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/server-test-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ runs:
env:
NODE_ENV: test
run: |
yarn workspace @affine/server exec prisma generate
yarn workspace @affine/server exec prisma db push
yarn workspace @affine/server data-migration run
yarn affine @affine/server prisma generate
yarn affine @affine/server prisma db push
yarn affine @affine/server data-migration run
10 changes: 5 additions & 5 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
electron-install: false
extra-flags: workspaces focus @affine/server
- name: Build Server
run: yarn workspace @affine/server build
run: yarn affine @affine/server build
- name: Upload server dist
uses: actions/upload-artifact@v4
with:
Expand All @@ -47,7 +47,7 @@ jobs:
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Build Core
run: yarn workspace @affine/web build
run: yarn affine @affine/web build
env:
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Build Admin
run: yarn workspace @affine/admin build
run: yarn affine @affine/admin build
env:
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Build Mobile
run: yarn workspace @affine/mobile build
run: yarn affine @affine/mobile build
env:
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
Expand Down Expand Up @@ -257,7 +257,7 @@ jobs:
yarn workspaces focus @affine/server --production
- name: Generate Prisma client
run: yarn workspace @affine/server prisma generate
run: yarn affine @affine/server prisma generate

- name: Setup Version
id: version
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
electron-install: false
full-cache: true
- name: Run i18n codegen
run: yarn workspace @affine/i18n build
run: yarn affine @affine/i18n build
- name: Run ESLint
run: yarn lint:eslint --max-warnings=0
- name: Run Prettier
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
full-cache: true

- name: Run playwright tests
run: yarn workspace @affine-test/affine-local e2e --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}
run: yarn affine @affine-test/affine-local e2e --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}

- name: Upload test results
if: ${{ failure() }}
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
full-cache: true

- name: Run playwright tests
run: yarn workspace @affine-test/affine-mobile e2e --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}
run: yarn affine @affine-test/affine-mobile e2e --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}

- name: Upload test results
if: ${{ failure() }}
Expand Down Expand Up @@ -341,7 +341,7 @@ jobs:
uses: ./.github/actions/server-test-env

- name: Run server tests
run: yarn workspace @affine/server test:coverage
run: yarn affine @affine/server test:coverage
env:
CARGO_TARGET_DIR: '${{ github.workspace }}/target'
COPILOT_OPENAI_API_KEY: 'use_fake_openai_api_key'
Expand Down Expand Up @@ -444,7 +444,7 @@ jobs:

- name: Run server tests
if: ${{ steps.check-blocksuite-update.outputs.skip != 'true' || steps.apifilter.outputs.changed == 'true' }}
run: yarn workspace @affine/server test:copilot:coverage --forbid-only
run: yarn affine @affine/server test:copilot:coverage --forbid-only
env:
CARGO_TARGET_DIR: '${{ github.workspace }}/target'
COPILOT_OPENAI_API_KEY: ${{ secrets.COPILOT_OPENAI_API_KEY }}
Expand Down Expand Up @@ -534,7 +534,7 @@ jobs:
if: ${{ steps.check-blocksuite-update.outputs.skip != 'true' || steps.e2efilter.outputs.changed == 'true' }}
uses: ./.github/actions/copilot-test
with:
script: yarn workspace @affine-test/affine-cloud-copilot e2e --forbid-only --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
script: yarn affine @affine-test/affine-cloud-copilot e2e --forbid-only --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
openai-key: ${{ secrets.COPILOT_OPENAI_API_KEY }}
fal-key: ${{ secrets.COPILOT_FAL_API_KEY }}

Expand All @@ -551,19 +551,19 @@ jobs:
matrix:
tests:
- name: 'Server E2E Test 1/3'
script: yarn workspace @affine-test/affine-cloud e2e --forbid-only --shard=1/3
script: yarn affine @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
script: yarn affine @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
script: yarn affine @affine-test/affine-cloud e2e --forbid-only --shard=3/3
- name: 'Server Desktop E2E Test'
script: |
yarn workspace @affine/electron build:dev
yarn affine @affine/electron build:dev
# Workaround for Electron apps failing to initialize on Ubuntu 24.04 due to AppArmor restrictions
# Disables unprivileged user namespaces restriction to allow Electron apps to run
# Reference: https://github.com/electron/electron/issues/42510
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn workspace @affine-test/affine-desktop-cloud e2e
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn affine @affine-test/affine-desktop-cloud e2e
needs:
- build-server-native
- build-native
Expand Down Expand Up @@ -693,15 +693,15 @@ jobs:
- name: Run unit tests
if: ${{ matrix.spec.test }}
shell: bash
run: yarn workspace @affine/electron vitest
run: yarn affine @affine/electron vitest

- name: Download web artifact
uses: ./.github/actions/download-web
with:
path: packages/frontend/apps/electron/resources/web-static

- name: Build Desktop Layers
run: yarn workspace @affine/electron build
run: yarn affine @affine/electron build

- name: Run desktop tests
if: ${{ matrix.spec.os == 'ubuntu-latest' }}
Expand All @@ -710,19 +710,19 @@ jobs:
# Disables unprivileged user namespaces restriction to allow Electron apps to run
# Reference: https://github.com/electron/electron/issues/42510
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn workspace @affine-test/affine-desktop e2e
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn affine @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
run: yarn affine @affine-test/affine-desktop e2e

- name: Make bundle (macOS)
if: ${{ matrix.spec.target == 'aarch64-apple-darwin' }}
env:
SKIP_BUNDLE: true
SKIP_WEB_BUILD: true
HOIST_NODE_MODULES: 1
run: yarn workspace @affine/electron package --platform=darwin --arch=arm64
run: yarn affine @affine/electron package --platform=darwin --arch=arm64

- name: Make Bundle (Linux)
run: |
Expand All @@ -732,7 +732,7 @@ jobs:
flatpak update
# some flatpak deps need git protocol.file.allow
git config --global protocol.file.allow always
yarn workspace @affine/electron make --platform=linux --arch=x64
yarn affine @affine/electron make --platform=linux --arch=x64
if: ${{ matrix.spec.target == 'x86_64-unknown-linux-gnu' }}
env:
SKIP_WEB_BUILD: 1
Expand All @@ -741,7 +741,7 @@ jobs:
- name: Output check
if: ${{ matrix.spec.os == 'macos-14' && matrix.spec.arch == 'arm64' }}
run: |
yarn workspace @affine/electron exec node --loader ts-node/esm/transpile-only ./scripts/macos-arm64-output-check.ts
yarn affine @affine/electron exec node --loader ts-node/esm/transpile-only ./scripts/macos-arm64-output-check.ts
- name: Upload test results
if: ${{ failure() }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/copilot-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
uses: ./.github/actions/server-test-env

- name: Run server tests
run: yarn workspace @affine/server test:copilot:coverage --forbid-only
run: yarn affine @affine/server test:copilot:coverage --forbid-only
env:
CARGO_TARGET_DIR: '${{ github.workspace }}/target'
COPILOT_OPENAI_API_KEY: ${{ secrets.COPILOT_OPENAI_API_KEY }}
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
- name: Run Copilot E2E Test ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
uses: ./.github/actions/copilot-test
with:
script: yarn workspace @affine-test/affine-cloud-copilot e2e --forbid-only --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
script: yarn affine @affine-test/affine-cloud-copilot e2e --forbid-only --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
openai-key: ${{ secrets.COPILOT_OPENAI_API_KEY }}
fal-key: ${{ secrets.COPILOT_FAL_API_KEY }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-title-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
- name: Check PR title
env:
TITLE: ${{ github.event.pull_request.title }}
run: echo "$TITLE" | yarn workspace @affine/commitlint-config commitlint -g ./.commitlintrc.json
run: echo "$TITLE" | yarn affine @affine/commitlint-config commitlint -g ./.commitlintrc.json
14 changes: 7 additions & 7 deletions .github/workflows/release-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Setup @sentry/cli
uses: ./.github/actions/setup-sentry
- name: generate-assets
run: yarn workspace @affine/electron generate-assets
run: yarn affine @affine/electron generate-assets
env:
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: 'affine'
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
path: packages/frontend/apps/electron/resources/web-static

- name: Build Desktop Layers
run: yarn workspace @affine/electron build
run: yarn affine @affine/electron build

- name: Signing By Apple Developer ID
if: ${{ matrix.spec.platform == 'darwin' }}
Expand All @@ -142,7 +142,7 @@ jobs:
git config --global protocol.file.allow always
- name: make
run: yarn workspace @affine/electron make --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }}
run: yarn affine @affine/electron make --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }}
env:
SKIP_WEB_BUILD: 1
HOIST_NODE_MODULES: 1
Expand Down Expand Up @@ -237,10 +237,10 @@ jobs:
path: packages/frontend/apps/electron/resources/web-static

- name: Build Desktop Layers
run: yarn workspace @affine/electron build
run: yarn affine @affine/electron build

- name: package
run: yarn workspace @affine/electron package --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }}
run: yarn affine @affine/electron package --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }}
env:
SKIP_WEB_BUILD: 1
HOIST_NODE_MODULES: 1
Expand Down Expand Up @@ -315,10 +315,10 @@ jobs:
run: Expand-Archive -Path signed.zip -DestinationPath packages/frontend/apps/electron/out

- name: Make squirrel.windows installer
run: yarn workspace @affine/electron make-squirrel --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }}
run: yarn affine @affine/electron make-squirrel --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }}

- name: Make nsis.windows installer
run: yarn workspace @affine/electron make-nsis --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }}
run: yarn affine @affine/electron make-nsis --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }}

- name: Zip artifacts for faster upload
run: Compress-Archive -CompressionLevel Fastest -Path packages/frontend/apps/electron/out/${{ env.BUILD_TYPE }}/make/* -DestinationPath archive.zip
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release-mobile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
- name: Setup @sentry/cli
uses: ./.github/actions/setup-sentry
- name: Build Mobile
run: yarn workspace @affine/ios build
run: yarn affine @affine/ios build
env:
PUBLIC_PATH: '/'
MIXPANEL_TOKEN: ${{ secrets.MIXPANEL_TOKEN }}
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
- name: Setup @sentry/cli
uses: ./.github/actions/setup-sentry
- name: Build Mobile
run: yarn workspace @affine/android build
run: yarn affine @affine/android build
env:
PUBLIC_PATH: '/'
MIXPANEL_TOKEN: ${{ secrets.MIXPANEL_TOKEN }}
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:
hard-link-nm: false
enableScripts: false
- name: Cap sync
run: yarn workspace @affine/ios cap sync
run: yarn affine @affine/ios cap sync
- name: Signing By Apple Developer ID
uses: apple-actions/import-codesign-certs@v3
id: import-codesign-certs
Expand Down Expand Up @@ -194,7 +194,7 @@ jobs:
with:
targets: 'aarch64-linux-android'
- name: Cap sync
run: yarn workspace @affine/android cap sync
run: yarn affine @affine/android cap sync
- uses: actions/setup-python@v5
with:
python-version: '3.12'
Expand All @@ -216,13 +216,13 @@ jobs:
- name: Auto increment version code
id: bump
if: ${{ env.BUILD_TARGET == 'distribution' }}
run: yarn workspace @affine/playstore-auto-bump bump
run: yarn affine @affine/playstore-auto-bump bump
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ steps.auth.outputs.credentials_file_path }}
- name: Build
run: |
echo -n "${{ env.AFFINE_ANDROID_SIGN_KEYSTORE }}" | base64 --decode > packages/frontend/apps/android/affine.keystore
yarn workspace @affine/android cap build android
yarn affine @affine/android cap build android
env:
AFFINE_ANDROID_KEYSTORE_PASSWORD: ${{ secrets.AFFINE_ANDROID_KEYSTORE_PASSWORD }}
AFFINE_ANDROID_KEYSTORE_ALIAS_PASSWORD: ${{ secrets.AFFINE_ANDROID_KEYSTORE_ALIAS_PASSWORD }}
Expand Down
4 changes: 2 additions & 2 deletions docs/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ This could take a while if you build it for the first time.
Note: use `strip` from system instead of `binutils` if you are running MacOS. [see problem here](https://github.com/toeverything/AFFiNE/discussions/2840)

```
yarn workspace @affine/native build
yarn affine @affine/native build
```

### Build Server Dependencies

```sh
yarn workspace @affine/server-native build
yarn affine @affine/server-native build
```

## Testing
Expand Down
Loading

0 comments on commit ed1ca53

Please sign in to comment.