| # CI for the native_* packages. | |
| # | |
| # Combined into a single workflow so that deps are configured and installed once. | |
| name: native | |
| permissions: | |
| contents: read | |
| on: | |
| pull_request: | |
| # No `branches:` to enable stacked PRs on GitHub. | |
| paths: | |
| - '.github/workflows/native.yaml' | |
| - 'pkgs/code_assets/**' | |
| - 'pkgs/data_assets/**' | |
| - 'pkgs/ffi/**' | |
| - 'pkgs/ffigen/**' | |
| - 'pkgs/hooks/**' | |
| - 'pkgs/hooks_runner/**' | |
| - 'pkgs/json_syntax_generator/**' | |
| - 'pkgs/native_test_helpers/**' | |
| - 'pkgs/native_toolchain_c/**' | |
| - 'pkgs/record_use/**' | |
| - 'tool/**' | |
| push: | |
| branches: [main] | |
| paths: | |
| - '.github/workflows/native.yaml' | |
| - 'pkgs/code_assets/**' | |
| - 'pkgs/data_assets/**' | |
| - 'pkgs/ffi/**' | |
| - 'pkgs/ffigen/**' | |
| - 'pkgs/hooks/**' | |
| - 'pkgs/hooks_runner/**' | |
| - 'pkgs/json_syntax_generator/**' | |
| - 'pkgs/native_test_helpers/**' | |
| - 'pkgs/native_toolchain_c/**' | |
| - 'pkgs/record_use/**' | |
| - 'tool/**' | |
| schedule: | |
| - cron: '0 0 * * 0' # weekly | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu, macos, windows] | |
| sdk: [dev, stable] | |
| runs-on: ${{ matrix.os }}-latest | |
| defaults: | |
| run: | |
| working-directory: . | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 | |
| with: | |
| persist-credentials: false | |
| - uses: dart-lang/setup-dart@6afc89df92d6eb3834022f73cd65adc8cdfcb92d | |
| with: | |
| sdk: ${{ matrix.sdk }} | |
| - uses: nttld/setup-ndk@ed92fe6cadad69be94a966a7ee3271275e62f779 | |
| with: | |
| ndk-version: r27 | |
| if: ${{ matrix.os != 'macos' }} | |
| - 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' }} | |
| - name: Install native toolchains | |
| run: brew install lld | |
| if: ${{ matrix.os == 'macos' }} | |
| - name: Install Linux cross gcc (macOS) | |
| run: | | |
| brew install \ | |
| messense/macos-cross-toolchains/x86_64-unknown-linux-gnu \ | |
| messense/macos-cross-toolchains/aarch64-unknown-linux-gnu \ | |
| messense/macos-cross-toolchains/arm-unknown-linux-gnueabihf \ | |
| messense/macos-cross-toolchains/i686-unknown-linux-gnu | |
| if: ${{ matrix.os == 'macos' }} | |
| - name: Install Linux cross gcc in WSL (Windows) | |
| uses: Vampire/setup-wsl@d1da7f2c0322a5ee4f24975344f67fc0f5baf364 | |
| with: | |
| distribution: Ubuntu-24.04 | |
| wsl-version: '1' | |
| additional-packages: >- | |
| gcc-x86-64-linux-gnu binutils-x86-64-linux-gnu libc6-dev-amd64-cross | |
| gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu libc6-dev-arm64-cross | |
| gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf libc6-dev-armhf-cross | |
| gcc-i686-linux-gnu binutils-i686-linux-gnu libc6-dev-i386-cross | |
| gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu libc6-dev-riscv64-cross | |
| if: ${{ matrix.os == 'windows' }} | |
| - run: dart pub get | |
| - name: Run pub get, analysis, formatting, generators, tests, and examples. | |
| run: dart tool/ci.dart --all --no-apitool ${{ matrix.sdk == 'stable' && '--no-format' || '' }} | |
| - name: Trust Coveralls tap | |
| run: brew trust coverallsapp/coveralls | |
| if: ${{ matrix.os == 'macos' }} | |
| - name: Upload coverage | |
| uses: coverallsapp/github-action@7eaec0f9ffb3343970b8447736fc85442e961b67 | |
| with: | |
| flag-name: native_pkgs_${{ 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@7eaec0f9ffb3343970b8447736fc85442e961b67 | |
| with: | |
| carryforward: 'ffigen,jni,jnigen,native_pkgs_macos,native_pkgs_ubuntu,native_pkgs_windows,objective_c,swift2objc,swiftgen' | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| parallel-finished: true |