From bdd7d6ac0f588b84be6693e8f0ab1c885ab3228b Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Tue, 29 Sep 2026 22:25:10 -0700 Subject: [PATCH] Multi platform tests (#584) --- .github/actions/setup/action.yaml | 11 +++++++ .github/workflows/document.yaml | 2 +- .github/workflows/lint.yaml | 12 ++++++- .github/workflows/test.yaml | 53 +++++++++++++++++++++++-------- bdwgc-alloc-sys/build.rs | 11 +++---- cspell.json | 1 + 6 files changed, 67 insertions(+), 23 deletions(-) create mode 100644 .github/actions/setup/action.yaml diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml new file mode 100644 index 0000000..2d84370 --- /dev/null +++ b/.github/actions/setup/action.yaml @@ -0,0 +1,11 @@ +name: setup +description: Sets up a build environment +inputs: {} +outputs: {} +runs: + using: composite + steps: + - uses: swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + - uses: homebrew/actions/setup-homebrew@e99025eb970cfa124b8284a35463d87426917478 # main + - run: brew install autoconf automake libtool + shell: sh diff --git a/.github/workflows/document.yaml b/.github/workflows/document.yaml index 8c8f864..21510f9 100644 --- a/.github/workflows/document.yaml +++ b/.github/workflows/document.yaml @@ -9,7 +9,7 @@ permissions: pages: write id-token: write jobs: - build: + document: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 009a15c..4cb4b21 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -5,7 +5,7 @@ on: - main pull_request: jobs: - lint: + clippy: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -30,3 +30,13 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: lycheeverse/lychee-action@e7477775783ea5526144ba13e8db5eec57747ce8 # v2.9.0 + lint: + needs: + - clippy + - format + - spell-check + - readme + if: always() + runs-on: ubuntu-latest + steps: + - run: for result in ${{ join(needs.*.result, ' ') }}; do [ $result = success ]; done diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 24ca501..8f07e6c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -6,34 +6,59 @@ on: pull_request: jobs: build: - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-26.04-arm + - macos-latest + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: submodules: true - - uses: swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + - uses: ./.github/actions/setup - run: cargo build - test: - runs-on: ubuntu-latest + unit_test: + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-26.04-arm + - macos-latest + options: + - + - --no-default-features --features cmake + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: submodules: true - - uses: swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 - - run: cargo test + - uses: ./.github/actions/setup + - run: cargo test ${{ matrix.options }} examples: - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-26.04-arm + - macos-latest + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: submodules: true - - uses: swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + - uses: ./.github/actions/setup - run: tools/example_test.sh - cmake: + test: + needs: + - build + - unit_test + - examples + if: always() runs-on: ubuntu-latest steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - submodules: true - - uses: swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 - - run: cargo build --no-default-features --features cmake + - run: for result in ${{ join(needs.*.result, ' ') }}; do [ $result = success ]; done diff --git a/bdwgc-alloc-sys/build.rs b/bdwgc-alloc-sys/build.rs index a2e82bf..365d512 100644 --- a/bdwgc-alloc-sys/build.rs +++ b/bdwgc-alloc-sys/build.rs @@ -3,6 +3,8 @@ use core::error::Error; use std::{env, path::PathBuf}; +// cspell: ignore reconf + const LIB_ATOMIC_OPS_DIR: &str = "vendor/libatomic_ops"; const LIB_GC_DIR: &str = "vendor/bdwgc"; @@ -52,14 +54,8 @@ cfg_select! { } feature = "autotools" => { fn build_library() -> Result<(), Box> { - for dir in &[LIB_ATOMIC_OPS_DIR, LIB_GC_DIR] { - std::process::Command::new("sh") - .arg("-c") - .arg(format!("cd {dir} && ./autogen.sh")) - .output()?; - } - let dst = autotools::Config::new(LIB_ATOMIC_OPS_DIR) + .reconf("-i") .cflag("-fPIC") .build(); @@ -70,6 +66,7 @@ cfg_select! { println!("cargo:rustc-link-lib=static=atomic_ops"); let dst = autotools::Config::new(LIB_GC_DIR) + .reconf("-i") .cflag(format!( // spell-checker: disable-next-line "-I{} -L/lib/x86_64-linux-gnu -lpthread -fPIC", diff --git a/cspell.json b/cspell.json index 162eef4..a3f17fe 100644 --- a/cspell.json +++ b/cspell.json @@ -10,6 +10,7 @@ "dealloc", "finalizer", "gcollect", + "gitsubmodule", "libatomic", "libc", "libclang",