Workflow cleanups #64
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: | |
matrix: | |
os: [ubuntu, macos, windows] | |
sdk: [stable, dev] | |
package: [native_assets_builder, native_assets_cli, native_toolchain_c] | |
dependencies: [published, path] | |
# 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: | |
# Only run analyze against dev on one host. | |
- os: macos | |
sdk: dev | |
- os: windows | |
sdk: dev | |
# Only run path deps on dev | |
- sdk: stable | |
dependencies: published | |
runs-on: ${{ matrix.os }}-latest | |
defaults: | |
run: | |
working-directory: pkgs/${{ matrix.package }} | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d | |
with: | |
sdk: ${{ matrix.sdk }} | |
- uses: nttld/setup-ndk@6a7e9c5494a25c4842ca1011f710300132eacd94 | |
with: | |
ndk-version: r26b | |
if: ${{ matrix.sdk == 'stable' }} | |
- run: find -type f -name 'pubspec_overrides.yaml' -delete | |
if: ${{ matrix.dependencies == 'published' }} | |
- 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_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 example/native_add_app/ | |
if: ${{ matrix.package == 'native_assets_cli' }} | |
- run: dart pub get -C example/native_add_library/ | |
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 . | |
if: ${{ matrix.sdk == 'stable' }} | |
- 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.sdk == 'stable' && matrix.os == 'ubuntu' }} | |
- run: dart test | |
if: ${{ matrix.sdk == 'stable' }} | |
- run: dart --enable-experiment=native-assets test | |
working-directory: pkgs/${{ matrix.package }}/example/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/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/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/native_add_app/bin/native_add_app/ | |
if: ${{ matrix.package == 'native_assets_cli' && matrix.sdk == 'dev' && !matrix.breaking-change }} | |
- name: Install coverage | |
run: dart pub global activate coverage | |
if: ${{ matrix.sdk == 'stable' && matrix.dependencies == 'published' }} | |
- name: Collect coverage | |
run: dart pub global run coverage:test_with_coverage | |
if: ${{ matrix.sdk == 'stable' && matrix.dependencies == 'published' }} | |
- name: Upload coverage | |
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 | |
with: | |
flag-name: ${{ matrix.package }}_${{ matrix.os }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel: true | |
if: ${{ matrix.sdk == 'stable' && matrix.dependencies == 'published' }} | |
coverage-finished: | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Upload coverage | |
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 | |
with: | |
carryforward: "ffigen_macos,jnigen_tests,jni_tests" | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel-finished: true |