From 55929146d681294e2a889a82dbb8d751ea7f267f Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 25 Sep 2024 21:32:01 +0200 Subject: [PATCH 1/3] fix: add macos build args to build.rs, simplify ci since we dont need to pass custom build command anymore to make lua work on macos, we can dramatically slim down our lua and test CIs --- .github/workflows/lua.yml | 5 +---- .github/workflows/test.yml | 40 ++------------------------------------ build.rs | 8 ++++++++ 3 files changed, 11 insertions(+), 42 deletions(-) diff --git a/.github/workflows/lua.yml b/.github/workflows/lua.yml index cd6d93a..85f19ff 100644 --- a/.github/workflows/lua.yml +++ b/.github/workflows/lua.yml @@ -20,19 +20,16 @@ jobs: target: linux-gnu pre: lib ext: so - buildcmd: cargo build --release --features=luajit - runner: windows-latest arch: x86_64 target: windows-msvc pre: ext: dll - buildcmd: cargo build --release --features=luajit - runner: macos-latest arch: aarch64 target: darwin pre: lib ext: dylib - buildcmd: cargo rustc --release --features=luajit -- -C link-arg=-undefined -C link-arg=dynamic_lookup steps: - uses: actions/checkout@v4 with: @@ -41,7 +38,7 @@ jobs: - uses: arduino/setup-protoc@v3 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - - run: ${{ matrix.platform.buildcmd }} + - run: cargo build --release --features=luajit - id: previoustag uses: "WyriHaximus/github-action-get-previous-tag@v1" with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 231c49c..051688f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,38 +27,6 @@ jobs: - java - js - py - toolchain: - - stable - - beta - - nightly - steps: - - uses: arduino/setup-protoc@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ matrix.toolchain }} - - run: cargo build --release --verbose --features=${{ matrix.features }} - - # TODO to build lua bindings on macos, we need to tweak the compile command to expose symbols - # since i can't add conditional steps to above task, i have to separate off lua from the rest... - build-lua: - runs-on: ${{ matrix.platform.runner }} - strategy: - fail-fast: false - matrix: - platform: - - runner: ubuntu-latest - action: build - extra: - - runner: windows-latest - action: build - extra: - - runner: macos-latest - action: rustc - extra: -- -C link-arg=-undefined -C link-arg=dynamic_lookup - features: - luajit - lua54 toolchain: @@ -73,17 +41,13 @@ jobs: - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.toolchain }} - - run: cargo ${{ matrix.platform.action }} --release --verbose --features=${{ matrix.features }} ${{ matrix.platform.extra }} + - run: cargo build --release --verbose --features=${{ matrix.features }} test: - runs-on: ${{ matrix.runner }} + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - runner: - - ubuntu-latest - - windows-latest - - macos-latest toolchain: - stable - beta diff --git a/build.rs b/build.rs index 3dee00e..2710634 100644 --- a/build.rs +++ b/build.rs @@ -15,4 +15,12 @@ fn main() { { pyo3_build_config::add_extension_module_link_args(); } + + #[cfg(feature = "lua")] + { + if let Ok("macos") = std::env::var("CARGO_CFG_TARGET_OS").as_deref() { + println!("cargo:rustc-cdylib-link-arg=-undefined"); + println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); + } + } } From a04ecdcd191f152957e35489d0b16c539339d929 Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 25 Sep 2024 21:33:53 +0200 Subject: [PATCH 2/3] ci: run on any push --- .github/workflows/test.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 051688f..730001b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,11 +1,9 @@ name: test on: - push: - branches: - - dev + push pull_request: - types: [review_requested, synchronize] + types: [synchronize, review_requested] env: CARGO_TERM_COLOR: always From bd1d4829ff025ad65336a14f1905445f03d994e3 Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 25 Sep 2024 21:34:34 +0200 Subject: [PATCH 3/3] ci: i dont know yaml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 730001b..fbd9dd1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: test on: - push + push: pull_request: types: [synchronize, review_requested]