build: set target-cpu using cargo config instead env var (#385)
Some checks failed
build / build (push) Has been cancelled
build / build_ui (push) Has been cancelled
build / database_test (push) Has been cancelled
build / object_store_memory_test (push) Has been cancelled
build / object_store_direct_test (push) Has been cancelled
build / openssl_build (push) Has been cancelled
build / mac_cross_build (push) Has been cancelled
build / Docker Image Build (push) Has been cancelled
columnq-cli release / Validate git tag (push) Has been cancelled
roapi release / Validate git tag (push) Has been cancelled
columnq-cli release / macos (push) Has been cancelled
columnq-cli release / windows (map[features:database-sqlite python-architecture:x64 target:x86_64-pc-windows-msvc]) (push) Has been cancelled
columnq-cli release / linux (map[features:rustls,database-sqlite image_tag:aarch64-musl manylinux:2014 name_suffix: target:aarch64-unknown-linux-musl upload:true]) (push) Has been cancelled
columnq-cli release / linux (map[features:rustls,database-sqlite image_tag:x86_64-musl manylinux:2010 name_suffix: target:x86_64-unknown-linux-musl upload:true]) (push) Has been cancelled
columnq-cli release / PyPI Release (push) Has been cancelled
roapi release / macos (push) Has been cancelled
roapi release / windows (map[features:database-sqlite python-architecture:x64 target:x86_64-pc-windows-msvc]) (push) Has been cancelled
roapi release / linux (map[features:rustls,database-sqlite image_tag:aarch64-musl manylinux:2014 name_suffix: target:aarch64-unknown-linux-musl upload:true]) (push) Has been cancelled
roapi release / linux (map[features:rustls,database-sqlite image_tag:x86_64-musl manylinux:2010 name_suffix: target:x86_64-unknown-linux-musl upload:true]) (push) Has been cancelled
roapi release / PyPI Release (push) Has been cancelled
roapi release / Docker Image Release (push) Has been cancelled

This commit is contained in:
QP Hou 2025-03-23 18:23:17 -07:00 committed by GitHub
parent b2d584a74e
commit c3aaf25797
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 4 additions and 31 deletions

2
.cargo/config.toml Normal file
View File

@ -0,0 +1,2 @@
[target.x86_64-unknown-linux-gnu]
rustflags = ["-Ctarget-cpu=skylake"]

View File

@ -13,8 +13,6 @@ env:
jobs:
build:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-C target-cpu=skylake"
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
@ -34,8 +32,6 @@ jobs:
build_ui:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-C target-cpu=skylake"
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
@ -54,8 +50,6 @@ jobs:
database_test:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-C target-cpu=skylake"
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
@ -74,8 +68,6 @@ jobs:
object_store_memory_test:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-C target-cpu=skylake"
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
@ -121,8 +113,6 @@ jobs:
object_store_direct_test:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-C target-cpu=skylake"
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1

View File

@ -134,20 +134,17 @@ jobs:
target: "x86_64-unknown-linux-musl"
image_tag: "x86_64-musl"
features: "rustls,database-sqlite"
rustflags: "-C target-cpu=skylake"
name_suffix: ""
upload: "true"
# - manylinux: "2010"
# target: "x86_64-unknown-linux-musl"
# image_tag: "x86_64-musl"
# features: "native-tls,database-sqlite"
# rustflags: "-C target-cpu=skylake"
# name_suffix: "-openssl"
# upload: "false"
- manylinux: '2014'
target: "aarch64-unknown-linux-musl"
image_tag: "aarch64-musl"
rustflags: ""
features: "rustls,database-sqlite"
name_suffix: ""
upload: "true"
@ -156,19 +153,16 @@ jobs:
# image_tag: "aarch64-musl"
# features: "native-tls,database-sqlite"
# name_suffix: "-openssl"
# rustflags: ""
# upload: "false"
# - manylinux: '2014'
# target: "armv7-unknown-linux-musleabihf"
# image_tag: "armv7-musleabihf"
# rustflags: ""
# features: "rustls,database-sqlite"
# name_suffix: ""
# upload: "true"
# - manylinux: '2014'
# target: "armv7-unknown-linux-musleabihf"
# image_tag: "armv7-musleabihf"
# rustflags: ""
# features: "native-tls,database-sqlite"
# name_suffix: "-openssl"
# upload: "false"
@ -194,7 +188,6 @@ jobs:
- name: Build Wheels
run: |
sudo python3 -m pip install 'maturin<2'
export RUSTFLAGS='${{ matrix.platform.rustflags }}'
maturin build -m columnq-cli/Cargo.toml -b bin --release -o dist \
--target ${{ matrix.platform.target }} --manylinux ${{ matrix.platform.manylinux }} \
--no-default-features --features=${{ matrix.platform.features }}

View File

@ -142,41 +142,35 @@ jobs:
image_tag: "x86_64-musl"
features: "rustls,database-sqlite"
name_suffix: ""
rustflags: "-C target-cpu=skylake"
upload: "true"
# - manylinux: "2010"
# target: "x86_64-unknown-linux-musl"
# image_tag: "x86_64-musl"
# features: "native-tls"
# rustflags: "-C target-cpu=skylake"
# name_suffix: "-openssl"
# upload: "false"
- manylinux: '2014'
target: "aarch64-unknown-linux-musl"
image_tag: "aarch64-musl"
features: "rustls,database-sqlite"
rustflags: ""
name_suffix: ""
upload: "true"
# - manylinux: '2014'
# target: "aarch64-unknown-linux-musl"
# image_tag: "aarch64-musl"
# features: "native-tls"
# rustflags: ""
# name_suffix: "-openssl"
# upload: "false"
# - manylinux: '2014'
# target: "armv7-unknown-linux-musleabihf"
# image_tag: "armv7-musleabihf"
# features: "rustls,database-sqlite"
# rustflags: ""
# name_suffix: ""
# upload: "true"
# - manylinux: '2014'
# target: "armv7-unknown-linux-musleabihf"
# image_tag: "armv7-musleabihf"
# features: "native-tls"
# rustflags: ""
# name_suffix: "-openssl"
# upload: "false"
container:
@ -207,7 +201,6 @@ jobs:
- name: Build Wheels
run: |
sudo python3 -m pip install 'maturin<2'
export RUSTFLAGS='${{ matrix.platform.rustflags }}'
maturin build -m roapi/Cargo.toml -b bin --release -o dist \
--target ${{ matrix.platform.target }} --manylinux ${{ matrix.platform.manylinux }} \
--no-default-features --features=${{ matrix.platform.features }},ui

View File

@ -1,5 +1,4 @@
ARG RUST_VER=1.84.1-bookworm
ARG RUSTFLAGS='-C target-cpu=skylake'
ARG FEATURES="database,ui"
# Step 0: Install cargo-chef
@ -23,23 +22,19 @@ RUN cargo chef prepare --recipe-path recipe.json
# Step 2: Cache project dependencies
FROM chef AS cacher
ARG RUSTFLAGS
ARG FEATURES
WORKDIR /roapi_src
COPY --from=planner /roapi_src/recipe.json recipe.json
RUN RUSTFLAGS=${RUSTFLAGS} \
cargo chef cook --features ${FEATURES} --release --recipe-path recipe.json
RUN cargo chef cook --features ${FEATURES} --release --recipe-path recipe.json
# Step 3: Build the release binary
FROM chef AS builder
ARG RUSTFLAGS
ARG FEATURES
WORKDIR /roapi_src
COPY ./ /roapi_src
COPY --from=cacher /roapi_src/target target
COPY --from=cacher /usr/local/cargo /usr/local/cargo
RUN RUSTFLAGS=${RUSTFLAGS} \
cargo build --release --locked --bin roapi --features ${FEATURES}
RUN cargo build --release --locked --bin roapi --features ${FEATURES}
# Step 4: Assemble the final image
FROM debian:bookworm-slim