Skip to content

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.

ci: add graphite ci optimizer and update job dependencies (#9362)

devin-ai-integrationf336d6886652
diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml
index 0674eb4854..4d87525047 100644
--- a/.github/workflows/build-test.yml
+++ b/.github/workflows/build-test.yml
@@ -27,9 +27,24 @@ concurrency:
cancel-in-progress: true
jobs:
+ optimize_ci:
+ name: Optimize CI
+ runs-on: ubuntu-latest
+ outputs:
+ skip: ${{ steps.graphite.outputs.skip }}
+ steps:
+ - uses: actions/checkout@v4
+ - name: Graphite CI Optimizer
+ uses: withgraphite/graphite-ci-action@main
+ id: graphite
+ with:
+ token: ${{ secrets.GRAPHITE_CI_OPTIMIZER_TOKEN }}
+
analyze:
name: Analyze
runs-on: ubuntu-latest
+ needs: optimize_ci
+ if: needs.optimize_ci.outputs.skip == 'false'
permissions:
actions: read
contents: read
@@ -77,6 +92,8 @@ jobs:
lint:
name: Lint
runs-on: ubuntu-latest
+ needs: optimize_ci
+ if: needs.optimize_ci.outputs.skip == 'false'
steps:
- uses: actions/checkout@v4
@@ -105,6 +122,8 @@ jobs:
check-yarn-binary:
name: Check yarn binary
runs-on: ubuntu-latest
+ needs: optimize_ci
+ if: needs.optimize_ci.outputs.skip == 'false'
steps:
- uses: actions/checkout@v4
- name: Run check
@@ -115,6 +134,8 @@ jobs:
e2e-legacy-blocksuite-test:
name: Legacy Blocksuite E2E Test
runs-on: ubuntu-latest
+ needs: optimize_ci
+ if: needs.optimize_ci.outputs.skip == 'false'
strategy:
fail-fast: false
matrix:
@@ -145,6 +166,8 @@ jobs:
e2e-test:
name: E2E Test
runs-on: ubuntu-latest
+ needs: optimize_ci
+ if: needs.optimize_ci.outputs.skip == 'false'
env:
DISTRIBUTION: web
IN_CI_TEST: true
@@ -175,6 +198,8 @@ jobs:
e2e-mobile-test:
name: E2E Mobile Test
runs-on: ubuntu-latest
+ needs: optimize_ci
+ if: needs.optimize_ci.outputs.skip == 'false'
env:
DISTRIBUTION: mobile
IN_CI_TEST: true
@@ -206,7 +231,9 @@ jobs:
name: Unit Test
runs-on: ubuntu-latest
needs:
+ - optimize_ci
- build-native
+ if: needs.optimize_ci.outputs.skip == 'false'
env:
DISTRIBUTION: web
strategy:
@@ -243,6 +270,8 @@ jobs:
build-native:
name: Build AFFiNE native (${{ matrix.spec.target }})
runs-on: ${{ matrix.spec.os }}
+ needs: optimize_ci
+ if: needs.optimize_ci.outputs.skip == 'false'
env:
CARGO_PROFILE_RELEASE_DEBUG: '1'
strategy:
@@ -330,7 +359,10 @@ jobs:
server-test:
name: Server Test
runs-on: ubuntu-latest
- needs: build-server-native
+ needs:
+ - optimize_ci
+ - build-server-native
+ if: needs.optimize_ci.outputs.skip == 'false'
env:
NODE_ENV: test
DISTRIBUTION: web
@@ -410,7 +442,9 @@ jobs:
name: Server Copilot Api Test
runs-on: ubuntu-latest
needs:
+ - optimize_ci
- build-server-native
+ if: needs.optimize_ci.outputs.skip == 'false'
env:
NODE_ENV: test
DISTRIBUTION: web
@@ -576,6 +610,11 @@ jobs:
server-e2e-test:
name: ${{ matrix.tests.name }}
runs-on: ubuntu-latest
+ needs:
+ - optimize_ci
+ - build-server-native
+ - build-native
+ if: needs.optimize_ci.outputs.skip == 'false'
env:
DISTRIBUTION: web
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
@@ -599,9 +638,6 @@ jobs:
# 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 affine @affine-test/affine-desktop-cloud e2e
- needs:
- - build-server-native
- - build-native
services:
postgres:
image: postgres
@@ -666,6 +702,11 @@ jobs:
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 }}
+ needs:
+ - optimize_ci
+ - build-electron-renderer
+ - build-native
+ if: needs.optimize_ci.outputs.skip == 'false'
strategy:
fail-fast: false
matrix:
@@ -698,9 +739,6 @@ jobs:
target: x86_64-pc-windows-msvc,
test: true,
}
- needs:
- - build-electron-renderer
- - build-native
steps:
- uses: actions/checkout@v4
- name: Setup Node.js