Skip to content

Add native_dynamic_linking to test_data #809

Add native_dynamic_linking to test_data

Add native_dynamic_linking to test_data #809

Workflow file for this run

# CI for the native_* packages.
#
# Combined into a single workflow so that deps are configured and installed once.
name: native
permissions: read-all
on:
pull_request:
branches: [main]
paths:
- ".github/workflows/native.yaml"
- "pkgs/native_assets_builder/**"
- "pkgs/native_assets_cli/**"
- "pkgs/native_toolchain_c/**"
- "tools/**"
push:
branches: [main]
paths:
- ".github/workflows/native.yaml"
- "pkgs/native_assets_builder/**"
- "pkgs/native_assets_cli/**"
- "pkgs/native_toolchain_c/**"
- "tools/**"
schedule:
- cron: "0 0 * * 0" # weekly
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
# TODO(https://github.com/dart-lang/native/issues/1154): Use 'stable' instead of 3.3.0.
sdk: [stable, 3.3.0, dev]
package: [native_assets_builder, native_assets_cli, native_toolchain_c]
# Breaking changes temporarily break the example run on the Dart SDK until native_assets_builder is rolled into the Dart SDK dev build.
breaking-change: [false]
exclude:
# TODO(https://github.com/dart-lang/native/issues/1154): Use 'stable' instead of 3.3.0.
- os: macos
sdk: 3.3.0
- os: ubuntu
sdk: 3.3.0
- os: windows
sdk: stable
# native_assets_builder uses `dart compile kernel --depfile` which is only available in 3.5.0.
# We don't care too much about native_assets_builder on stable. It will be pulled into Dart and Flutter on last master/main.
- sdk: stable
package: native_assets_builder
- sdk: 3.3.0
package: native_assets_builder
runs-on: ${{ matrix.os }}-latest
defaults:
run:
working-directory: pkgs/${{ matrix.package }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
with:
sdk: ${{ matrix.sdk }}
- uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410
with:
ndk-version: r26b
if: ${{ matrix.os != 'macos' }}
- run: dart pub get
- run: dart pub get -C test_data/dart_app/
if: ${{ matrix.package == 'native_assets_builder' }}
- run: dart pub get -C test_data/native_add/
if: ${{ matrix.package == 'native_assets_builder' }}
- run: dart pub get -C test_data/native_add_v1_0_0/
if: ${{ matrix.package == 'native_assets_builder' }}
- run: dart pub get -C test_data/native_add_add_source/
if: ${{ matrix.package == 'native_assets_builder' }}
- run: dart pub get -C test_data/native_subtract/
if: ${{ matrix.package == 'native_assets_builder' }}
- run: dart pub get -C test_data/package_reading_metadata/
if: ${{ matrix.package == 'native_assets_builder' }}
- run: dart pub get -C test_data/package_with_metadata/
if: ${{ matrix.package == 'native_assets_builder' }}
- run: dart pub get -C test_data/simple_link/
if: ${{ matrix.package == 'native_assets_builder' }}
- run: dart pub get -C test_data/complex_link/
if: ${{ matrix.package == 'native_assets_builder' }}
- run: dart pub get -C test_data/complex_link_helper/
if: ${{ matrix.package == 'native_assets_builder' }}
- run: dart pub get -C test_data/drop_dylib_link/
if: ${{ matrix.package == 'native_assets_builder' }}
- run: dart pub get -C test_data/add_asset_link/
if: ${{ matrix.package == 'native_assets_builder' }}
- run: dart pub get -C test_data/treeshaking_native_libs/
if: ${{ matrix.package == 'native_assets_builder' }}
- run: dart pub get -C test_data/native_dynamic_linking/
if: ${{ matrix.package == 'native_assets_builder' }}
- run: dart pub get -C example/build/native_dynamic_linking/
if: ${{ matrix.package == 'native_assets_cli' }}
- run: dart pub get -C example/build/native_add_app/
if: ${{ matrix.package == 'native_assets_cli' }}
- run: dart pub get -C example/build/native_add_library/
if: ${{ matrix.package == 'native_assets_cli' }}
- run: dart pub get -C example/build/use_dart_api/
if: ${{ matrix.package == 'native_assets_cli' }}
- run: dart pub get -C example/link/package_with_assets/
if: ${{ matrix.package == 'native_assets_cli' }}
- run: dart pub get -C example/link/app_with_asset_treeshaking/
if: ${{ matrix.package == 'native_assets_cli' }}
- run: dart analyze --fatal-infos
# Run on dev to ensure we're not depending on deprecated SDK things.
- run: dart format --output=none --set-exit-if-changed .
- name: Install native toolchains
run: sudo apt-get update && sudo apt-get install clang-15 gcc-i686-linux-gnu gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf gcc-riscv64-linux-gnu
if: ${{ matrix.os == 'ubuntu' }}
- run: dart test
- run: dart --enable-experiment=native-assets test
working-directory: pkgs/${{ matrix.package }}/example/build/native_dynamic_linking/
if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change && matrix.os != 'windows' }}
- run: dart --enable-experiment=native-assets test
working-directory: pkgs/${{ matrix.package }}/example/build/native_add_app/
if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }}
- run: dart --enable-experiment=native-assets run
working-directory: pkgs/${{ matrix.package }}/example/build/native_add_app/
if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }}
- run: dart --enable-experiment=native-assets build bin/native_add_app.dart
working-directory: pkgs/${{ matrix.package }}/example/build/native_add_app/
if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }}
- run: ./native_add_app.exe
working-directory: pkgs/${{ matrix.package }}/example/build/native_add_app/bin/native_add_app/
if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }}
- run: dart --enable-experiment=native-assets test
working-directory: pkgs/${{ matrix.package }}/example/build/use_dart_api/
if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }}
- name: Install coverage
run: dart pub global activate coverage
- name: Collect coverage
run: dart pub global run coverage:test_with_coverage
- name: Upload coverage
uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63
with:
flag-name: ${{ matrix.package }}_${{ matrix.os }}
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
coverage-finished:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Upload coverage
uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63
with:
carryforward: "ffigen,jni,jnigen,native_assets_builder_macos,native_assets_builder_ubuntu,native_assets_builder_windows,native_assets_cli_macos,native_assets_cli_ubuntu,native_assets_cli_windows,native_toolchain_c_macos,native_toolchain_c_ubuntu,native_toolchain_c_windows,objective_c,swift2objc"
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true