blob: d75b3737e2e616f2d78376b5ad847dedffe0ea6d [file] [edit]
# 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'
- 'codecov.yml'
- 'pkgs/code_assets/**'
- 'pkgs/data_assets/**'
- 'pkgs/ffi/**'
- 'pkgs/ffigen/**'
- 'pkgs/hooks/**'
- 'pkgs/hooks_runner/**'
- 'pkgs/jni_util/**'
- 'pkgs/json_syntax_generator/**'
- 'pkgs/native_test_helpers/**'
- 'pkgs/native_toolchain_c/**'
- 'pkgs/prebuilt_code_assets/**'
- 'pkgs/pub_formats/**'
- 'pkgs/record_use/**'
- 'pkgs/snippet_tool/**'
- 'pkgs/swift2objc/**'
- 'pkgs/test_case_selector/**'
- 'pubspec.yaml'
- 'tool/**'
push:
branches: [main]
paths:
- '.github/workflows/native.yaml'
- 'codecov.yml'
- 'pkgs/code_assets/**'
- 'pkgs/data_assets/**'
- 'pkgs/ffi/**'
- 'pkgs/ffigen/**'
- 'pkgs/hooks/**'
- 'pkgs/hooks_runner/**'
- 'pkgs/jni_util/**'
- 'pkgs/json_syntax_generator/**'
- 'pkgs/native_test_helpers/**'
- 'pkgs/native_toolchain_c/**'
- 'pkgs/prebuilt_code_assets/**'
- 'pkgs/pub_formats/**'
- 'pkgs/record_use/**'
- 'pkgs/snippet_tool/**'
- 'pkgs/swift2objc/**'
- 'pkgs/test_case_selector/**'
- 'pubspec.yaml'
- '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: Upload coverage
uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac # v5
with:
files: ./coverage/lcov.info
flags: native_pkgs_${{ matrix.os }}
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false