|
| 1 | +name: integration test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "main" |
| 7 | + - "release/*" |
| 8 | + paths: |
| 9 | + - "frontend/app_flowy/**" |
| 10 | + |
| 11 | + pull_request: |
| 12 | + branches: |
| 13 | + - "main" |
| 14 | + - "release/*" |
| 15 | + paths: |
| 16 | + - "frontend/app_flowy/**" |
| 17 | + |
| 18 | +env: |
| 19 | + CARGO_TERM_COLOR: always |
| 20 | + |
| 21 | +jobs: |
| 22 | + tests: |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + os: [macos-latest] |
| 26 | + |
| 27 | + runs-on: ${{ matrix.os }} |
| 28 | + |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v2 |
| 31 | + - uses: actions-rs/toolchain@v1 |
| 32 | + with: |
| 33 | + toolchain: "stable-2022-04-07" |
| 34 | + |
| 35 | + - uses: subosito/flutter-action@v2 |
| 36 | + with: |
| 37 | + channel: "stable" |
| 38 | + flutter-version: "3.3.9" |
| 39 | + cache: true |
| 40 | + |
| 41 | + - name: Cache Cargo |
| 42 | + uses: actions/cache@v2 |
| 43 | + with: |
| 44 | + path: | |
| 45 | + ~/.cargo |
| 46 | + key: ${{ runner.os }}-cargo-${{ steps.rust_toolchain.outputs.rustc_hash }}-${{ hashFiles('./frontend/rust-lib/Cargo.toml') }} |
| 47 | + |
| 48 | + - name: Cache Rust |
| 49 | + id: cache-rust-target |
| 50 | + uses: actions/cache@v2 |
| 51 | + with: |
| 52 | + path: | |
| 53 | + frontend/rust-lib/target |
| 54 | + shared-lib/target |
| 55 | + key: ${{ runner.os }}-rust-rust-lib-share-lib-${{ steps.rust_toolchain.outputs.rustc_hash }}-${{ hashFiles('./frontend/rust-lib/Cargo.toml') }} |
| 56 | + |
| 57 | + - name: Setup Environment |
| 58 | + run: | |
| 59 | + if [ "$RUNNER_OS" == "Linux" ]; then |
| 60 | + sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub |
| 61 | + sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list |
| 62 | + sudo apt-get update |
| 63 | + sudo apt-get install -y dart curl build-essential libsqlite3-dev libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev |
| 64 | + sudo apt-get install keybinder-3.0 |
| 65 | + elif [ "$RUNNER_OS" == "Windows" ]; then |
| 66 | + vcpkg integrate install |
| 67 | + cargo install --force duckscript_cli |
| 68 | + elif [ "$RUNNER_OS" == "macOS" ]; then |
| 69 | + echo 'do nothing' |
| 70 | + fi |
| 71 | + shell: bash |
| 72 | + |
| 73 | + - if: steps.cache-cargo.outputs.cache-hit != 'true' |
| 74 | + name: Rust Deps |
| 75 | + working-directory: frontend |
| 76 | + run: | |
| 77 | + cargo install cargo-make |
| 78 | + cargo make appflowy-deps-tools |
| 79 | +
|
| 80 | + - name: Build Test lib |
| 81 | + working-directory: frontend |
| 82 | + run: | |
| 83 | + if [ "$RUNNER_OS" == "Linux" ]; then |
| 84 | + cargo make --profile production-linux-x86_64 appflowy |
| 85 | + elif [ "$RUNNER_OS" == "macOS" ]; then |
| 86 | + cargo make --profile production-mac-x86_64 appflowy |
| 87 | + elif [ "$RUNNER_OS" == "Windows" ]; then |
| 88 | + cargo make --profile production-windows-x86 appflowy |
| 89 | + fi |
| 90 | +
|
| 91 | + - name: Config Flutter |
| 92 | + run: | |
| 93 | + if [ "$RUNNER_OS" == "Linux" ]; then |
| 94 | + flutter config --enable-linux-desktop |
| 95 | + elif [ "$RUNNER_OS" == "macOS" ]; then |
| 96 | + flutter config --enable-macos-desktop |
| 97 | + elif [ "$RUNNER_OS" == "Windows" ]; then |
| 98 | + flutter config --enable-windows-desktop |
| 99 | + fi |
| 100 | + shell: bash |
| 101 | + |
| 102 | + - name: Flutter Code Generation |
| 103 | + working-directory: frontend/app_flowy |
| 104 | + run: | |
| 105 | + flutter packages pub get |
| 106 | + flutter packages pub run easy_localization:generate -f keys -o locale_keys.g.dart -S assets/translations -s en.json |
| 107 | + flutter packages pub run build_runner build --delete-conflicting-outputs |
| 108 | +
|
| 109 | + - name: Run AppFlowy tests |
| 110 | + working-directory: frontend/app_flowy |
| 111 | + run: | |
| 112 | + if [ "$RUNNER_OS" == "Linux" ]; then |
| 113 | + flutter test integration_test -d Linux --coverage |
| 114 | + elif [ "$RUNNER_OS" == "macOS" ]; then |
| 115 | + flutter test integration_test -d macOS --coverage |
| 116 | + elif [ "$RUNNER_OS" == "Windows" ]; then |
| 117 | + flutter test integration_test -d Windows --coverage |
| 118 | + fi |
| 119 | + shell: bash |
| 120 | + |
| 121 | + - uses: codecov/codecov-action@v3 |
| 122 | + with: |
| 123 | + name: appflowy |
| 124 | + flags: appflowy |
| 125 | + env_vars: ${{ matrix.os }} |
| 126 | + fail_ci_if_error: true |
| 127 | + verbose: true |
| 128 | + |
0 commit comments