| name: dart |
| permissions: read-all |
| |
| on: |
| pull_request: |
| branches: [main] |
| paths: |
| - ".github/workflows/dart.yaml" |
| - "pkgs/**" |
| push: |
| branches: [main] |
| paths: |
| - ".github/workflows/dart.yaml" |
| - "pkgs/**" |
| schedule: |
| - cron: "0 0 * * 0" # weekly |
| |
| jobs: |
| build: |
| strategy: |
| matrix: |
| os: [ubuntu, macos, windows] |
| sdk: [stable, dev] |
| package: [c_compiler, native_assets_cli] |
| exclude: |
| # Only run analyze against dev on one host. |
| - os: macos |
| sdk: dev |
| - os: windows |
| sdk: dev |
| |
| runs-on: ${{ matrix.os }}-latest |
| |
| defaults: |
| run: |
| working-directory: pkgs/${{ matrix.package }} |
| |
| steps: |
| - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab |
| |
| - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f |
| with: |
| sdk: ${{ matrix.sdk }} |
| |
| - uses: nttld/setup-ndk@803a3efeb3c29335fb1cc538142281f6827aa8a5 |
| with: |
| ndk-version: r25b |
| if: ${{ matrix.sdk == 'stable' }} |
| |
| - run: dart pub get |
| |
| - run: dart pub get |
| working-directory: pkgs/native_assets_cli/example/native_add/ |
| 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-14 gcc-i686-linux-gnu gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf |
| if: ${{ matrix.sdk == 'stable' && matrix.os == 'ubuntu' }} |
| |
| - run: dart test |
| if: ${{ matrix.sdk == 'stable' }} |
| |
| - name: Install coverage |
| run: dart pub global activate coverage |
| if: ${{ matrix.sdk == 'stable' }} |
| |
| - name: Collect coverage |
| run: dart pub global run coverage:test_with_coverage |
| if: ${{ matrix.sdk == 'stable' }} |
| |
| - name: Upload coverage |
| uses: coverallsapp/github-action@f350da2c033043742f89e8c0b7b5145a1616da6d |
| with: |
| flag-name: ${{ matrix.package }}-${{ matrix.os }} |
| github-token: ${{ secrets.GITHUB_TOKEN }} |
| parallel: true |
| if: ${{ matrix.sdk == 'stable' }} |
| |
| coverage-finished: |
| needs: [build] |
| runs-on: ubuntu-latest |
| steps: |
| - name: Upload coverage |
| uses: coverallsapp/github-action@f350da2c033043742f89e8c0b7b5145a1616da6d |
| with: |
| github-token: ${{ secrets.GITHUB_TOKEN }} |
| parallel-finished: true |