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/**"
|
|
|
|
- "shared-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/**"
|
|
|
|
- "shared-lib/**"
|
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
2023-06-09 14:23:07 +00:00
|
|
|
RUST_TOOLCHAIN: "1.70"
|
2023-01-03 14:34:55 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
test-on-ubuntu:
|
2023-12-27 03:42:39 +00:00
|
|
|
# environment: SUPABASE_CI
|
2023-01-03 14:34:55 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-01-03 14:55:30 +00:00
|
|
|
- name: Checkout source code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
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:
|
2023-06-05 10:28:36 +00:00
|
|
|
prefix-key: 'ubuntu-latest'
|
|
|
|
workspaces: |
|
2023-08-17 15:46:39 +00:00
|
|
|
frontend/rust-lib
|
|
|
|
|
2023-12-27 03:42:39 +00:00
|
|
|
# - name: Create .env file in flowy-server
|
|
|
|
# working-directory: frontend/rust-lib/flowy-server
|
|
|
|
# run: |
|
|
|
|
# touch .env.ci
|
|
|
|
# echo SUPABASE_URL=${{ secrets.SUPABASE_URL }} >> .env.ci
|
|
|
|
# echo SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }} >> .env.ci
|
|
|
|
# echo SUPABASE_JWT_SECRET=${{ secrets.SUPABASE_JWT_SECRET }} >> .env.ci
|
|
|
|
#
|
|
|
|
# - name: Create .env file in event-integration
|
|
|
|
# working-directory: frontend/rust-lib/event-integration
|
|
|
|
# run: |
|
|
|
|
# touch .env.ci
|
|
|
|
# echo SUPABASE_URL=${{ secrets.SUPABASE_URL }} >> .env.ci
|
|
|
|
# echo SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }} >> .env.ci
|
|
|
|
# echo SUPABASE_JWT_SECRET=${{ secrets.SUPABASE_JWT_SECRET }} >> .env.ci
|
2023-01-03 14:34:55 +00:00
|
|
|
|
2023-12-25 18:03:42 +00:00
|
|
|
- name: Checkout appflowy cloud code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
repository: AppFlowy-IO/AppFlowy-Cloud
|
|
|
|
path: AppFlowy-Cloud
|
|
|
|
depth: 1
|
|
|
|
|
|
|
|
- name: Prepare appflowy cloud env
|
|
|
|
working-directory: AppFlowy-Cloud
|
|
|
|
run: |
|
|
|
|
# log level
|
|
|
|
cp dev.env .env
|
|
|
|
sed -i 's|RUST_LOG=.*|RUST_LOG=trace|' .env
|
|
|
|
sed -i 's/GOTRUE_SMTP_USER=.*/GOTRUE_SMTP_USER=${{ secrets.INTEGRATION_TEST_GOTRUE_SMTP_USER }}/' .env
|
|
|
|
sed -i 's/GOTRUE_SMTP_PASS=.*/GOTRUE_SMTP_PASS=${{ secrets.INTEGRATION_TEST_GOTRUE_SMTP_PASS }}/' .env
|
|
|
|
sed -i 's/GOTRUE_SMTP_ADMIN_EMAIL=.*/GOTRUE_SMTP_ADMIN_EMAIL=${{ secrets.INTEGRATION_TEST_GOTRUE_SMTP_ADMIN_EMAIL }}/' .env
|
|
|
|
sed -i 's/GOTRUE_EXTERNAL_GOOGLE_ENABLED=.*/GOTRUE_EXTERNAL_GOOGLE_ENABLED=true/' .env
|
|
|
|
sed -i 's|API_EXTERNAL_URL=.*|API_EXTERNAL_URL=http://localhost|' .env
|
|
|
|
|
|
|
|
- name: Run Docker-Compose
|
|
|
|
working-directory: AppFlowy-Cloud
|
|
|
|
run: |
|
2023-12-27 03:42:39 +00:00
|
|
|
docker compose down -v --remove-orphans
|
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
|
|
|
|
run: RUST_LOG=info RUST_BACKTRACE=1 cargo test --no-default-features --features="rev-sqlite"
|
|
|
|
|
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-08-17 15:46:39 +00:00
|
|
|
run: cargo clippy --all
|
2023-07-30 00:39:01 +00:00
|
|
|
working-directory: frontend/rust-lib
|