2023-01-03 14:34:55 +00:00
|
|
|
name: Rust-CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- "main"
|
2023-04-28 12:47:40 +00:00
|
|
|
- "develop"
|
2023-01-03 14:34:55 +00:00
|
|
|
- "release/*"
|
|
|
|
paths:
|
|
|
|
- "frontend/rust-lib/**"
|
|
|
|
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- "main"
|
2023-04-28 12:47:40 +00:00
|
|
|
- "develop"
|
2023-01-03 14:34:55 +00:00
|
|
|
- "release/*"
|
|
|
|
paths:
|
|
|
|
- "frontend/rust-lib/**"
|
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
2023-12-29 17:22:06 +00:00
|
|
|
RUST_TOOLCHAIN: "1.75"
|
2023-01-03 14:34:55 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
test-on-ubuntu:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-01-03 14:55:30 +00:00
|
|
|
- name: Checkout source code
|
2024-02-17 13:38:12 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-01-03 14:55:30 +00:00
|
|
|
|
2023-01-03 14:34:55 +00:00
|
|
|
- name: Install Rust toolchain
|
|
|
|
id: rust_toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
|
|
override: true
|
|
|
|
components: rustfmt, clippy
|
|
|
|
profile: minimal
|
|
|
|
|
|
|
|
- name: Install prerequisites
|
|
|
|
working-directory: frontend
|
|
|
|
run: |
|
|
|
|
cargo install --force cargo-make
|
|
|
|
cargo install --force duckscript_cli
|
|
|
|
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
with:
|
2024-02-17 13:38:12 +00:00
|
|
|
prefix-key: "ubuntu-latest"
|
2023-06-05 10:28:36 +00:00
|
|
|
workspaces: |
|
2023-08-17 15:46:39 +00:00
|
|
|
frontend/rust-lib
|
|
|
|
|
2023-12-25 18:03:42 +00:00
|
|
|
- name: Checkout appflowy cloud code
|
2024-02-17 13:38:12 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-12-25 18:03:42 +00:00
|
|
|
with:
|
|
|
|
repository: AppFlowy-IO/AppFlowy-Cloud
|
|
|
|
path: AppFlowy-Cloud
|
|
|
|
|
|
|
|
- name: Prepare appflowy cloud env
|
|
|
|
working-directory: AppFlowy-Cloud
|
|
|
|
run: |
|
|
|
|
# log level
|
2024-01-15 04:53:53 +00:00
|
|
|
cp deploy.env .env
|
2023-12-25 18:03:42 +00:00
|
|
|
sed -i 's|RUST_LOG=.*|RUST_LOG=trace|' .env
|
|
|
|
sed -i 's|API_EXTERNAL_URL=.*|API_EXTERNAL_URL=http://localhost|' .env
|
|
|
|
|
|
|
|
- name: Run Docker-Compose
|
|
|
|
working-directory: AppFlowy-Cloud
|
|
|
|
run: |
|
2024-01-15 04:53:53 +00:00
|
|
|
docker pull appflowyinc/appflowy_cloud:latest
|
2023-12-25 18:03:42 +00:00
|
|
|
docker compose up -d
|
|
|
|
|
2023-06-07 14:27:13 +00:00
|
|
|
- name: Run rust-lib tests
|
|
|
|
working-directory: frontend/rust-lib
|
2024-01-15 04:53:53 +00:00
|
|
|
env:
|
|
|
|
RUST_LOG: info
|
|
|
|
RUST_BACKTRACE: 1
|
|
|
|
af_cloud_test_base_url: http://localhost
|
|
|
|
af_cloud_test_ws_url: ws://localhost/ws
|
|
|
|
af_cloud_test_gotrue_url: http://localhost/gotrue
|
2024-01-29 21:36:27 +00:00
|
|
|
run: cargo test --no-default-features --features="rev-sqlite,dart" -- --nocapture
|
2024-01-15 04:53:53 +00:00
|
|
|
|
2023-01-03 14:34:55 +00:00
|
|
|
- name: rustfmt rust-lib
|
|
|
|
run: cargo fmt --all -- --check
|
|
|
|
working-directory: frontend/rust-lib/
|
|
|
|
|
|
|
|
- name: clippy rust-lib
|
2023-12-29 17:22:06 +00:00
|
|
|
run: cargo clippy --all-targets -- -D warnings
|
2024-01-16 18:59:15 +00:00
|
|
|
working-directory: frontend/rust-lib
|