name: Push or PR
on: [push, pull_request, workflow_dispatch]
env:
CARGO_TERM_COLOR: always
jobs:
build_n_test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- name: rustfmt
if: ${{ !cancelled() }}
run: cargo fmt --all -- --check
- name: check
if: ${{ !cancelled() }}
run: cargo check --verbose
- name: clippy
if: ${{ !cancelled() }}
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Build
if: ${{ !cancelled() }}
run: |
cargo build --verbose --examples --tests --all-features --features="async tokio/rt-multi-thread"
cargo clean
cargo build --verbose --examples --tests --no-default-features
- name: Test
if: ${{ !cancelled() }}
shell: bash
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cargo clean
cargo test --verbose --examples --tests --all-features
cargo clean
cargo test --verbose --examples --tests --no-default-features
else
sudo -E $(which cargo) clean
sudo -E $(which cargo) test --verbose --examples --tests --all-features
sudo -E $(which cargo) clean
sudo -E $(which cargo) test --verbose --examples --tests --no-default-features
fi
build_n_test_android:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- name: Install cargo ndk and rust compiler for android target
if: ${{ !cancelled() }}
run: |
cargo install --locked cargo-ndk
rustup target add x86_64-linux-android
- name: clippy
if: ${{ !cancelled() }}
run: cargo ndk -t x86_64 clippy --all-features --features="async tokio/rt-multi-thread" -- -D warnings
- name: Build
if: ${{ !cancelled() }}
run: |
cargo ndk -t x86_64 rustc --verbose --all-features --features="async tokio/rt-multi-thread" --lib --crate-type=cdylib
build_n_test_ios:
strategy:
fail-fast: false
runs-on: macos-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- name: Install cargo lipo and rust compiler for ios target
if: ${{ !cancelled() }}
run: |
cargo install --locked cargo-lipo
rustup target add x86_64-apple-ios aarch64-apple-ios
- name: clippy
if: ${{ !cancelled() }}
run: cargo clippy --target x86_64-apple-ios --all-features --features="async tokio/rt-multi-thread" -- -D warnings
- name: Build
if: ${{ !cancelled() }}
run: |
cargo lipo --verbose --all-features --features="async tokio/rt-multi-thread"
build_n_test_tvos:
strategy:
matrix:
target: [aarch64-apple-tvos, aarch64-apple-tvos-sim, x86_64-apple-tvos]
fail-fast: false
runs-on: macos-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy, rust-src
- name: clippy
if: ${{ !cancelled() }}
run: cargo +nightly clippy -Zbuild-std --target ${{matrix.target}} --all-features --features="async tokio/rt-multi-thread" -- -D warnings
- name: Build
if: ${{ !cancelled() }}
run: |
cargo +nightly build -Zbuild-std --verbose --target ${{matrix.target}} --all-features --features="async tokio/rt-multi-thread"
build_n_test_openharmony:
strategy:
matrix:
target:
[
aarch64-unknown-linux-ohos,
armv7-unknown-linux-ohos,
x86_64-unknown-linux-ohos,
]
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: openharmony-rs/setup-ohos-sdk@v1.0.0
id: setup-ohos
with:
version: "6.0"
- name: Install ohrs and rust compiler for ohos target
if: ${{ !cancelled() }}
run: |
cargo install --locked ohrs
rustup target add ${{ matrix.target }}
- name: fmt & clippy
if: ${{ !cancelled() }}
run: |
cargo fmt --all -- --check
ohrs cargo --disable-target -- clippy --target ${{matrix.target}} --all-features --features="async tokio/rt-multi-thread" -- -D warnings
- name: Build
if: ${{ !cancelled() }}
run: |
ohrs cargo --disable-target -- rustc --target ${{matrix.target}} --verbose --all-features --features="async tokio/rt-multi-thread" --lib --crate-type=cdylib
semver:
name: Check semver
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- name: Check semver
if: ${{ !cancelled() }}
uses: obi1kenobi/cargo-semver-checks-action@v2