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
|
2024-04-23 13:46:57 +00:00
|
|
|
RUST_TOOLCHAIN: "1.77.2"
|
2023-01-03 14:34:55 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
test-on-ubuntu:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-04-12 17:08:47 +00:00
|
|
|
# - name: Maximize build space
|
|
|
|
# uses: easimon/maximize-build-space@master
|
|
|
|
# with:
|
|
|
|
# root-reserve-mb: 2048
|
|
|
|
# swap-size-mb: 1024
|
|
|
|
# remove-dotnet: 'true'
|
2024-04-12 08:21:41 +00:00
|
|
|
|
2024-06-12 15:08:55 +00:00
|
|
|
# the following step is required to avoid running out of space
|
|
|
|
- name: Maximize build space
|
|
|
|
run: |
|
|
|
|
sudo rm -rf /usr/share/dotnet
|
|
|
|
sudo rm -rf /opt/ghc
|
|
|
|
sudo rm -rf "/usr/local/share/boost"
|
|
|
|
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
|
|
|
sudo docker image prune --all --force
|
2024-03-07 04:50:28 +00:00
|
|
|
|
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
|
2024-04-24 06:38:47 +00:00
|
|
|
env:
|
|
|
|
BACKEND_VERSION: 0.3.24-amd64
|
2023-12-25 18:03:42 +00:00
|
|
|
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
|
2024-03-10 08:02:30 +00:00
|
|
|
af_cloud_test_ws_url: ws://localhost/ws/v1
|
2024-01-15 04:53:53 +00:00
|
|
|
af_cloud_test_gotrue_url: http://localhost/gotrue
|
2024-03-30 08:28:24 +00:00
|
|
|
run: |
|
2024-05-05 14:04:34 +00:00
|
|
|
DISABLE_CI_TEST_LOG="true" cargo test --no-default-features --features="dart"
|
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
|
2024-03-07 04:50:28 +00:00
|
|
|
|
|
|
|
- name: Clean up Docker images
|
|
|
|
run: |
|
|
|
|
docker image prune -af
|
|
|
|
docker volume prune -f
|