Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: speed up flutter ci #29

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 39 additions & 27 deletions .github/actions/flutter_build/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Flutter Integration Test
description: Run integration tests for AppFlowy
name: Flutter Build
description: Build AppFlowy Flutter app

inputs:
os:
description: "The operating system to run the tests on"
description: "The operating system to run the build on"
required: true
flutter_version:
description: "The version of Flutter to use"
Expand All @@ -28,8 +28,16 @@ runs:
- name: Checkout source code
uses: actions/checkout@v4

- name: Cache Flutter dependencies
uses: actions/cache@v3
with:
path: |
~/.pub-cache
~/.cargo
~/.rustup
key: ${{ runner.os }}-flutter-rust-${{ hashFiles('**/pubspec.lock', '**/Cargo.lock') }}

- name: Install Rust toolchain
id: rust_toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ inputs.rust_toolchain }}
Expand All @@ -38,12 +46,10 @@ runs:
profile: minimal

- name: Install flutter
id: flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: ${{ inputs.flutter_version }}
cache: true

- uses: Swatinem/rust-cache@v2
with:
Expand All @@ -52,34 +58,35 @@ runs:
frontend/rust-lib
cache-all-crates: true

- uses: taiki-e/install-action@v2
- name: Install cargo-make and duckscript_cli
uses: taiki-e/install-action@v2
with:
tool: cargo-make@${{ inputs.cargo_make_version }}, duckscript_cli

- name: Install prerequisites
working-directory: frontend
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub
sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list
sudo apt-get update
sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev keybinder-3.0 libnotify-dev libmpv-dev mpv
elif [ "$RUNNER_OS" == "Windows" ]; then
vcpkg integrate install
elif [ "$RUNNER_OS" == "macOS" ]; then
echo 'do nothing'
fi
case $RUNNER_OS in
Linux)
sudo apt-get update
sudo apt-get install -y curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev keybinder-3.0 libnotify-dev libmpv-dev mpv
;;
Windows)
vcpkg integrate install
;;
macOS)
echo 'No additional prerequisites needed for macOS'
;;
esac
cargo make appflowy-flutter-deps-tools
shell: bash

- name: Build AppFlowy
- name: Build AppFlowy and run code generation
working-directory: frontend
run: cargo make --profile ${{ inputs.flutter_profile }} appflowy-core-dev
shell: bash

- name: Run code generation
working-directory: frontend
run: cargo make code_generation
run: |
cargo make --profile ${{ inputs.flutter_profile }} appflowy-core-dev &
cargo make code_generation &
wait
shell: bash

- name: Flutter Analyzer
Expand All @@ -88,10 +95,15 @@ runs:
shell: bash

- name: Compress appflowy_flutter
run: tar -czf appflowy_flutter.tar.gz frontend/appflowy_flutter
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
7z a -tzip appflowy_flutter.zip frontend/appflowy_flutter
else
tar -czf appflowy_flutter.tar.gz frontend/appflowy_flutter
fi
shell: bash

- uses: actions/upload-artifact@v4
with:
name: ${{ github.run_id }}-${{ matrix.os }}
path: appflowy_flutter.tar.gz
name: ${{ github.run_id }}-${{ inputs.os }}
path: appflowy_flutter.*
35 changes: 25 additions & 10 deletions .github/actions/flutter_integration_test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ runs:
- name: Checkout source code
uses: actions/checkout@v4

- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-rust-

- name: Install Rust toolchain
id: rust_toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -42,22 +53,27 @@ runs:
flutter-version: ${{ inputs.flutter_version }}
cache: true

- uses: taiki-e/install-action@v2
- name: Cache Flutter dependencies
uses: actions/cache@v3
with:
path: ${{ env.PUB_CACHE }}
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-

- name: Install cargo-make
uses: taiki-e/install-action@v2
with:
tool: cargo-make@${{ inputs.cargo_make_version }}

- name: Install prerequisites
working-directory: frontend
- name: Install system dependencies
run: |
sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub
sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list
sudo apt-get update
sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev keybinder-3.0 libnotify-dev network-manager libmpv-dev mpv
sudo apt-get install -y curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev keybinder-3.0 libnotify-dev network-manager
shell: bash

- name: Enable Flutter Desktop
run: |
flutter config --enable-linux-desktop
run: flutter config --enable-linux-desktop
shell: bash

- uses: actions/download-artifact@v4
Expand All @@ -73,6 +89,5 @@ runs:
run: |
export DISPLAY=:99
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
sudo apt-get install network-manager
flutter test ${{ inputs.test_path }} -d Linux --coverage
shell: bash
shell: bash
12 changes: 6 additions & 6 deletions frontend/appflowy_flutter/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1559,10 +1559,10 @@ packages:
dependency: transitive
description:
name: platform
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65"
url: "https://pub.dev"
source: hosted
version: "3.1.4"
version: "3.1.5"
plugin_platform_interface:
dependency: "direct dev"
description:
Expand Down Expand Up @@ -1989,10 +1989,10 @@ packages:
dependency: transitive
description:
name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
version: "1.3.0"
string_validator:
dependency: "direct main"
description:
Expand Down Expand Up @@ -2311,10 +2311,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
url: "https://pub.dev"
source: hosted
version: "14.2.1"
version: "14.2.5"
watcher:
dependency: transitive
description:
Expand Down
Loading