Merge pull request #829 from Binlogo/ci/speed-up-by-caching-dep

chore: speed up ci by respecting the cargo deps cache
This commit is contained in:
Lucas.Xu 2022-08-15 09:59:16 +08:00 committed by GitHub
commit f6fad26e5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 74 additions and 40 deletions

View File

@ -3,11 +3,11 @@ name: CI
on:
push:
branches:
- 'main'
- "main"
pull_request:
branches:
- 'main'
- "main"
jobs:
build:
@ -27,16 +27,17 @@ jobs:
- id: rust_toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 'stable-2022-01-20'
toolchain: "stable-2022-01-20"
- id: flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
channel: "stable"
cache: true
flutter-version: '3.0.5'
flutter-version: "3.0.5"
- name: Cache Cargo
id: cache-cargo
uses: actions/cache@v2
with:
path: |
@ -63,11 +64,16 @@ jobs:
fi
shell: bash
- name: Deps
- if: steps.cache-cargo.outputs.cache-hit != 'true'
name: Deps
working-directory: frontend
run: |
cargo install cargo-make
cargo install duckscript_cli
- name: Cargo make flowy_dev
working-directory: frontend
run: |
cargo make flowy_dev
- name: Config Flutter

View File

@ -23,16 +23,38 @@ jobs:
uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
with:
flutter-version: '3.0.5'
flutter-version: "3.0.5"
channel: "stable"
- uses: actions-rs/toolchain@v1
with:
toolchain: 'stable-2022-01-20'
toolchain: "stable-2022-01-20"
- name: Rust Deps
- name: Cache Cargo
id: cache-cargo
uses: actions/cache@v2
with:
path: |
~/.cargo
key: ${{ runner.os }}-cargo-${{ steps.rust_toolchain.outputs.rustc_hash }}-${{ hashFiles('./frontend/rust-lib/Cargo.toml') }}
- name: Cache Rust
id: cache-rust-target
uses: actions/cache@v2
with:
path: |
frontend/rust-lib/target
shared-lib/target
key: ${{ runner.os }}-rust-rust-lib-share-lib-${{ steps.rust_toolchain.outputs.rustc_hash }}-${{ hashFiles('./frontend/rust-lib/Cargo.toml') }}
- if: steps.cache-cargo.outputs.cache-hit != 'true'
name: Rust Deps
working-directory: frontend
run: |
cargo install cargo-make
- name: Cargo make flowy dev
working-directory: frontend
run: |
cargo make flowy_dev
- name: Flutter Deps
@ -53,4 +75,3 @@ jobs:
- name: Run Flutter Analyzer
working-directory: frontend/app_flowy
run: flutter analyze

View File

@ -3,12 +3,12 @@ name: Unit test(Flutter)
on:
push:
branches:
- 'main'
- "main"
pull_request:
branches:
- 'main'
- 'feat/flowy_editor'
- "main"
- "feat/flowy_editor"
env:
CARGO_TERM_COLOR: always
@ -21,12 +21,12 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
toolchain: 'stable-2022-01-20'
toolchain: "stable-2022-01-20"
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.0.5'
channel: "stable"
flutter-version: "3.0.5"
cache: true
- name: Cache Cargo
@ -37,6 +37,7 @@ jobs:
key: ${{ runner.os }}-cargo-${{ steps.rust_toolchain.outputs.rustc_hash }}-${{ hashFiles('./frontend/rust-lib/Cargo.toml') }}
- name: Cache Rust
id: cache-rust-target
uses: actions/cache@v2
with:
path: |
@ -44,16 +45,22 @@ jobs:
shared-lib/target
key: ${{ runner.os }}-rust-rust-lib-share-lib-${{ steps.rust_toolchain.outputs.rustc_hash }}-${{ hashFiles('./frontend/rust-lib/Cargo.toml') }}
- if: steps.cache-cargo.outputs.cache-hit != 'true'
name: Rust Deps
working-directory: frontend
run: |
cargo install cargo-make
- name: Cargo make flowy dev
working-directory: frontend
run: |
cargo make flowy_dev
- name: Flutter Deps
working-directory: frontend/app_flowy
run: |
flutter config --enable-linux-desktop
- name: Rust Deps
working-directory: frontend
run: |
cargo install cargo-make
cargo make flowy_dev
- name: Build FlowySDK
working-directory: frontend
run: |