Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

CI: use self-hosted runner if developer can create a branch in the up-stream repo (#5791)

Nathan.fooo43b250ec2875
diff --git a/.github/workflows/docker_ci.yml b/.github/workflows/docker_ci.yml
index 2c2143c1fe..e91a82af16 100644
--- a/.github/workflows/docker_ci.yml
+++ b/.github/workflows/docker_ci.yml
@@ -13,7 +13,7 @@ on:
- release/*
paths:
- frontend/**
- types: [opened, synchronize, reopened, unlocked, ready_for_review]
+ types: [ opened, synchronize, reopened, unlocked, ready_for_review ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
diff --git a/.github/workflows/ios_ci.yaml b/.github/workflows/ios_ci.yaml
index d24eaed1f3..fdabc29eb3 100644
--- a/.github/workflows/ios_ci.yaml
+++ b/.github/workflows/ios_ci.yaml
@@ -28,20 +28,35 @@ concurrency:
cancel-in-progress: true
jobs:
- build:
- if: github.event.pull_request.draft != true
- strategy:
- fail-fast: true
- matrix:
- os: [ macos-14 ]
- runs-on: ${{ matrix.os }}
+ build-self-hosted:
+ if: github.event.pull_request.head.repo.full_name == github.repository
+ runs-on: self-hosted
+
+ steps:
+ - name: Checkout source code
+ uses: actions/checkout@v2
+
+ - name: Build AppFlowy
+ working-directory: frontend
+ run: |
+ cargo make --profile development-ios-arm64-sim appflowy-core-dev-ios
+ cargo make --profile development-ios-arm64-sim code_generation
+
+ - uses: futureware-tech/simulator-action@v3
+ id: simulator-action
+ with:
+ model: 'iPhone 15'
+ shutdown_after_job: false
+
+ build-macos:
+ if: github.event.pull_request.head.repo.full_name != github.repository
+ runs-on: macos-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install Rust toolchain
- id: rust_toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
@@ -49,8 +64,7 @@ jobs:
override: true
profile: minimal
- - name: Install flutter
- id: flutter
+ - name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
@@ -59,7 +73,7 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
- prefix-key: ${{ matrix.os }}
+ prefix-key: macos-latest
workspaces: |
frontend/rust-lib
diff --git a/.github/workflows/rust_ci.yaml b/.github/workflows/rust_ci.yaml
index 47781a2105..d1ccdb7cb1 100644
--- a/.github/workflows/rust_ci.yaml
+++ b/.github/workflows/rust_ci.yaml
@@ -23,17 +23,49 @@ env:
RUST_TOOLCHAIN: "1.77.2"
jobs:
- test-on-ubuntu:
+ self-hosted-job:
+ if: github.event.pull_request.head.repo.full_name == github.repository
+ runs-on: self-hosted
+ steps:
+ - name: Checkout source code
+ uses: actions/checkout@v4
+
+ - name: Checkout Appflowy Cloud
+ uses: actions/checkout@v4
+ with:
+ repository: AppFlowy-IO/AppFlowy-Cloud
+ path: AppFlowy-Cloud
+
+ - name: Prepare Appflowy Cloud env
+ working-directory: AppFlowy-Cloud
+ run: |
+ cp deploy.env .env
+ sed -i '' 's|RUST_LOG=.*|RUST_LOG=trace|' .env
+ sed -i '' 's|API_EXTERNAL_URL=.*|API_EXTERNAL_URL=http://localhost|' .env
+
+ - name: Run rust-lib tests
+ working-directory: frontend/rust-lib
+ env:
+ RUST_LOG: info
+ RUST_BACKTRACE: 1
+ af_cloud_test_base_url: http://localhost
+ af_cloud_test_ws_url: ws://localhost/ws/v1
+ af_cloud_test_gotrue_url: http://localhost/gotrue
+ run: |
+ DISABLE_CI_TEST_LOG="true" cargo test --no-default-features --features="dart"
+
+ - name: rustfmt rust-lib
+ run: cargo fmt --all -- --check
+ working-directory: frontend/rust-lib/
+
+ - name: clippy rust-lib
+ run: cargo clippy --all-targets -- -D warnings
+ working-directory: frontend/rust-lib
+
+ ubuntu-job:
+ if: github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- # - name: Maximize build space
- # uses: easimon/maximize-build-space@master
- # with:
- # root-reserve-mb: 2048
- # swap-size-mb: 1024
- # remove-dotnet: 'true'
-
- # the following step is required to avoid running out of space
- name: Maximize build space
run: |
sudo rm -rf /usr/share/dotnet
@@ -46,7 +78,6 @@ jobs:
uses: actions/checkout@v4
- name: Install Rust toolchain
- id: rust_toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
@@ -55,7 +86,7 @@ jobs:
profile: minimal
- uses: Swatinem/rust-cache@v2
with:
- prefix-key: "ubuntu-latest"
+ prefix-key: ${{ runner.os }}
cache-on-failure: true
workspaces: |
frontend/rust-lib
@@ -69,7 +100,6 @@ jobs:
- name: Prepare appflowy cloud env
working-directory: AppFlowy-Cloud
run: |
- # log level
cp deploy.env .env
sed -i 's|RUST_LOG=.*|RUST_LOG=trace|' .env
sed -i 's|API_EXTERNAL_URL=.*|API_EXTERNAL_URL=http://localhost|' .env
diff --git a/.github/workflows/tauri2_ci.yaml b/.github/workflows/tauri2_ci.yaml
index 28414f0997..ac3766d4f3 100644
--- a/.github/workflows/tauri2_ci.yaml
+++ b/.github/workflows/tauri2_ci.yaml
@@ -1,4 +1,5 @@
name: Tauri-CI
+
on:
pull_request:
paths:
@@ -17,22 +18,45 @@ concurrency:
cancel-in-progress: true
jobs:
- tauri-build:
- if: github.event.pull_request.draft != true
- strategy:
- fail-fast: false
- matrix:
- platform: [ ubuntu-20.04 ]
-
- runs-on: ${{ matrix.platform }}
+ tauri-build-self-hosted:
+ if: github.event.pull_request.head.repo.full_name == github.repository
+ runs-on: self-hosted
env:
CI: true
+
steps:
- uses: actions/checkout@v4
+ - name: install frontend dependencies
+ working-directory: frontend/appflowy_web_app
+ run: |
+ mkdir dist
+ pnpm install
+ cd src-tauri && cargo build
+
+ - name: test and lint
+ working-directory: frontend/appflowy_web_app
+ run: |
+ pnpm run lint:tauri
+ - uses: tauri-apps/tauri-action@v0
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ tauriScript: pnpm tauri
+ projectPath: frontend/appflowy_web_app
+ args: "--debug"
+
+ tauri-build-ubuntu:
+ if: github.event.pull_request.head.repo.full_name != github.repository
+ runs-on: ubuntu-latest
+
+ env:
+ CI: true
+
+ steps:
- name: Maximize build space (ubuntu only)
- if: matrix.platform == 'ubuntu-20.04'
+ if: matrix.os == 'ubuntu-latest'
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
@@ -73,14 +97,14 @@ jobs:
key: node-modules-${{ runner.os }}
- name: install dependencies (windows only)
- if: matrix.platform == 'windows-latest'
+ if: matrix.os == 'windows-latest'
working-directory: frontend
run: |
cargo install --force duckscript_cli
vcpkg integrate install
- name: install dependencies (ubuntu only)
- if: matrix.platform == 'ubuntu-20.04'
+ if: matrix.os == 'ubuntu-latest'
working-directory: frontend
run: |
sudo apt-get update