From 2d325db5b083bdec62cc1043ab0bd9900d037cff Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Mon, 6 May 2024 08:11:18 +0800 Subject: [PATCH 1/5] chore: temp disable other ci to test --- .github/workflows/ci.yaml | 1794 ++++++++++++++++++------------------- 1 file changed, 897 insertions(+), 897 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 71d891d493..1427b0d595 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,729 +18,729 @@ concurrency: cancel-in-progress: true jobs: - # ----------------------------------- deploy ----------------------------------- - - # ref https://docusaurus.io/docs/deployment#triggering-deployment-with-github-actions - deploy_website: - name: 'Deploy :: Website' - runs-on: ubuntu-latest - - steps: - # setup - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: subosito/flutter-action@v2 - with: - cache: true - flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: nightly - target: wasm32-unknown-unknown - components: rust-src,rustfmt - - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: yarn - cache-dependency-path: website/yarn.lock - - name: Setup mdBook - uses: peaceiris/actions-mdbook@v1 - with: - mdbook-version: "latest" - - name: Setup `mdbook-mermaid` - run: cargo install mdbook-mermaid - - # execute - - run: ./frb_internal generate-website - - # deploy - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - if: ${{ github.ref == 'refs/heads/master' }} - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./website/merged_target/flutter_rust_bridge - - # ----------------------------------- lint ----------------------------------- - - lint_rust_primary: - name: 'Lint :: Rust :: Primary' - runs-on: ubuntu-latest - - steps: - # setup - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: dart-lang/setup-dart@v1 - with: - sdk: ${{ env.FRB_MAIN_DART_VERSION }} - architecture: x64 - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} - components: rustfmt, clippy - - run: |- - rustup toolchain install nightly - rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu - rustup target add wasm32-unknown-unknown - - # execute - - run: ./frb_internal lint-rust - - lint_dart_primary: - name: 'Lint :: Dart :: Primary' - runs-on: ubuntu-latest - - steps: - # setup - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: subosito/flutter-action@v2 - with: - cache: true - flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} - - # execute - - run: ./frb_internal lint-dart - - lint_rust_feature_flag: - name: 'Lint :: Rust :: Feature flag' - runs-on: ubuntu-latest - - steps: - # setup - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: dart-lang/setup-dart@v1 - with: - sdk: ${{ env.FRB_MAIN_DART_VERSION }} - architecture: x64 - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} - components: rustfmt, clippy - - uses: taiki-e/install-action@cargo-hack - - run: |- - rustup toolchain install nightly - rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu - rustup target add wasm32-unknown-unknown - - # execute - - run: ./frb_internal lint-rust-feature-flag - - # ----------------------------------- codegen ----------------------------------- - # instead of running this explicit test for frb_codegen and frb_rust only, we run the test for - # all rust packages in the job "test_rust". While this would not be needed for these other packages, - # we avoid a ci dependency to cargo-msrv. - # However, the code is left commented here in case this decission changes. - # msrv: - # name: 'Test :: FRB Codegen :: MSRV' - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - - # - name: Install Rust - # uses: actions-rs/toolchain@v1 - # with: - # toolchain: stable - - # - name: Verify MSRV for frb_codegen - # run: | - # cargo install cargo-msrv - # cargo msrv --path frb_codegen verify - - # - name: Verify MSRV for frb_rust - # run: | - # cargo install cargo-msrv - # cargo msrv --path frb_rust verify - - generate_run_frb_codegen_command_generate: - name: 'Generate :: FRB Codegen :: Command Generate' - runs-on: ${{ matrix.image }} - - strategy: - fail-fast: false - matrix: - image: - - windows-2019 - - macos-11 - - ubuntu-20.04 - package: - - frb_example--dart_minimal - - frb_example--pure_dart - - frb_example--pure_dart_pde - - frb_example--dart_build_rs - - frb_example--deliberate_bad - - frb_example--flutter_via_create - - frb_example--flutter_via_integrate - exclude: - - { image: windows-2019, package: frb_example--deliberate_bad } - - { image: macos-11, package: frb_example--deliberate_bad } - - { image: windows-2019, package: frb_example--flutter_via_integrate } - - { image: macos-11, package: frb_example--flutter_via_integrate } - - steps: - # setup - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} - components: rustfmt, clippy - - uses: subosito/flutter-action@v2 - with: - cache: true - flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} - architecture: x64 - - uses: taiki-e/install-action@cargo-llvm-cov - - # execute - - run: ./frb_internal generate-run-frb-codegen-command-generate --set-exit-if-changed --package ${{ matrix.package }} --coverage - - # report - - uses: actions/upload-artifact@v4 - with: - name: ${{ github.job }}--${{ matrix.image }}--${{ matrix.package }}--coverage - path: target/coverage - - generate_run_frb_codegen_command_integrate: - name: 'Generate :: FRB Codegen :: Command Integrate' - runs-on: ${{ matrix.image }} - env: - RUST_LOG: debug - - strategy: - fail-fast: false - matrix: - image: - - macos-11 - - windows-2019 - - ubuntu-20.04 - package: - - frb_example--flutter_via_create - - frb_example--flutter_via_integrate - - steps: - # setup - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} - components: rustfmt, clippy - - uses: subosito/flutter-action@v2 - with: - cache: true - flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} - architecture: x64 - - uses: taiki-e/install-action@cargo-llvm-cov - - # execute - - run: ./frb_internal generate-run-frb-codegen-command-integrate --set-exit-if-changed --package ${{ matrix.package }} --coverage - - # report - - uses: actions/upload-artifact@v4 - with: - name: ${{ github.job }}--${{ matrix.image }}--${{ matrix.package }}--coverage - path: target/coverage - - generate_internal: - name: 'Generate :: Internal' - runs-on: ubuntu-latest - - steps: - # setup - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} - components: rustfmt, clippy - - run: rustup toolchain install nightly && rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu - - run: yarn global add all-contributors-cli - - uses: subosito/flutter-action@v2 - with: - cache: true - flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} - architecture: x64 - - uses: taiki-e/install-action@cargo-llvm-cov - - # execute - - run: ./frb_internal generate-internal --set-exit-if-changed --coverage - - # report - - uses: actions/upload-artifact@v4 - with: - name: ${{ github.job }}--coverage - path: target/coverage - - # ----------------------------------- bench ----------------------------------- - - bench_dart_native: - name: 'Bench :: Dart :: Native' - runs-on: ${{ matrix.image }} - strategy: - fail-fast: false - matrix: - image: - - windows-2019 - - macos-11 - - ubuntu-20.04 - - steps: - # setup - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} - components: rustfmt - - uses: dart-lang/setup-dart@v1 - with: - sdk: stable - architecture: x64 - - # execute - - run: ./frb_internal bench-dart-native - - - uses: actions/upload-artifact@v4 - with: - name: ${{ github.job }}--${{ matrix.image }}--benchmark - path: frb_example/pure_dart/build/simple_benchmark/benchmark_result.json - - bench_upload: - name: 'Bench :: Upload' - runs-on: ubuntu-latest - # NOTE Even if some previous jobs failed, we still want partial info - if: ${{ always() && !cancelled() }} - needs: - # NOTE We do this to ensure bench upload *after* deploy website. - # Otherwise, if they are run concurrently, they can push to git at the same time, causing failure for one of them - - deploy_website - - bench_dart_native - - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - path: downloaded-artifacts/ - pattern: '*-benchmark' - - run: tree downloaded-artifacts - - uses: dart-lang/setup-dart@v1 - with: - sdk: stable - architecture: x64 - - - run: ./frb_internal bench-merge - - - uses: benchmark-action/github-action-benchmark@v1 - # Warn: https://github.com/benchmark-action/github-action-benchmark?tab=readme-ov-file#run-only-on-your-branches - if: github.event_name != 'pull_request' - with: - name: Flutter Rust Bridge Benchmark - tool: customSmallerIsBetter - output-file-path: merged_benchmark.json - github-token: ${{ secrets.GITHUB_TOKEN }} - auto-push: true - - # ----------------------------------- build ----------------------------------- - - build_flutter: - name: 'Build :: Flutter' - runs-on: ${{ matrix.info.image }} - strategy: - fail-fast: false - matrix: - info: - - image: windows-2019 - target: windows - - image: macos-13 - target: macos - - image: ubuntu-latest - target: linux - - image: ubuntu-latest - target: android-aab - - image: ubuntu-latest - target: android-apk - - image: macos-13 - target: ios - - steps: - # setup - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - # https://docs.flutter.dev/get-started/install/linux#linux-prerequisites - - if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev - - uses: subosito/flutter-action@v2 - with: - cache: true - flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} - architecture: x64 - - # execute - - run: ./frb_internal build-flutter --target ${{ matrix.info.target }} - - # report - - uses: actions/upload-artifact@v4 - with: - name: ${{ github.job }}--${{ matrix.info.target }}--output - path: target/build_flutter_output - - # ----------------------------------- test ----------------------------------- - - test_mimic_quickstart: - name: 'Test :: MimicQuickstart' - runs-on: ${{ matrix.image }} - strategy: - fail-fast: false - matrix: - image: - - windows-2019 - # need macos-"13" because https://github.com/fzyzcjy/flutter_rust_bridge/issues/1225 - - macos-13 - - ubuntu-latest - - steps: - # setup - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} - components: rustfmt - - uses: subosito/flutter-action@v2 - with: - cache: true - flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} - architecture: x64 - # https://docs.flutter.dev/get-started/install/linux#linux-prerequisites - - if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev - - if: runner.os == 'Linux' - uses: pyvista/setup-headless-display-action@v1 - - # execute - - run: ./frb_internal test-mimic-quickstart - - test_upgrade: - name: 'Test :: Upgrade' - runs-on: ${{ matrix.image }} - strategy: - fail-fast: false - matrix: - image: - - windows-2019 - # need macos-"13" because https://github.com/fzyzcjy/flutter_rust_bridge/issues/1225 - - macos-13 - - ubuntu-latest - - steps: - # setup - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} - components: rustfmt - - uses: subosito/flutter-action@v2 - with: - cache: true - flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} - architecture: x64 - # https://docs.flutter.dev/get-started/install/linux#linux-prerequisites - - if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev - - if: runner.os == 'Linux' - uses: pyvista/setup-headless-display-action@v1 - - uses: taiki-e/install-action@cargo-llvm-cov - - # execute - - run: ./frb_internal test-upgrade - - # report - - uses: actions/upload-artifact@v4 - with: - name: ${{ github.job }}--${{ matrix.image }}--coverage - path: target/coverage - - test_rust: - name: 'Test :: Rust' - runs-on: ${{ matrix.info.image }} - strategy: - fail-fast: false - matrix: - info: - # run on various platforms - - image: macos-11 - version: '' - - image: windows-2019 - version: '' - - image: ubuntu-latest - version: '' - # run on various rust versions - - image: ubuntu-latest - version: nightly - - image: ubuntu-latest - version: nightly-2023-12-16 - # tests the MSRV - # run on all rust packages, though only needed for frb_rust and frb_codegen - - image: ubuntu-latest - # update this, if a later MSRV is needed - version: 1.74.0 - - steps: - # setup - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ matrix.info.version || env.FRB_MAIN_RUST_VERSION }} - components: rustfmt - # TODO cache (for rust-toolchain, also for cargo build) - - uses: dart-lang/setup-dart@v1 - with: - sdk: ${{ env.FRB_MAIN_DART_VERSION }} - architecture: x64 - - uses: taiki-e/install-action@cargo-llvm-cov - - # execute - - run: ./frb_internal test-rust --coverage - - # report - - uses: actions/upload-artifact@v4 - with: - name: ${{ github.job }}--${{ matrix.info.image }}--${{ matrix.info.version }}--coverage - path: target/coverage - - test_dart_native: - name: 'Test :: Dart :: Native' - runs-on: ${{ matrix.image }} - strategy: - fail-fast: false - matrix: - image: - - windows-2019 - - macos-11 - - ubuntu-20.04 - package: - - frb_dart - - frb_utils - - tools--frb_internal - - frb_example--dart_minimal - - frb_example--pure_dart - - frb_example--pure_dart_pde - - frb_example--dart_build_rs - - frb_example--deliberate_bad - exclude: - - { image: windows-2019, package: frb_utils } - - { image: macos-11, package: frb_utils } - - { image: windows-2019, package: tools--frb_internal } - - { image: macos-11, package: tools--frb_internal } - - { image: windows-2019, package: frb_example--deliberate_bad } - - { image: macos-11, package: frb_example--deliberate_bad } - - steps: - # setup - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} - components: rustfmt - - uses: dart-lang/setup-dart@v1 - with: - sdk: stable - architecture: x64 - - uses: taiki-e/install-action@cargo-llvm-cov - - # execute - - run: ./frb_internal test-dart-native --package ${{ matrix.package }} --coverage - - # report - - uses: actions/upload-artifact@v4 - with: - name: ${{ github.job }}--${{ matrix.image }}--${{ matrix.package }}--coverage - path: target/coverage - - test_dart_web: - name: 'Test :: Dart :: Web' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - package: - - frb_dart - - frb_example--dart_minimal - - frb_example--pure_dart - - frb_example--pure_dart_pde - # no need for `frb_example--deliberate_bad`, `frb_example--dart_build_rs` - - steps: - # setup - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: dart-lang/setup-dart@v1 - with: - sdk: ${{ env.FRB_MAIN_DART_VERSION }} - architecture: x64 - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: nightly - target: wasm32-unknown-unknown - components: rust-src,rustfmt - - name: Cache dependencies - id: test-cache - uses: actions/cache@v3 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target - frb_example--pure_dart/rust/target/ - frb_example--pure_dart/.local-chromium - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Install crates - if: steps.test-cache.outputs.cache-hit != 'true' - run: | - sh -c "$(curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf)" '' -f - - # execute - - run: ./frb_internal test-dart-web --package ${{ matrix.package }} - - test_dart_valgrind: - name: 'Test :: Dart :: Valgrind' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - package: - - frb_example--dart_minimal - - frb_example--pure_dart - - frb_example--pure_dart_pde - # no need for `frb_example--deliberate_bad`, `frb_example--dart_build_rs` - - steps: - # setup - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} - components: rustfmt - - uses: dart-lang/setup-dart@v1 - with: - sdk: stable - architecture: x64 - - run: sudo apt-get update - - # execute - - run: ./frb_internal test-dart-valgrind --package ${{ matrix.package }} - - test_dart_sanitizer: - name: 'Test :: Dart :: Sanitizer' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - sanitizer: - - asan - # - msan # todo: #1824 - - lsan - # Every time we build TSAN in https://github.com/fzyzcjy/dart_lang_ci, it fails near the end. - # Since it is unlikely we will have thread issues, we temporarily disable TSAN now. - # - tsan - package: - - frb_example--dart_minimal - - frb_example--pure_dart - - frb_example--pure_dart_pde - - frb_example--deliberate_bad - # no need for `frb_example--dart_build_rs` - - steps: - # setup - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} - components: rustfmt - - run: |- - rustup toolchain install nightly - rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu - - uses: dart-lang/setup-dart@v1 - with: - sdk: stable - architecture: x64 - - # execute - - run: ./frb_internal test-dart-sanitizer --package ${{ matrix.package }} --sanitizer ${{ matrix.sanitizer }} +# # ----------------------------------- deploy ----------------------------------- +# +# # ref https://docusaurus.io/docs/deployment#triggering-deployment-with-github-actions +# deploy_website: +# name: 'Deploy :: Website' +# runs-on: ubuntu-latest +# +# steps: +# # setup +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - uses: subosito/flutter-action@v2 +# with: +# cache: true +# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: nightly +# target: wasm32-unknown-unknown +# components: rust-src,rustfmt +# - uses: actions/setup-node@v3 +# with: +# node-version: 18 +# cache: yarn +# cache-dependency-path: website/yarn.lock +# - name: Setup mdBook +# uses: peaceiris/actions-mdbook@v1 +# with: +# mdbook-version: "latest" +# - name: Setup `mdbook-mermaid` +# run: cargo install mdbook-mermaid +# +# # execute +# - run: ./frb_internal generate-website +# +# # deploy +# - name: Deploy +# uses: peaceiris/actions-gh-pages@v3 +# if: ${{ github.ref == 'refs/heads/master' }} +# with: +# github_token: ${{ secrets.GITHUB_TOKEN }} +# publish_dir: ./website/merged_target/flutter_rust_bridge +# +# # ----------------------------------- lint ----------------------------------- +# +# lint_rust_primary: +# name: 'Lint :: Rust :: Primary' +# runs-on: ubuntu-latest +# +# steps: +# # setup +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - uses: dart-lang/setup-dart@v1 +# with: +# sdk: ${{ env.FRB_MAIN_DART_VERSION }} +# architecture: x64 +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} +# components: rustfmt, clippy +# - run: |- +# rustup toolchain install nightly +# rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu +# rustup target add wasm32-unknown-unknown +# +# # execute +# - run: ./frb_internal lint-rust +# +# lint_dart_primary: +# name: 'Lint :: Dart :: Primary' +# runs-on: ubuntu-latest +# +# steps: +# # setup +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - uses: subosito/flutter-action@v2 +# with: +# cache: true +# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} +# +# # execute +# - run: ./frb_internal lint-dart +# +# lint_rust_feature_flag: +# name: 'Lint :: Rust :: Feature flag' +# runs-on: ubuntu-latest +# +# steps: +# # setup +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - uses: dart-lang/setup-dart@v1 +# with: +# sdk: ${{ env.FRB_MAIN_DART_VERSION }} +# architecture: x64 +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} +# components: rustfmt, clippy +# - uses: taiki-e/install-action@cargo-hack +# - run: |- +# rustup toolchain install nightly +# rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu +# rustup target add wasm32-unknown-unknown +# +# # execute +# - run: ./frb_internal lint-rust-feature-flag +# +# # ----------------------------------- codegen ----------------------------------- +# # instead of running this explicit test for frb_codegen and frb_rust only, we run the test for +# # all rust packages in the job "test_rust". While this would not be needed for these other packages, +# # we avoid a ci dependency to cargo-msrv. +# # However, the code is left commented here in case this decission changes. +# # msrv: +# # name: 'Test :: FRB Codegen :: MSRV' +# # runs-on: ubuntu-latest +# # steps: +# # - uses: actions/checkout@v2 +# +# # - name: Install Rust +# # uses: actions-rs/toolchain@v1 +# # with: +# # toolchain: stable +# +# # - name: Verify MSRV for frb_codegen +# # run: | +# # cargo install cargo-msrv +# # cargo msrv --path frb_codegen verify +# +# # - name: Verify MSRV for frb_rust +# # run: | +# # cargo install cargo-msrv +# # cargo msrv --path frb_rust verify +# +# generate_run_frb_codegen_command_generate: +# name: 'Generate :: FRB Codegen :: Command Generate' +# runs-on: ${{ matrix.image }} +# +# strategy: +# fail-fast: false +# matrix: +# image: +# - windows-2019 +# - macos-11 +# - ubuntu-20.04 +# package: +# - frb_example--dart_minimal +# - frb_example--pure_dart +# - frb_example--pure_dart_pde +# - frb_example--dart_build_rs +# - frb_example--deliberate_bad +# - frb_example--flutter_via_create +# - frb_example--flutter_via_integrate +# exclude: +# - { image: windows-2019, package: frb_example--deliberate_bad } +# - { image: macos-11, package: frb_example--deliberate_bad } +# - { image: windows-2019, package: frb_example--flutter_via_integrate } +# - { image: macos-11, package: frb_example--flutter_via_integrate } +# +# steps: +# # setup +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} +# components: rustfmt, clippy +# - uses: subosito/flutter-action@v2 +# with: +# cache: true +# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} +# architecture: x64 +# - uses: taiki-e/install-action@cargo-llvm-cov +# +# # execute +# - run: ./frb_internal generate-run-frb-codegen-command-generate --set-exit-if-changed --package ${{ matrix.package }} --coverage +# +# # report +# - uses: actions/upload-artifact@v4 +# with: +# name: ${{ github.job }}--${{ matrix.image }}--${{ matrix.package }}--coverage +# path: target/coverage +# +# generate_run_frb_codegen_command_integrate: +# name: 'Generate :: FRB Codegen :: Command Integrate' +# runs-on: ${{ matrix.image }} +# env: +# RUST_LOG: debug +# +# strategy: +# fail-fast: false +# matrix: +# image: +# - macos-11 +# - windows-2019 +# - ubuntu-20.04 +# package: +# - frb_example--flutter_via_create +# - frb_example--flutter_via_integrate +# +# steps: +# # setup +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} +# components: rustfmt, clippy +# - uses: subosito/flutter-action@v2 +# with: +# cache: true +# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} +# architecture: x64 +# - uses: taiki-e/install-action@cargo-llvm-cov +# +# # execute +# - run: ./frb_internal generate-run-frb-codegen-command-integrate --set-exit-if-changed --package ${{ matrix.package }} --coverage +# +# # report +# - uses: actions/upload-artifact@v4 +# with: +# name: ${{ github.job }}--${{ matrix.image }}--${{ matrix.package }}--coverage +# path: target/coverage +# +# generate_internal: +# name: 'Generate :: Internal' +# runs-on: ubuntu-latest +# +# steps: +# # setup +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} +# components: rustfmt, clippy +# - run: rustup toolchain install nightly && rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu +# - run: yarn global add all-contributors-cli +# - uses: subosito/flutter-action@v2 +# with: +# cache: true +# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} +# architecture: x64 +# - uses: taiki-e/install-action@cargo-llvm-cov +# +# # execute +# - run: ./frb_internal generate-internal --set-exit-if-changed --coverage +# +# # report +# - uses: actions/upload-artifact@v4 +# with: +# name: ${{ github.job }}--coverage +# path: target/coverage +# +# # ----------------------------------- bench ----------------------------------- +# +# bench_dart_native: +# name: 'Bench :: Dart :: Native' +# runs-on: ${{ matrix.image }} +# strategy: +# fail-fast: false +# matrix: +# image: +# - windows-2019 +# - macos-11 +# - ubuntu-20.04 +# +# steps: +# # setup +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} +# components: rustfmt +# - uses: dart-lang/setup-dart@v1 +# with: +# sdk: stable +# architecture: x64 +# +# # execute +# - run: ./frb_internal bench-dart-native +# +# - uses: actions/upload-artifact@v4 +# with: +# name: ${{ github.job }}--${{ matrix.image }}--benchmark +# path: frb_example/pure_dart/build/simple_benchmark/benchmark_result.json +# +# bench_upload: +# name: 'Bench :: Upload' +# runs-on: ubuntu-latest +# # NOTE Even if some previous jobs failed, we still want partial info +# if: ${{ always() && !cancelled() }} +# needs: +# # NOTE We do this to ensure bench upload *after* deploy website. +# # Otherwise, if they are run concurrently, they can push to git at the same time, causing failure for one of them +# - deploy_website +# - bench_dart_native +# +# steps: +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - name: Download artifacts +# uses: actions/download-artifact@v4 +# with: +# path: downloaded-artifacts/ +# pattern: '*-benchmark' +# - run: tree downloaded-artifacts +# - uses: dart-lang/setup-dart@v1 +# with: +# sdk: stable +# architecture: x64 +# +# - run: ./frb_internal bench-merge +# +# - uses: benchmark-action/github-action-benchmark@v1 +# # Warn: https://github.com/benchmark-action/github-action-benchmark?tab=readme-ov-file#run-only-on-your-branches +# if: github.event_name != 'pull_request' +# with: +# name: Flutter Rust Bridge Benchmark +# tool: customSmallerIsBetter +# output-file-path: merged_benchmark.json +# github-token: ${{ secrets.GITHUB_TOKEN }} +# auto-push: true +# +# # ----------------------------------- build ----------------------------------- +# +# build_flutter: +# name: 'Build :: Flutter' +# runs-on: ${{ matrix.info.image }} +# strategy: +# fail-fast: false +# matrix: +# info: +# - image: windows-2019 +# target: windows +# - image: macos-13 +# target: macos +# - image: ubuntu-latest +# target: linux +# - image: ubuntu-latest +# target: android-aab +# - image: ubuntu-latest +# target: android-apk +# - image: macos-13 +# target: ios +# +# steps: +# # setup +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# # https://docs.flutter.dev/get-started/install/linux#linux-prerequisites +# - if: runner.os == 'Linux' +# run: sudo apt-get update && sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev +# - uses: subosito/flutter-action@v2 +# with: +# cache: true +# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} +# architecture: x64 +# +# # execute +# - run: ./frb_internal build-flutter --target ${{ matrix.info.target }} +# +# # report +# - uses: actions/upload-artifact@v4 +# with: +# name: ${{ github.job }}--${{ matrix.info.target }}--output +# path: target/build_flutter_output +# +# # ----------------------------------- test ----------------------------------- +# +# test_mimic_quickstart: +# name: 'Test :: MimicQuickstart' +# runs-on: ${{ matrix.image }} +# strategy: +# fail-fast: false +# matrix: +# image: +# - windows-2019 +# # need macos-"13" because https://github.com/fzyzcjy/flutter_rust_bridge/issues/1225 +# - macos-13 +# - ubuntu-latest +# +# steps: +# # setup +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} +# components: rustfmt +# - uses: subosito/flutter-action@v2 +# with: +# cache: true +# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} +# architecture: x64 +# # https://docs.flutter.dev/get-started/install/linux#linux-prerequisites +# - if: runner.os == 'Linux' +# run: sudo apt-get update && sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev +# - if: runner.os == 'Linux' +# uses: pyvista/setup-headless-display-action@v1 +# +# # execute +# - run: ./frb_internal test-mimic-quickstart +# +# test_upgrade: +# name: 'Test :: Upgrade' +# runs-on: ${{ matrix.image }} +# strategy: +# fail-fast: false +# matrix: +# image: +# - windows-2019 +# # need macos-"13" because https://github.com/fzyzcjy/flutter_rust_bridge/issues/1225 +# - macos-13 +# - ubuntu-latest +# +# steps: +# # setup +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} +# components: rustfmt +# - uses: subosito/flutter-action@v2 +# with: +# cache: true +# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} +# architecture: x64 +# # https://docs.flutter.dev/get-started/install/linux#linux-prerequisites +# - if: runner.os == 'Linux' +# run: sudo apt-get update && sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev +# - if: runner.os == 'Linux' +# uses: pyvista/setup-headless-display-action@v1 +# - uses: taiki-e/install-action@cargo-llvm-cov +# +# # execute +# - run: ./frb_internal test-upgrade +# +# # report +# - uses: actions/upload-artifact@v4 +# with: +# name: ${{ github.job }}--${{ matrix.image }}--coverage +# path: target/coverage +# +# test_rust: +# name: 'Test :: Rust' +# runs-on: ${{ matrix.info.image }} +# strategy: +# fail-fast: false +# matrix: +# info: +# # run on various platforms +# - image: macos-11 +# version: '' +# - image: windows-2019 +# version: '' +# - image: ubuntu-latest +# version: '' +# # run on various rust versions +# - image: ubuntu-latest +# version: nightly +# - image: ubuntu-latest +# version: nightly-2023-12-16 +# # tests the MSRV +# # run on all rust packages, though only needed for frb_rust and frb_codegen +# - image: ubuntu-latest +# # update this, if a later MSRV is needed +# version: 1.74.0 +# +# steps: +# # setup +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ matrix.info.version || env.FRB_MAIN_RUST_VERSION }} +# components: rustfmt +# # TODO cache (for rust-toolchain, also for cargo build) +# - uses: dart-lang/setup-dart@v1 +# with: +# sdk: ${{ env.FRB_MAIN_DART_VERSION }} +# architecture: x64 +# - uses: taiki-e/install-action@cargo-llvm-cov +# +# # execute +# - run: ./frb_internal test-rust --coverage +# +# # report +# - uses: actions/upload-artifact@v4 +# with: +# name: ${{ github.job }}--${{ matrix.info.image }}--${{ matrix.info.version }}--coverage +# path: target/coverage +# +# test_dart_native: +# name: 'Test :: Dart :: Native' +# runs-on: ${{ matrix.image }} +# strategy: +# fail-fast: false +# matrix: +# image: +# - windows-2019 +# - macos-11 +# - ubuntu-20.04 +# package: +# - frb_dart +# - frb_utils +# - tools--frb_internal +# - frb_example--dart_minimal +# - frb_example--pure_dart +# - frb_example--pure_dart_pde +# - frb_example--dart_build_rs +# - frb_example--deliberate_bad +# exclude: +# - { image: windows-2019, package: frb_utils } +# - { image: macos-11, package: frb_utils } +# - { image: windows-2019, package: tools--frb_internal } +# - { image: macos-11, package: tools--frb_internal } +# - { image: windows-2019, package: frb_example--deliberate_bad } +# - { image: macos-11, package: frb_example--deliberate_bad } +# +# steps: +# # setup +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} +# components: rustfmt +# - uses: dart-lang/setup-dart@v1 +# with: +# sdk: stable +# architecture: x64 +# - uses: taiki-e/install-action@cargo-llvm-cov +# +# # execute +# - run: ./frb_internal test-dart-native --package ${{ matrix.package }} --coverage +# +# # report +# - uses: actions/upload-artifact@v4 +# with: +# name: ${{ github.job }}--${{ matrix.image }}--${{ matrix.package }}--coverage +# path: target/coverage +# +# test_dart_web: +# name: 'Test :: Dart :: Web' +# runs-on: ubuntu-latest +# strategy: +# fail-fast: false +# matrix: +# package: +# - frb_dart +# - frb_example--dart_minimal +# - frb_example--pure_dart +# - frb_example--pure_dart_pde +# # no need for `frb_example--deliberate_bad`, `frb_example--dart_build_rs` +# +# steps: +# # setup +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - uses: dart-lang/setup-dart@v1 +# with: +# sdk: ${{ env.FRB_MAIN_DART_VERSION }} +# architecture: x64 +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: nightly +# target: wasm32-unknown-unknown +# components: rust-src,rustfmt +# - name: Cache dependencies +# id: test-cache +# uses: actions/cache@v3 +# with: +# path: | +# ~/.cargo/bin/ +# ~/.cargo/registry/index/ +# ~/.cargo/registry/cache/ +# ~/.cargo/git/db/ +# target +# frb_example--pure_dart/rust/target/ +# frb_example--pure_dart/.local-chromium +# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} +# - name: Install crates +# if: steps.test-cache.outputs.cache-hit != 'true' +# run: | +# sh -c "$(curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf)" '' -f +# +# # execute +# - run: ./frb_internal test-dart-web --package ${{ matrix.package }} +# +# test_dart_valgrind: +# name: 'Test :: Dart :: Valgrind' +# runs-on: ubuntu-latest +# strategy: +# fail-fast: false +# matrix: +# package: +# - frb_example--dart_minimal +# - frb_example--pure_dart +# - frb_example--pure_dart_pde +# # no need for `frb_example--deliberate_bad`, `frb_example--dart_build_rs` +# +# steps: +# # setup +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} +# components: rustfmt +# - uses: dart-lang/setup-dart@v1 +# with: +# sdk: stable +# architecture: x64 +# - run: sudo apt-get update +# +# # execute +# - run: ./frb_internal test-dart-valgrind --package ${{ matrix.package }} +# +# test_dart_sanitizer: +# name: 'Test :: Dart :: Sanitizer' +# runs-on: ubuntu-latest +# strategy: +# fail-fast: false +# matrix: +# sanitizer: +# - asan +# # - msan # todo: #1824 +# - lsan +# # Every time we build TSAN in https://github.com/fzyzcjy/dart_lang_ci, it fails near the end. +# # Since it is unlikely we will have thread issues, we temporarily disable TSAN now. +# # - tsan +# package: +# - frb_example--dart_minimal +# - frb_example--pure_dart +# - frb_example--pure_dart_pde +# - frb_example--deliberate_bad +# # no need for `frb_example--dart_build_rs` +# +# steps: +# # setup +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} +# components: rustfmt +# - run: |- +# rustup toolchain install nightly +# rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu +# - uses: dart-lang/setup-dart@v1 +# with: +# sdk: stable +# architecture: x64 +# +# # execute +# - run: ./frb_internal test-dart-sanitizer --package ${{ matrix.package }} --sanitizer ${{ matrix.sanitizer }} # ref https://betterprogramming.pub/test-flutter-apps-on-android-with-github-actions-abdba2137b4 test_flutter_native_android: @@ -754,7 +754,7 @@ jobs: - frb_example--flutter_via_create # no `frb_example--flutter_via_integrate` since it is similar to `flutter_via_create` device: - - "pixel" +# - "pixel" - "Nexus 6" api-level: [ 29 ] @@ -803,176 +803,176 @@ jobs: profile: ${{ matrix.device }} script: ./frb_internal test-flutter-native --package ${{ matrix.package }} - # ref https://medium.com/flutter-community/run-flutter-driver-tests-on-github-actions-13c639c7e4ab - test_flutter_native_ios: - name: 'Test :: Flutter :: Native:: iOS' - runs-on: macos-latest - strategy: - fail-fast: false - matrix: - package: - - frb_example--flutter_via_create - # no `frb_example--flutter_via_integrate` since it is similar to `flutter_via_create` - device: - - "iPad (10th generation) Simulator (17.2)" - - "iPhone 14 Pro Max Simulator (17.2)" - - steps: - # setup - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: "Start Simulator" - run: | - # list all devices - xcrun xctrace list devices - # the extra "(" is to avoid matching things like "iPhone 12 Pro Max Simulator (16.2) + Apple Watch Series 5 - 44mm (8.0)" - UDID=$(xcrun xctrace list devices | grep '${{ matrix.device }} (' | awk '{print $NF}' | tr -d '()') - echo UDID=$UDID - xcrun simctl boot "${UDID:?No Simulator with this name found}" - - uses: subosito/flutter-action@v2 - with: - cache: true - flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} - architecture: x64 - - # execute - - run: ./frb_internal test-flutter-native --package ${{ matrix.package }} - - test_flutter_native_desktop: - name: 'Test :: Flutter :: Native:: ${{ matrix.info.platform }} (${{ matrix.info.package }})' - runs-on: ${{ matrix.info.image }} - strategy: - fail-fast: false - matrix: - info: - - image: windows-2019 - platform: windows - package: frb_example--flutter_via_create - # need macos-"13" because https://github.com/fzyzcjy/flutter_rust_bridge/issues/1225 - - image: macos-13 - platform: macos - package: frb_example--flutter_via_create - - image: ubuntu-latest - platform: linux - package: frb_example--flutter_via_create - # only slightly test `flutter_via_integrate` since quite similar to `flutter_via_create` - - image: ubuntu-latest - platform: linux - package: frb_example--flutter_via_integrate - # only slightly test `gallery`, since mainly used on web - - image: ubuntu-latest - platform: linux - package: frb_example--gallery - - steps: - # setup - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - # https://docs.flutter.dev/get-started/install/linux#linux-prerequisites - - if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev - - if: runner.os == 'Linux' - uses: pyvista/setup-headless-display-action@v1 - - uses: subosito/flutter-action@v2 - with: - cache: true - flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} - architecture: x64 - - # execute - - run: ./frb_internal test-flutter-native --flutter-test-args '--device-id ${{ matrix.info.platform }}' --package ${{ matrix.info.package }} - - test_flutter_web: - name: 'Test :: Flutter :: Web' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - package: - - frb_example--flutter_via_create - # no `frb_example--flutter_via_integrate` since it is similar to `flutter_via_create` - - frb_example--gallery - - steps: - - uses: catchpoint/workflow-telemetry-action@v1 - with: - comment_on_pr: false - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: subosito/flutter-action@v2 - with: - cache: true - flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} - architecture: x64 - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} - - uses: taiki-e/install-action@cargo-llvm-cov - - run: |- - rustup toolchain install nightly - rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu - - uses: nanasess/setup-chromedriver@v2 - # ref https://github.com/dewbambs/flutter_github_actions/blob/dev/.github/workflows/e2e_test.yml - - run: |- - sleep 15 - export DISPLAY=:99 - chromedriver --port=4444 --verbose & - sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & - - sleep 15 - lsof -i :4444 - - # execute - - run: ./frb_internal test-flutter-web --package ${{ matrix.package }} --coverage - - # report - - uses: actions/upload-artifact@v4 - with: - name: ${{ github.job }}--${{ matrix.package }}--coverage - path: target/coverage - - # ----------------------------------- misc ----------------------------------- - - # Why one separate codecov job: Otherwise, when some jobs upload artifact while some not, - # the (partial) coverage will show up and be very low - which surely does not reflect actual coverage. - misc_codecov: - name: 'Misc :: Codecov' - runs-on: ubuntu-latest - # NOTE Even if some previous jobs failed, we still want partial info - if: ${{ always() && !cancelled() }} - # NOTE need to depend on *all* jobs that may generate codecov artifacts - needs: - - generate_run_frb_codegen_command_generate - - generate_run_frb_codegen_command_integrate - - generate_internal - - test_upgrade - - test_rust - - test_dart_native - - test_flutter_web - - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - path: downloaded-artifacts/ - pattern: '*-coverage' - - run: tree downloaded-artifacts - - - uses: codecov/codecov-action@v3 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - directory: downloaded-artifacts - verbose: true +# # ref https://medium.com/flutter-community/run-flutter-driver-tests-on-github-actions-13c639c7e4ab +# test_flutter_native_ios: +# name: 'Test :: Flutter :: Native:: iOS' +# runs-on: macos-latest +# strategy: +# fail-fast: false +# matrix: +# package: +# - frb_example--flutter_via_create +# # no `frb_example--flutter_via_integrate` since it is similar to `flutter_via_create` +# device: +# - "iPad (10th generation) Simulator (17.2)" +# - "iPhone 14 Pro Max Simulator (17.2)" +# +# steps: +# # setup +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - name: "Start Simulator" +# run: | +# # list all devices +# xcrun xctrace list devices +# # the extra "(" is to avoid matching things like "iPhone 12 Pro Max Simulator (16.2) + Apple Watch Series 5 - 44mm (8.0)" +# UDID=$(xcrun xctrace list devices | grep '${{ matrix.device }} (' | awk '{print $NF}' | tr -d '()') +# echo UDID=$UDID +# xcrun simctl boot "${UDID:?No Simulator with this name found}" +# - uses: subosito/flutter-action@v2 +# with: +# cache: true +# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} +# architecture: x64 +# +# # execute +# - run: ./frb_internal test-flutter-native --package ${{ matrix.package }} +# +# test_flutter_native_desktop: +# name: 'Test :: Flutter :: Native:: ${{ matrix.info.platform }} (${{ matrix.info.package }})' +# runs-on: ${{ matrix.info.image }} +# strategy: +# fail-fast: false +# matrix: +# info: +# - image: windows-2019 +# platform: windows +# package: frb_example--flutter_via_create +# # need macos-"13" because https://github.com/fzyzcjy/flutter_rust_bridge/issues/1225 +# - image: macos-13 +# platform: macos +# package: frb_example--flutter_via_create +# - image: ubuntu-latest +# platform: linux +# package: frb_example--flutter_via_create +# # only slightly test `flutter_via_integrate` since quite similar to `flutter_via_create` +# - image: ubuntu-latest +# platform: linux +# package: frb_example--flutter_via_integrate +# # only slightly test `gallery`, since mainly used on web +# - image: ubuntu-latest +# platform: linux +# package: frb_example--gallery +# +# steps: +# # setup +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# # https://docs.flutter.dev/get-started/install/linux#linux-prerequisites +# - if: runner.os == 'Linux' +# run: sudo apt-get update && sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev +# - if: runner.os == 'Linux' +# uses: pyvista/setup-headless-display-action@v1 +# - uses: subosito/flutter-action@v2 +# with: +# cache: true +# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} +# architecture: x64 +# +# # execute +# - run: ./frb_internal test-flutter-native --flutter-test-args '--device-id ${{ matrix.info.platform }}' --package ${{ matrix.info.package }} +# +# test_flutter_web: +# name: 'Test :: Flutter :: Web' +# runs-on: ubuntu-latest +# strategy: +# fail-fast: false +# matrix: +# package: +# - frb_example--flutter_via_create +# # no `frb_example--flutter_via_integrate` since it is similar to `flutter_via_create` +# - frb_example--gallery +# +# steps: +# - uses: catchpoint/workflow-telemetry-action@v1 +# with: +# comment_on_pr: false +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - uses: subosito/flutter-action@v2 +# with: +# cache: true +# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} +# architecture: x64 +# - uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} +# - uses: taiki-e/install-action@cargo-llvm-cov +# - run: |- +# rustup toolchain install nightly +# rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu +# - uses: nanasess/setup-chromedriver@v2 +# # ref https://github.com/dewbambs/flutter_github_actions/blob/dev/.github/workflows/e2e_test.yml +# - run: |- +# sleep 15 +# export DISPLAY=:99 +# chromedriver --port=4444 --verbose & +# sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & +# +# sleep 15 +# lsof -i :4444 +# +# # execute +# - run: ./frb_internal test-flutter-web --package ${{ matrix.package }} --coverage +# +# # report +# - uses: actions/upload-artifact@v4 +# with: +# name: ${{ github.job }}--${{ matrix.package }}--coverage +# path: target/coverage +# +# # ----------------------------------- misc ----------------------------------- +# +# # Why one separate codecov job: Otherwise, when some jobs upload artifact while some not, +# # the (partial) coverage will show up and be very low - which surely does not reflect actual coverage. +# misc_codecov: +# name: 'Misc :: Codecov' +# runs-on: ubuntu-latest +# # NOTE Even if some previous jobs failed, we still want partial info +# if: ${{ always() && !cancelled() }} +# # NOTE need to depend on *all* jobs that may generate codecov artifacts +# needs: +# - generate_run_frb_codegen_command_generate +# - generate_run_frb_codegen_command_integrate +# - generate_internal +# - test_upgrade +# - test_rust +# - test_dart_native +# - test_flutter_web +# +# steps: +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - name: Download artifacts +# uses: actions/download-artifact@v4 +# with: +# path: downloaded-artifacts/ +# pattern: '*-coverage' +# - run: tree downloaded-artifacts +# +# - uses: codecov/codecov-action@v3 +# env: +# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} +# with: +# directory: downloaded-artifacts +# verbose: true From d92214e8e2d2d741494129743e7e8ef0e8e78271 Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Mon, 6 May 2024 08:18:20 +0800 Subject: [PATCH 2/5] feat: try linux --- .github/workflows/ci.yaml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1427b0d595..0c18b46027 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -745,8 +745,9 @@ jobs: # ref https://betterprogramming.pub/test-flutter-apps-on-android-with-github-actions-abdba2137b4 test_flutter_native_android: name: 'Test :: Flutter :: Native:: Android' - # Must use MacOS because of reasons mentioned in `android-emulator-runner`'s readme. - runs-on: macos-latest +# # Must use MacOS because of reasons mentioned in `android-emulator-runner`'s readme. +# runs-on: macos-latest + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -776,6 +777,11 @@ jobs: with: distribution: 'zulu' java-version: "17.x" + - name: Enable KVM group perms + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm - name: AVD cache uses: actions/cache@v3 id: avd-cache @@ -790,16 +796,16 @@ jobs: with: api-level: ${{ matrix.api-level }} force-avd-creation: false - emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - disable-animations: false + # emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + # disable-animations: false script: echo "Generated AVD snapshot for caching." # execute - uses: reactivecircus/android-emulator-runner@v2 with: api-level: ${{ matrix.api-level }} - emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim - arch: x86_64 + # emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim + # arch: x86_64 profile: ${{ matrix.device }} script: ./frb_internal test-flutter-native --package ${{ matrix.package }} From faeaa868c609f11f31878965ea067a63ebb16fc0 Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Mon, 6 May 2024 09:09:49 +0800 Subject: [PATCH 3/5] chore: uncomment --- .github/workflows/ci.yaml | 1792 ++++++++++++++++++------------------- 1 file changed, 896 insertions(+), 896 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0c18b46027..92ec86c830 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,729 +18,729 @@ concurrency: cancel-in-progress: true jobs: -# # ----------------------------------- deploy ----------------------------------- -# -# # ref https://docusaurus.io/docs/deployment#triggering-deployment-with-github-actions -# deploy_website: -# name: 'Deploy :: Website' -# runs-on: ubuntu-latest -# -# steps: -# # setup -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - uses: subosito/flutter-action@v2 -# with: -# cache: true -# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: nightly -# target: wasm32-unknown-unknown -# components: rust-src,rustfmt -# - uses: actions/setup-node@v3 -# with: -# node-version: 18 -# cache: yarn -# cache-dependency-path: website/yarn.lock -# - name: Setup mdBook -# uses: peaceiris/actions-mdbook@v1 -# with: -# mdbook-version: "latest" -# - name: Setup `mdbook-mermaid` -# run: cargo install mdbook-mermaid -# -# # execute -# - run: ./frb_internal generate-website -# -# # deploy -# - name: Deploy -# uses: peaceiris/actions-gh-pages@v3 -# if: ${{ github.ref == 'refs/heads/master' }} -# with: -# github_token: ${{ secrets.GITHUB_TOKEN }} -# publish_dir: ./website/merged_target/flutter_rust_bridge -# -# # ----------------------------------- lint ----------------------------------- -# -# lint_rust_primary: -# name: 'Lint :: Rust :: Primary' -# runs-on: ubuntu-latest -# -# steps: -# # setup -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - uses: dart-lang/setup-dart@v1 -# with: -# sdk: ${{ env.FRB_MAIN_DART_VERSION }} -# architecture: x64 -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} -# components: rustfmt, clippy -# - run: |- -# rustup toolchain install nightly -# rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu -# rustup target add wasm32-unknown-unknown -# -# # execute -# - run: ./frb_internal lint-rust -# -# lint_dart_primary: -# name: 'Lint :: Dart :: Primary' -# runs-on: ubuntu-latest -# -# steps: -# # setup -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - uses: subosito/flutter-action@v2 -# with: -# cache: true -# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} -# -# # execute -# - run: ./frb_internal lint-dart -# -# lint_rust_feature_flag: -# name: 'Lint :: Rust :: Feature flag' -# runs-on: ubuntu-latest -# -# steps: -# # setup -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - uses: dart-lang/setup-dart@v1 -# with: -# sdk: ${{ env.FRB_MAIN_DART_VERSION }} -# architecture: x64 -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} -# components: rustfmt, clippy -# - uses: taiki-e/install-action@cargo-hack -# - run: |- -# rustup toolchain install nightly -# rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu -# rustup target add wasm32-unknown-unknown -# -# # execute -# - run: ./frb_internal lint-rust-feature-flag -# -# # ----------------------------------- codegen ----------------------------------- -# # instead of running this explicit test for frb_codegen and frb_rust only, we run the test for -# # all rust packages in the job "test_rust". While this would not be needed for these other packages, -# # we avoid a ci dependency to cargo-msrv. -# # However, the code is left commented here in case this decission changes. -# # msrv: -# # name: 'Test :: FRB Codegen :: MSRV' -# # runs-on: ubuntu-latest -# # steps: -# # - uses: actions/checkout@v2 -# -# # - name: Install Rust -# # uses: actions-rs/toolchain@v1 -# # with: -# # toolchain: stable -# -# # - name: Verify MSRV for frb_codegen -# # run: | -# # cargo install cargo-msrv -# # cargo msrv --path frb_codegen verify -# -# # - name: Verify MSRV for frb_rust -# # run: | -# # cargo install cargo-msrv -# # cargo msrv --path frb_rust verify -# -# generate_run_frb_codegen_command_generate: -# name: 'Generate :: FRB Codegen :: Command Generate' -# runs-on: ${{ matrix.image }} -# -# strategy: -# fail-fast: false -# matrix: -# image: -# - windows-2019 -# - macos-11 -# - ubuntu-20.04 -# package: -# - frb_example--dart_minimal -# - frb_example--pure_dart -# - frb_example--pure_dart_pde -# - frb_example--dart_build_rs -# - frb_example--deliberate_bad -# - frb_example--flutter_via_create -# - frb_example--flutter_via_integrate -# exclude: -# - { image: windows-2019, package: frb_example--deliberate_bad } -# - { image: macos-11, package: frb_example--deliberate_bad } -# - { image: windows-2019, package: frb_example--flutter_via_integrate } -# - { image: macos-11, package: frb_example--flutter_via_integrate } -# -# steps: -# # setup -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} -# components: rustfmt, clippy -# - uses: subosito/flutter-action@v2 -# with: -# cache: true -# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} -# architecture: x64 -# - uses: taiki-e/install-action@cargo-llvm-cov -# -# # execute -# - run: ./frb_internal generate-run-frb-codegen-command-generate --set-exit-if-changed --package ${{ matrix.package }} --coverage -# -# # report -# - uses: actions/upload-artifact@v4 -# with: -# name: ${{ github.job }}--${{ matrix.image }}--${{ matrix.package }}--coverage -# path: target/coverage -# -# generate_run_frb_codegen_command_integrate: -# name: 'Generate :: FRB Codegen :: Command Integrate' -# runs-on: ${{ matrix.image }} -# env: -# RUST_LOG: debug -# -# strategy: -# fail-fast: false -# matrix: -# image: -# - macos-11 -# - windows-2019 -# - ubuntu-20.04 -# package: -# - frb_example--flutter_via_create -# - frb_example--flutter_via_integrate -# -# steps: -# # setup -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} -# components: rustfmt, clippy -# - uses: subosito/flutter-action@v2 -# with: -# cache: true -# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} -# architecture: x64 -# - uses: taiki-e/install-action@cargo-llvm-cov -# -# # execute -# - run: ./frb_internal generate-run-frb-codegen-command-integrate --set-exit-if-changed --package ${{ matrix.package }} --coverage -# -# # report -# - uses: actions/upload-artifact@v4 -# with: -# name: ${{ github.job }}--${{ matrix.image }}--${{ matrix.package }}--coverage -# path: target/coverage -# -# generate_internal: -# name: 'Generate :: Internal' -# runs-on: ubuntu-latest -# -# steps: -# # setup -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} -# components: rustfmt, clippy -# - run: rustup toolchain install nightly && rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu -# - run: yarn global add all-contributors-cli -# - uses: subosito/flutter-action@v2 -# with: -# cache: true -# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} -# architecture: x64 -# - uses: taiki-e/install-action@cargo-llvm-cov -# -# # execute -# - run: ./frb_internal generate-internal --set-exit-if-changed --coverage -# -# # report -# - uses: actions/upload-artifact@v4 -# with: -# name: ${{ github.job }}--coverage -# path: target/coverage -# -# # ----------------------------------- bench ----------------------------------- -# -# bench_dart_native: -# name: 'Bench :: Dart :: Native' -# runs-on: ${{ matrix.image }} -# strategy: -# fail-fast: false -# matrix: -# image: -# - windows-2019 -# - macos-11 -# - ubuntu-20.04 -# -# steps: -# # setup -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} -# components: rustfmt -# - uses: dart-lang/setup-dart@v1 -# with: -# sdk: stable -# architecture: x64 -# -# # execute -# - run: ./frb_internal bench-dart-native -# -# - uses: actions/upload-artifact@v4 -# with: -# name: ${{ github.job }}--${{ matrix.image }}--benchmark -# path: frb_example/pure_dart/build/simple_benchmark/benchmark_result.json -# -# bench_upload: -# name: 'Bench :: Upload' -# runs-on: ubuntu-latest -# # NOTE Even if some previous jobs failed, we still want partial info -# if: ${{ always() && !cancelled() }} -# needs: -# # NOTE We do this to ensure bench upload *after* deploy website. -# # Otherwise, if they are run concurrently, they can push to git at the same time, causing failure for one of them -# - deploy_website -# - bench_dart_native -# -# steps: -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - name: Download artifacts -# uses: actions/download-artifact@v4 -# with: -# path: downloaded-artifacts/ -# pattern: '*-benchmark' -# - run: tree downloaded-artifacts -# - uses: dart-lang/setup-dart@v1 -# with: -# sdk: stable -# architecture: x64 -# -# - run: ./frb_internal bench-merge -# -# - uses: benchmark-action/github-action-benchmark@v1 -# # Warn: https://github.com/benchmark-action/github-action-benchmark?tab=readme-ov-file#run-only-on-your-branches -# if: github.event_name != 'pull_request' -# with: -# name: Flutter Rust Bridge Benchmark -# tool: customSmallerIsBetter -# output-file-path: merged_benchmark.json -# github-token: ${{ secrets.GITHUB_TOKEN }} -# auto-push: true -# -# # ----------------------------------- build ----------------------------------- -# -# build_flutter: -# name: 'Build :: Flutter' -# runs-on: ${{ matrix.info.image }} -# strategy: -# fail-fast: false -# matrix: -# info: -# - image: windows-2019 -# target: windows -# - image: macos-13 -# target: macos -# - image: ubuntu-latest -# target: linux -# - image: ubuntu-latest -# target: android-aab -# - image: ubuntu-latest -# target: android-apk -# - image: macos-13 -# target: ios -# -# steps: -# # setup -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# # https://docs.flutter.dev/get-started/install/linux#linux-prerequisites -# - if: runner.os == 'Linux' -# run: sudo apt-get update && sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev -# - uses: subosito/flutter-action@v2 -# with: -# cache: true -# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} -# architecture: x64 -# -# # execute -# - run: ./frb_internal build-flutter --target ${{ matrix.info.target }} -# -# # report -# - uses: actions/upload-artifact@v4 -# with: -# name: ${{ github.job }}--${{ matrix.info.target }}--output -# path: target/build_flutter_output -# -# # ----------------------------------- test ----------------------------------- -# -# test_mimic_quickstart: -# name: 'Test :: MimicQuickstart' -# runs-on: ${{ matrix.image }} -# strategy: -# fail-fast: false -# matrix: -# image: -# - windows-2019 -# # need macos-"13" because https://github.com/fzyzcjy/flutter_rust_bridge/issues/1225 -# - macos-13 -# - ubuntu-latest -# -# steps: -# # setup -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} -# components: rustfmt -# - uses: subosito/flutter-action@v2 -# with: -# cache: true -# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} -# architecture: x64 -# # https://docs.flutter.dev/get-started/install/linux#linux-prerequisites -# - if: runner.os == 'Linux' -# run: sudo apt-get update && sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev -# - if: runner.os == 'Linux' -# uses: pyvista/setup-headless-display-action@v1 -# -# # execute -# - run: ./frb_internal test-mimic-quickstart -# -# test_upgrade: -# name: 'Test :: Upgrade' -# runs-on: ${{ matrix.image }} -# strategy: -# fail-fast: false -# matrix: -# image: -# - windows-2019 -# # need macos-"13" because https://github.com/fzyzcjy/flutter_rust_bridge/issues/1225 -# - macos-13 -# - ubuntu-latest -# -# steps: -# # setup -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} -# components: rustfmt -# - uses: subosito/flutter-action@v2 -# with: -# cache: true -# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} -# architecture: x64 -# # https://docs.flutter.dev/get-started/install/linux#linux-prerequisites -# - if: runner.os == 'Linux' -# run: sudo apt-get update && sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev -# - if: runner.os == 'Linux' -# uses: pyvista/setup-headless-display-action@v1 -# - uses: taiki-e/install-action@cargo-llvm-cov -# -# # execute -# - run: ./frb_internal test-upgrade -# -# # report -# - uses: actions/upload-artifact@v4 -# with: -# name: ${{ github.job }}--${{ matrix.image }}--coverage -# path: target/coverage -# -# test_rust: -# name: 'Test :: Rust' -# runs-on: ${{ matrix.info.image }} -# strategy: -# fail-fast: false -# matrix: -# info: -# # run on various platforms -# - image: macos-11 -# version: '' -# - image: windows-2019 -# version: '' -# - image: ubuntu-latest -# version: '' -# # run on various rust versions -# - image: ubuntu-latest -# version: nightly -# - image: ubuntu-latest -# version: nightly-2023-12-16 -# # tests the MSRV -# # run on all rust packages, though only needed for frb_rust and frb_codegen -# - image: ubuntu-latest -# # update this, if a later MSRV is needed -# version: 1.74.0 -# -# steps: -# # setup -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ matrix.info.version || env.FRB_MAIN_RUST_VERSION }} -# components: rustfmt -# # TODO cache (for rust-toolchain, also for cargo build) -# - uses: dart-lang/setup-dart@v1 -# with: -# sdk: ${{ env.FRB_MAIN_DART_VERSION }} -# architecture: x64 -# - uses: taiki-e/install-action@cargo-llvm-cov -# -# # execute -# - run: ./frb_internal test-rust --coverage -# -# # report -# - uses: actions/upload-artifact@v4 -# with: -# name: ${{ github.job }}--${{ matrix.info.image }}--${{ matrix.info.version }}--coverage -# path: target/coverage -# -# test_dart_native: -# name: 'Test :: Dart :: Native' -# runs-on: ${{ matrix.image }} -# strategy: -# fail-fast: false -# matrix: -# image: -# - windows-2019 -# - macos-11 -# - ubuntu-20.04 -# package: -# - frb_dart -# - frb_utils -# - tools--frb_internal -# - frb_example--dart_minimal -# - frb_example--pure_dart -# - frb_example--pure_dart_pde -# - frb_example--dart_build_rs -# - frb_example--deliberate_bad -# exclude: -# - { image: windows-2019, package: frb_utils } -# - { image: macos-11, package: frb_utils } -# - { image: windows-2019, package: tools--frb_internal } -# - { image: macos-11, package: tools--frb_internal } -# - { image: windows-2019, package: frb_example--deliberate_bad } -# - { image: macos-11, package: frb_example--deliberate_bad } -# -# steps: -# # setup -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} -# components: rustfmt -# - uses: dart-lang/setup-dart@v1 -# with: -# sdk: stable -# architecture: x64 -# - uses: taiki-e/install-action@cargo-llvm-cov -# -# # execute -# - run: ./frb_internal test-dart-native --package ${{ matrix.package }} --coverage -# -# # report -# - uses: actions/upload-artifact@v4 -# with: -# name: ${{ github.job }}--${{ matrix.image }}--${{ matrix.package }}--coverage -# path: target/coverage -# -# test_dart_web: -# name: 'Test :: Dart :: Web' -# runs-on: ubuntu-latest -# strategy: -# fail-fast: false -# matrix: -# package: -# - frb_dart -# - frb_example--dart_minimal -# - frb_example--pure_dart -# - frb_example--pure_dart_pde -# # no need for `frb_example--deliberate_bad`, `frb_example--dart_build_rs` -# -# steps: -# # setup -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - uses: dart-lang/setup-dart@v1 -# with: -# sdk: ${{ env.FRB_MAIN_DART_VERSION }} -# architecture: x64 -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: nightly -# target: wasm32-unknown-unknown -# components: rust-src,rustfmt -# - name: Cache dependencies -# id: test-cache -# uses: actions/cache@v3 -# with: -# path: | -# ~/.cargo/bin/ -# ~/.cargo/registry/index/ -# ~/.cargo/registry/cache/ -# ~/.cargo/git/db/ -# target -# frb_example--pure_dart/rust/target/ -# frb_example--pure_dart/.local-chromium -# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} -# - name: Install crates -# if: steps.test-cache.outputs.cache-hit != 'true' -# run: | -# sh -c "$(curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf)" '' -f -# -# # execute -# - run: ./frb_internal test-dart-web --package ${{ matrix.package }} -# -# test_dart_valgrind: -# name: 'Test :: Dart :: Valgrind' -# runs-on: ubuntu-latest -# strategy: -# fail-fast: false -# matrix: -# package: -# - frb_example--dart_minimal -# - frb_example--pure_dart -# - frb_example--pure_dart_pde -# # no need for `frb_example--deliberate_bad`, `frb_example--dart_build_rs` -# -# steps: -# # setup -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} -# components: rustfmt -# - uses: dart-lang/setup-dart@v1 -# with: -# sdk: stable -# architecture: x64 -# - run: sudo apt-get update -# -# # execute -# - run: ./frb_internal test-dart-valgrind --package ${{ matrix.package }} -# -# test_dart_sanitizer: -# name: 'Test :: Dart :: Sanitizer' -# runs-on: ubuntu-latest -# strategy: -# fail-fast: false -# matrix: -# sanitizer: -# - asan -# # - msan # todo: #1824 -# - lsan -# # Every time we build TSAN in https://github.com/fzyzcjy/dart_lang_ci, it fails near the end. -# # Since it is unlikely we will have thread issues, we temporarily disable TSAN now. -# # - tsan -# package: -# - frb_example--dart_minimal -# - frb_example--pure_dart -# - frb_example--pure_dart_pde -# - frb_example--deliberate_bad -# # no need for `frb_example--dart_build_rs` -# -# steps: -# # setup -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} -# components: rustfmt -# - run: |- -# rustup toolchain install nightly -# rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu -# - uses: dart-lang/setup-dart@v1 -# with: -# sdk: stable -# architecture: x64 -# -# # execute -# - run: ./frb_internal test-dart-sanitizer --package ${{ matrix.package }} --sanitizer ${{ matrix.sanitizer }} + # ----------------------------------- deploy ----------------------------------- + + # ref https://docusaurus.io/docs/deployment#triggering-deployment-with-github-actions + deploy_website: + name: 'Deploy :: Website' + runs-on: ubuntu-latest + + steps: + # setup + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: subosito/flutter-action@v2 + with: + cache: true + flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly + target: wasm32-unknown-unknown + components: rust-src,rustfmt + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: yarn + cache-dependency-path: website/yarn.lock + - name: Setup mdBook + uses: peaceiris/actions-mdbook@v1 + with: + mdbook-version: "latest" + - name: Setup `mdbook-mermaid` + run: cargo install mdbook-mermaid + + # execute + - run: ./frb_internal generate-website + + # deploy + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + if: ${{ github.ref == 'refs/heads/master' }} + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./website/merged_target/flutter_rust_bridge + + # ----------------------------------- lint ----------------------------------- + + lint_rust_primary: + name: 'Lint :: Rust :: Primary' + runs-on: ubuntu-latest + + steps: + # setup + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: dart-lang/setup-dart@v1 + with: + sdk: ${{ env.FRB_MAIN_DART_VERSION }} + architecture: x64 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} + components: rustfmt, clippy + - run: |- + rustup toolchain install nightly + rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu + rustup target add wasm32-unknown-unknown + + # execute + - run: ./frb_internal lint-rust + + lint_dart_primary: + name: 'Lint :: Dart :: Primary' + runs-on: ubuntu-latest + + steps: + # setup + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: subosito/flutter-action@v2 + with: + cache: true + flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} + + # execute + - run: ./frb_internal lint-dart + + lint_rust_feature_flag: + name: 'Lint :: Rust :: Feature flag' + runs-on: ubuntu-latest + + steps: + # setup + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: dart-lang/setup-dart@v1 + with: + sdk: ${{ env.FRB_MAIN_DART_VERSION }} + architecture: x64 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} + components: rustfmt, clippy + - uses: taiki-e/install-action@cargo-hack + - run: |- + rustup toolchain install nightly + rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu + rustup target add wasm32-unknown-unknown + + # execute + - run: ./frb_internal lint-rust-feature-flag + + # ----------------------------------- codegen ----------------------------------- + # instead of running this explicit test for frb_codegen and frb_rust only, we run the test for + # all rust packages in the job "test_rust". While this would not be needed for these other packages, + # we avoid a ci dependency to cargo-msrv. + # However, the code is left commented here in case this decission changes. + # msrv: + # name: 'Test :: FRB Codegen :: MSRV' + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + + # - name: Install Rust + # uses: actions-rs/toolchain@v1 + # with: + # toolchain: stable + + # - name: Verify MSRV for frb_codegen + # run: | + # cargo install cargo-msrv + # cargo msrv --path frb_codegen verify + + # - name: Verify MSRV for frb_rust + # run: | + # cargo install cargo-msrv + # cargo msrv --path frb_rust verify + + generate_run_frb_codegen_command_generate: + name: 'Generate :: FRB Codegen :: Command Generate' + runs-on: ${{ matrix.image }} + + strategy: + fail-fast: false + matrix: + image: + - windows-2019 + - macos-11 + - ubuntu-20.04 + package: + - frb_example--dart_minimal + - frb_example--pure_dart + - frb_example--pure_dart_pde + - frb_example--dart_build_rs + - frb_example--deliberate_bad + - frb_example--flutter_via_create + - frb_example--flutter_via_integrate + exclude: + - { image: windows-2019, package: frb_example--deliberate_bad } + - { image: macos-11, package: frb_example--deliberate_bad } + - { image: windows-2019, package: frb_example--flutter_via_integrate } + - { image: macos-11, package: frb_example--flutter_via_integrate } + + steps: + # setup + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} + components: rustfmt, clippy + - uses: subosito/flutter-action@v2 + with: + cache: true + flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} + architecture: x64 + - uses: taiki-e/install-action@cargo-llvm-cov + + # execute + - run: ./frb_internal generate-run-frb-codegen-command-generate --set-exit-if-changed --package ${{ matrix.package }} --coverage + + # report + - uses: actions/upload-artifact@v4 + with: + name: ${{ github.job }}--${{ matrix.image }}--${{ matrix.package }}--coverage + path: target/coverage + + generate_run_frb_codegen_command_integrate: + name: 'Generate :: FRB Codegen :: Command Integrate' + runs-on: ${{ matrix.image }} + env: + RUST_LOG: debug + + strategy: + fail-fast: false + matrix: + image: + - macos-11 + - windows-2019 + - ubuntu-20.04 + package: + - frb_example--flutter_via_create + - frb_example--flutter_via_integrate + + steps: + # setup + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} + components: rustfmt, clippy + - uses: subosito/flutter-action@v2 + with: + cache: true + flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} + architecture: x64 + - uses: taiki-e/install-action@cargo-llvm-cov + + # execute + - run: ./frb_internal generate-run-frb-codegen-command-integrate --set-exit-if-changed --package ${{ matrix.package }} --coverage + + # report + - uses: actions/upload-artifact@v4 + with: + name: ${{ github.job }}--${{ matrix.image }}--${{ matrix.package }}--coverage + path: target/coverage + + generate_internal: + name: 'Generate :: Internal' + runs-on: ubuntu-latest + + steps: + # setup + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} + components: rustfmt, clippy + - run: rustup toolchain install nightly && rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu + - run: yarn global add all-contributors-cli + - uses: subosito/flutter-action@v2 + with: + cache: true + flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} + architecture: x64 + - uses: taiki-e/install-action@cargo-llvm-cov + + # execute + - run: ./frb_internal generate-internal --set-exit-if-changed --coverage + + # report + - uses: actions/upload-artifact@v4 + with: + name: ${{ github.job }}--coverage + path: target/coverage + + # ----------------------------------- bench ----------------------------------- + + bench_dart_native: + name: 'Bench :: Dart :: Native' + runs-on: ${{ matrix.image }} + strategy: + fail-fast: false + matrix: + image: + - windows-2019 + - macos-11 + - ubuntu-20.04 + + steps: + # setup + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} + components: rustfmt + - uses: dart-lang/setup-dart@v1 + with: + sdk: stable + architecture: x64 + + # execute + - run: ./frb_internal bench-dart-native + + - uses: actions/upload-artifact@v4 + with: + name: ${{ github.job }}--${{ matrix.image }}--benchmark + path: frb_example/pure_dart/build/simple_benchmark/benchmark_result.json + + bench_upload: + name: 'Bench :: Upload' + runs-on: ubuntu-latest + # NOTE Even if some previous jobs failed, we still want partial info + if: ${{ always() && !cancelled() }} + needs: + # NOTE We do this to ensure bench upload *after* deploy website. + # Otherwise, if they are run concurrently, they can push to git at the same time, causing failure for one of them + - deploy_website + - bench_dart_native + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + path: downloaded-artifacts/ + pattern: '*-benchmark' + - run: tree downloaded-artifacts + - uses: dart-lang/setup-dart@v1 + with: + sdk: stable + architecture: x64 + + - run: ./frb_internal bench-merge + + - uses: benchmark-action/github-action-benchmark@v1 + # Warn: https://github.com/benchmark-action/github-action-benchmark?tab=readme-ov-file#run-only-on-your-branches + if: github.event_name != 'pull_request' + with: + name: Flutter Rust Bridge Benchmark + tool: customSmallerIsBetter + output-file-path: merged_benchmark.json + github-token: ${{ secrets.GITHUB_TOKEN }} + auto-push: true + + # ----------------------------------- build ----------------------------------- + + build_flutter: + name: 'Build :: Flutter' + runs-on: ${{ matrix.info.image }} + strategy: + fail-fast: false + matrix: + info: + - image: windows-2019 + target: windows + - image: macos-13 + target: macos + - image: ubuntu-latest + target: linux + - image: ubuntu-latest + target: android-aab + - image: ubuntu-latest + target: android-apk + - image: macos-13 + target: ios + + steps: + # setup + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + # https://docs.flutter.dev/get-started/install/linux#linux-prerequisites + - if: runner.os == 'Linux' + run: sudo apt-get update && sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev + - uses: subosito/flutter-action@v2 + with: + cache: true + flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} + architecture: x64 + + # execute + - run: ./frb_internal build-flutter --target ${{ matrix.info.target }} + + # report + - uses: actions/upload-artifact@v4 + with: + name: ${{ github.job }}--${{ matrix.info.target }}--output + path: target/build_flutter_output + + # ----------------------------------- test ----------------------------------- + + test_mimic_quickstart: + name: 'Test :: MimicQuickstart' + runs-on: ${{ matrix.image }} + strategy: + fail-fast: false + matrix: + image: + - windows-2019 + # need macos-"13" because https://github.com/fzyzcjy/flutter_rust_bridge/issues/1225 + - macos-13 + - ubuntu-latest + + steps: + # setup + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} + components: rustfmt + - uses: subosito/flutter-action@v2 + with: + cache: true + flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} + architecture: x64 + # https://docs.flutter.dev/get-started/install/linux#linux-prerequisites + - if: runner.os == 'Linux' + run: sudo apt-get update && sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev + - if: runner.os == 'Linux' + uses: pyvista/setup-headless-display-action@v1 + + # execute + - run: ./frb_internal test-mimic-quickstart + + test_upgrade: + name: 'Test :: Upgrade' + runs-on: ${{ matrix.image }} + strategy: + fail-fast: false + matrix: + image: + - windows-2019 + # need macos-"13" because https://github.com/fzyzcjy/flutter_rust_bridge/issues/1225 + - macos-13 + - ubuntu-latest + + steps: + # setup + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} + components: rustfmt + - uses: subosito/flutter-action@v2 + with: + cache: true + flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} + architecture: x64 + # https://docs.flutter.dev/get-started/install/linux#linux-prerequisites + - if: runner.os == 'Linux' + run: sudo apt-get update && sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev + - if: runner.os == 'Linux' + uses: pyvista/setup-headless-display-action@v1 + - uses: taiki-e/install-action@cargo-llvm-cov + + # execute + - run: ./frb_internal test-upgrade + + # report + - uses: actions/upload-artifact@v4 + with: + name: ${{ github.job }}--${{ matrix.image }}--coverage + path: target/coverage + + test_rust: + name: 'Test :: Rust' + runs-on: ${{ matrix.info.image }} + strategy: + fail-fast: false + matrix: + info: + # run on various platforms + - image: macos-11 + version: '' + - image: windows-2019 + version: '' + - image: ubuntu-latest + version: '' + # run on various rust versions + - image: ubuntu-latest + version: nightly + - image: ubuntu-latest + version: nightly-2023-12-16 + # tests the MSRV + # run on all rust packages, though only needed for frb_rust and frb_codegen + - image: ubuntu-latest + # update this, if a later MSRV is needed + version: 1.74.0 + + steps: + # setup + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ matrix.info.version || env.FRB_MAIN_RUST_VERSION }} + components: rustfmt + # TODO cache (for rust-toolchain, also for cargo build) + - uses: dart-lang/setup-dart@v1 + with: + sdk: ${{ env.FRB_MAIN_DART_VERSION }} + architecture: x64 + - uses: taiki-e/install-action@cargo-llvm-cov + + # execute + - run: ./frb_internal test-rust --coverage + + # report + - uses: actions/upload-artifact@v4 + with: + name: ${{ github.job }}--${{ matrix.info.image }}--${{ matrix.info.version }}--coverage + path: target/coverage + + test_dart_native: + name: 'Test :: Dart :: Native' + runs-on: ${{ matrix.image }} + strategy: + fail-fast: false + matrix: + image: + - windows-2019 + - macos-11 + - ubuntu-20.04 + package: + - frb_dart + - frb_utils + - tools--frb_internal + - frb_example--dart_minimal + - frb_example--pure_dart + - frb_example--pure_dart_pde + - frb_example--dart_build_rs + - frb_example--deliberate_bad + exclude: + - { image: windows-2019, package: frb_utils } + - { image: macos-11, package: frb_utils } + - { image: windows-2019, package: tools--frb_internal } + - { image: macos-11, package: tools--frb_internal } + - { image: windows-2019, package: frb_example--deliberate_bad } + - { image: macos-11, package: frb_example--deliberate_bad } + + steps: + # setup + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} + components: rustfmt + - uses: dart-lang/setup-dart@v1 + with: + sdk: stable + architecture: x64 + - uses: taiki-e/install-action@cargo-llvm-cov + + # execute + - run: ./frb_internal test-dart-native --package ${{ matrix.package }} --coverage + + # report + - uses: actions/upload-artifact@v4 + with: + name: ${{ github.job }}--${{ matrix.image }}--${{ matrix.package }}--coverage + path: target/coverage + + test_dart_web: + name: 'Test :: Dart :: Web' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + package: + - frb_dart + - frb_example--dart_minimal + - frb_example--pure_dart + - frb_example--pure_dart_pde + # no need for `frb_example--deliberate_bad`, `frb_example--dart_build_rs` + + steps: + # setup + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: dart-lang/setup-dart@v1 + with: + sdk: ${{ env.FRB_MAIN_DART_VERSION }} + architecture: x64 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly + target: wasm32-unknown-unknown + components: rust-src,rustfmt + - name: Cache dependencies + id: test-cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target + frb_example--pure_dart/rust/target/ + frb_example--pure_dart/.local-chromium + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Install crates + if: steps.test-cache.outputs.cache-hit != 'true' + run: | + sh -c "$(curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf)" '' -f + + # execute + - run: ./frb_internal test-dart-web --package ${{ matrix.package }} + + test_dart_valgrind: + name: 'Test :: Dart :: Valgrind' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + package: + - frb_example--dart_minimal + - frb_example--pure_dart + - frb_example--pure_dart_pde + # no need for `frb_example--deliberate_bad`, `frb_example--dart_build_rs` + + steps: + # setup + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} + components: rustfmt + - uses: dart-lang/setup-dart@v1 + with: + sdk: stable + architecture: x64 + - run: sudo apt-get update + + # execute + - run: ./frb_internal test-dart-valgrind --package ${{ matrix.package }} + + test_dart_sanitizer: + name: 'Test :: Dart :: Sanitizer' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sanitizer: + - asan + # - msan # todo: #1824 + - lsan + # Every time we build TSAN in https://github.com/fzyzcjy/dart_lang_ci, it fails near the end. + # Since it is unlikely we will have thread issues, we temporarily disable TSAN now. + # - tsan + package: + - frb_example--dart_minimal + - frb_example--pure_dart + - frb_example--pure_dart_pde + - frb_example--deliberate_bad + # no need for `frb_example--dart_build_rs` + + steps: + # setup + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} + components: rustfmt + - run: |- + rustup toolchain install nightly + rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu + - uses: dart-lang/setup-dart@v1 + with: + sdk: stable + architecture: x64 + + # execute + - run: ./frb_internal test-dart-sanitizer --package ${{ matrix.package }} --sanitizer ${{ matrix.sanitizer }} # ref https://betterprogramming.pub/test-flutter-apps-on-android-with-github-actions-abdba2137b4 test_flutter_native_android: @@ -809,176 +809,176 @@ jobs: profile: ${{ matrix.device }} script: ./frb_internal test-flutter-native --package ${{ matrix.package }} -# # ref https://medium.com/flutter-community/run-flutter-driver-tests-on-github-actions-13c639c7e4ab -# test_flutter_native_ios: -# name: 'Test :: Flutter :: Native:: iOS' -# runs-on: macos-latest -# strategy: -# fail-fast: false -# matrix: -# package: -# - frb_example--flutter_via_create -# # no `frb_example--flutter_via_integrate` since it is similar to `flutter_via_create` -# device: -# - "iPad (10th generation) Simulator (17.2)" -# - "iPhone 14 Pro Max Simulator (17.2)" -# -# steps: -# # setup -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - name: "Start Simulator" -# run: | -# # list all devices -# xcrun xctrace list devices -# # the extra "(" is to avoid matching things like "iPhone 12 Pro Max Simulator (16.2) + Apple Watch Series 5 - 44mm (8.0)" -# UDID=$(xcrun xctrace list devices | grep '${{ matrix.device }} (' | awk '{print $NF}' | tr -d '()') -# echo UDID=$UDID -# xcrun simctl boot "${UDID:?No Simulator with this name found}" -# - uses: subosito/flutter-action@v2 -# with: -# cache: true -# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} -# architecture: x64 -# -# # execute -# - run: ./frb_internal test-flutter-native --package ${{ matrix.package }} -# -# test_flutter_native_desktop: -# name: 'Test :: Flutter :: Native:: ${{ matrix.info.platform }} (${{ matrix.info.package }})' -# runs-on: ${{ matrix.info.image }} -# strategy: -# fail-fast: false -# matrix: -# info: -# - image: windows-2019 -# platform: windows -# package: frb_example--flutter_via_create -# # need macos-"13" because https://github.com/fzyzcjy/flutter_rust_bridge/issues/1225 -# - image: macos-13 -# platform: macos -# package: frb_example--flutter_via_create -# - image: ubuntu-latest -# platform: linux -# package: frb_example--flutter_via_create -# # only slightly test `flutter_via_integrate` since quite similar to `flutter_via_create` -# - image: ubuntu-latest -# platform: linux -# package: frb_example--flutter_via_integrate -# # only slightly test `gallery`, since mainly used on web -# - image: ubuntu-latest -# platform: linux -# package: frb_example--gallery -# -# steps: -# # setup -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# # https://docs.flutter.dev/get-started/install/linux#linux-prerequisites -# - if: runner.os == 'Linux' -# run: sudo apt-get update && sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev -# - if: runner.os == 'Linux' -# uses: pyvista/setup-headless-display-action@v1 -# - uses: subosito/flutter-action@v2 -# with: -# cache: true -# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} -# architecture: x64 -# -# # execute -# - run: ./frb_internal test-flutter-native --flutter-test-args '--device-id ${{ matrix.info.platform }}' --package ${{ matrix.info.package }} -# -# test_flutter_web: -# name: 'Test :: Flutter :: Web' -# runs-on: ubuntu-latest -# strategy: -# fail-fast: false -# matrix: -# package: -# - frb_example--flutter_via_create -# # no `frb_example--flutter_via_integrate` since it is similar to `flutter_via_create` -# - frb_example--gallery -# -# steps: -# - uses: catchpoint/workflow-telemetry-action@v1 -# with: -# comment_on_pr: false -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - uses: subosito/flutter-action@v2 -# with: -# cache: true -# flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} -# architecture: x64 -# - uses: dtolnay/rust-toolchain@stable -# with: -# toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} -# - uses: taiki-e/install-action@cargo-llvm-cov -# - run: |- -# rustup toolchain install nightly -# rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu -# - uses: nanasess/setup-chromedriver@v2 -# # ref https://github.com/dewbambs/flutter_github_actions/blob/dev/.github/workflows/e2e_test.yml -# - run: |- -# sleep 15 -# export DISPLAY=:99 -# chromedriver --port=4444 --verbose & -# sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & -# -# sleep 15 -# lsof -i :4444 -# -# # execute -# - run: ./frb_internal test-flutter-web --package ${{ matrix.package }} --coverage -# -# # report -# - uses: actions/upload-artifact@v4 -# with: -# name: ${{ github.job }}--${{ matrix.package }}--coverage -# path: target/coverage -# -# # ----------------------------------- misc ----------------------------------- -# -# # Why one separate codecov job: Otherwise, when some jobs upload artifact while some not, -# # the (partial) coverage will show up and be very low - which surely does not reflect actual coverage. -# misc_codecov: -# name: 'Misc :: Codecov' -# runs-on: ubuntu-latest -# # NOTE Even if some previous jobs failed, we still want partial info -# if: ${{ always() && !cancelled() }} -# # NOTE need to depend on *all* jobs that may generate codecov artifacts -# needs: -# - generate_run_frb_codegen_command_generate -# - generate_run_frb_codegen_command_integrate -# - generate_internal -# - test_upgrade -# - test_rust -# - test_dart_native -# - test_flutter_web -# -# steps: -# - uses: actions/checkout@v4 -# with: -# submodules: recursive -# - name: Download artifacts -# uses: actions/download-artifact@v4 -# with: -# path: downloaded-artifacts/ -# pattern: '*-coverage' -# - run: tree downloaded-artifacts -# -# - uses: codecov/codecov-action@v3 -# env: -# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} -# with: -# directory: downloaded-artifacts -# verbose: true + # ref https://medium.com/flutter-community/run-flutter-driver-tests-on-github-actions-13c639c7e4ab + test_flutter_native_ios: + name: 'Test :: Flutter :: Native:: iOS' + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + package: + - frb_example--flutter_via_create + # no `frb_example--flutter_via_integrate` since it is similar to `flutter_via_create` + device: + - "iPad (10th generation) Simulator (17.2)" + - "iPhone 14 Pro Max Simulator (17.2)" + + steps: + # setup + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: "Start Simulator" + run: | + # list all devices + xcrun xctrace list devices + # the extra "(" is to avoid matching things like "iPhone 12 Pro Max Simulator (16.2) + Apple Watch Series 5 - 44mm (8.0)" + UDID=$(xcrun xctrace list devices | grep '${{ matrix.device }} (' | awk '{print $NF}' | tr -d '()') + echo UDID=$UDID + xcrun simctl boot "${UDID:?No Simulator with this name found}" + - uses: subosito/flutter-action@v2 + with: + cache: true + flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} + architecture: x64 + + # execute + - run: ./frb_internal test-flutter-native --package ${{ matrix.package }} + + test_flutter_native_desktop: + name: 'Test :: Flutter :: Native:: ${{ matrix.info.platform }} (${{ matrix.info.package }})' + runs-on: ${{ matrix.info.image }} + strategy: + fail-fast: false + matrix: + info: + - image: windows-2019 + platform: windows + package: frb_example--flutter_via_create + # need macos-"13" because https://github.com/fzyzcjy/flutter_rust_bridge/issues/1225 + - image: macos-13 + platform: macos + package: frb_example--flutter_via_create + - image: ubuntu-latest + platform: linux + package: frb_example--flutter_via_create + # only slightly test `flutter_via_integrate` since quite similar to `flutter_via_create` + - image: ubuntu-latest + platform: linux + package: frb_example--flutter_via_integrate + # only slightly test `gallery`, since mainly used on web + - image: ubuntu-latest + platform: linux + package: frb_example--gallery + + steps: + # setup + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + # https://docs.flutter.dev/get-started/install/linux#linux-prerequisites + - if: runner.os == 'Linux' + run: sudo apt-get update && sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev + - if: runner.os == 'Linux' + uses: pyvista/setup-headless-display-action@v1 + - uses: subosito/flutter-action@v2 + with: + cache: true + flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} + architecture: x64 + + # execute + - run: ./frb_internal test-flutter-native --flutter-test-args '--device-id ${{ matrix.info.platform }}' --package ${{ matrix.info.package }} + + test_flutter_web: + name: 'Test :: Flutter :: Web' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + package: + - frb_example--flutter_via_create + # no `frb_example--flutter_via_integrate` since it is similar to `flutter_via_create` + - frb_example--gallery + + steps: + - uses: catchpoint/workflow-telemetry-action@v1 + with: + comment_on_pr: false + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: subosito/flutter-action@v2 + with: + cache: true + flutter-version: ${{ env.FRB_MAIN_FLUTTER_VERSION }} + architecture: x64 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ env.FRB_MAIN_RUST_VERSION }} + - uses: taiki-e/install-action@cargo-llvm-cov + - run: |- + rustup toolchain install nightly + rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu + - uses: nanasess/setup-chromedriver@v2 + # ref https://github.com/dewbambs/flutter_github_actions/blob/dev/.github/workflows/e2e_test.yml + - run: |- + sleep 15 + export DISPLAY=:99 + chromedriver --port=4444 --verbose & + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + + sleep 15 + lsof -i :4444 + + # execute + - run: ./frb_internal test-flutter-web --package ${{ matrix.package }} --coverage + + # report + - uses: actions/upload-artifact@v4 + with: + name: ${{ github.job }}--${{ matrix.package }}--coverage + path: target/coverage + + # ----------------------------------- misc ----------------------------------- + + # Why one separate codecov job: Otherwise, when some jobs upload artifact while some not, + # the (partial) coverage will show up and be very low - which surely does not reflect actual coverage. + misc_codecov: + name: 'Misc :: Codecov' + runs-on: ubuntu-latest + # NOTE Even if some previous jobs failed, we still want partial info + if: ${{ always() && !cancelled() }} + # NOTE need to depend on *all* jobs that may generate codecov artifacts + needs: + - generate_run_frb_codegen_command_generate + - generate_run_frb_codegen_command_integrate + - generate_internal + - test_upgrade + - test_rust + - test_dart_native + - test_flutter_web + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + path: downloaded-artifacts/ + pattern: '*-coverage' + - run: tree downloaded-artifacts + + - uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + directory: downloaded-artifacts + verbose: true From 0d26b2dab0f5cf1afe45948e5596e85b9c84941d Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Mon, 6 May 2024 09:10:09 +0800 Subject: [PATCH 4/5] chore: more --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 92ec86c830..05875553d7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -755,7 +755,7 @@ jobs: - frb_example--flutter_via_create # no `frb_example--flutter_via_integrate` since it is similar to `flutter_via_create` device: -# - "pixel" + - "pixel" - "Nexus 6" api-level: [ 29 ] From fc3ad70b169c27ee6ffa0d00482a9e075121d61c Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Mon, 6 May 2024 10:58:50 +0800 Subject: [PATCH 5/5] chore: more --- frb_example/pure_dart/test/api/event_listener_test.dart | 2 ++ .../pseudo_manual/event_listener_twin_rust_async_sse_test.dart | 2 ++ .../api/pseudo_manual/event_listener_twin_rust_async_test.dart | 2 ++ .../test/api/pseudo_manual/event_listener_twin_sse_test.dart | 2 ++ frb_example/pure_dart_pde/test/api/event_listener_test.dart | 2 ++ .../api/pseudo_manual/event_listener_twin_rust_async_test.dart | 2 ++ 6 files changed, 12 insertions(+) diff --git a/frb_example/pure_dart/test/api/event_listener_test.dart b/frb_example/pure_dart/test/api/event_listener_test.dart index e3620a061d..5242fe4ce7 100644 --- a/frb_example/pure_dart/test/api/event_listener_test.dart +++ b/frb_example/pure_dart/test/api/event_listener_test.dart @@ -31,6 +31,8 @@ Future main({bool skipRustLibInit = false}) async { await closeEventListenerTwinNormal(); + await Future.delayed(const Duration(seconds: 1)); + expect(logs, ['one', 'two']); }); diff --git a/frb_example/pure_dart/test/api/pseudo_manual/event_listener_twin_rust_async_sse_test.dart b/frb_example/pure_dart/test/api/pseudo_manual/event_listener_twin_rust_async_sse_test.dart index 472d3303f8..b443f1aead 100644 --- a/frb_example/pure_dart/test/api/pseudo_manual/event_listener_twin_rust_async_sse_test.dart +++ b/frb_example/pure_dart/test/api/pseudo_manual/event_listener_twin_rust_async_sse_test.dart @@ -35,6 +35,8 @@ Future main({bool skipRustLibInit = false}) async { await closeEventListenerTwinRustAsyncSse(); + await Future.delayed(const Duration(seconds: 1)); + expect(logs, ['one', 'two']); }); } diff --git a/frb_example/pure_dart/test/api/pseudo_manual/event_listener_twin_rust_async_test.dart b/frb_example/pure_dart/test/api/pseudo_manual/event_listener_twin_rust_async_test.dart index 225ae9b683..e87f7f1a6a 100644 --- a/frb_example/pure_dart/test/api/pseudo_manual/event_listener_twin_rust_async_test.dart +++ b/frb_example/pure_dart/test/api/pseudo_manual/event_listener_twin_rust_async_test.dart @@ -35,6 +35,8 @@ Future main({bool skipRustLibInit = false}) async { await closeEventListenerTwinRustAsync(); + await Future.delayed(const Duration(seconds: 1)); + expect(logs, ['one', 'two']); }); } diff --git a/frb_example/pure_dart/test/api/pseudo_manual/event_listener_twin_sse_test.dart b/frb_example/pure_dart/test/api/pseudo_manual/event_listener_twin_sse_test.dart index e7db8a6b1b..22494f84b1 100644 --- a/frb_example/pure_dart/test/api/pseudo_manual/event_listener_twin_sse_test.dart +++ b/frb_example/pure_dart/test/api/pseudo_manual/event_listener_twin_sse_test.dart @@ -35,6 +35,8 @@ Future main({bool skipRustLibInit = false}) async { await closeEventListenerTwinSse(); + await Future.delayed(const Duration(seconds: 1)); + expect(logs, ['one', 'two']); }); } diff --git a/frb_example/pure_dart_pde/test/api/event_listener_test.dart b/frb_example/pure_dart_pde/test/api/event_listener_test.dart index 8ab2e0acb4..dc2bcbeef9 100644 --- a/frb_example/pure_dart_pde/test/api/event_listener_test.dart +++ b/frb_example/pure_dart_pde/test/api/event_listener_test.dart @@ -33,6 +33,8 @@ Future main({bool skipRustLibInit = false}) async { await closeEventListenerTwinNormal(); + await Future.delayed(const Duration(seconds: 1)); + expect(logs, ['one', 'two']); }); diff --git a/frb_example/pure_dart_pde/test/api/pseudo_manual/event_listener_twin_rust_async_test.dart b/frb_example/pure_dart_pde/test/api/pseudo_manual/event_listener_twin_rust_async_test.dart index d87778be46..eb3960795e 100644 --- a/frb_example/pure_dart_pde/test/api/pseudo_manual/event_listener_twin_rust_async_test.dart +++ b/frb_example/pure_dart_pde/test/api/pseudo_manual/event_listener_twin_rust_async_test.dart @@ -37,6 +37,8 @@ Future main({bool skipRustLibInit = false}) async { await closeEventListenerTwinRustAsync(); + await Future.delayed(const Duration(seconds: 1)); + expect(logs, ['one', 'two']); }); }