Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
name: rust-ci

env:
RUST_MSRV: "1.63"
RUST_MSRV: &RUST_MSRV "1.63"

jobs:
codespell:
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_MSRV }}
toolchain: *RUST_MSRV
- uses: taiki-e/install-action@cargo-hack
- name: cargo check
run: >-
Expand Down Expand Up @@ -145,6 +145,23 @@ jobs:
run: cargo install --force cbindgen
- run: make validate-cbindgen

build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust-version:
- *RUST_MSRV
- stable
- nightly
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
- run: make debug
- run: make release

rustdoc:
name: cargo doc
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ rust-version = "1.63"
maintenance = { status = "experimental" }

[lib]
# When building the CAPI, our Makefile adds --crate-type={cdylib,staticlib}.
crate-type = ["rlib"]
# MSRV(1.64): Replace with --crate-type={cdy,static}lib in Makefile.
crate-type = ["rlib", "cdylib", "staticlib"]

[features]
default = []
Expand Down
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ CARGO_CHECK := $(call cargo_hack,$(CARGO),check)
CARGO_CLIPPY := $(call cargo_hack,$(CARGO),clippy)
CARGO_LLVM_COV := $(call cargo_hack,$(CARGO_NIGHTLY),llvm-cov)

RUSTC_FLAGS := --features=capi -- -C panic=abort
CARGO_FLAGS ?=
RUSTC_FLAGS := -C panic=abort
CARGO_FLAGS ?= --features=capi

SRC_FILES = $(wildcard Cargo.*) $(shell find . -name '*.rs')

Expand All @@ -58,11 +58,13 @@ SRC_FILES = $(wildcard Cargo.*) $(shell find . -name '*.rs')
debug: target/debug

target/debug: $(SRC_FILES)
# MSRV(1.64): Use cargo rustc --crate-type={cdy,static}lib.
RUSTFLAGS="$(RUSTC_FLAGS)" $(CARGO) build $(CARGO_FLAGS)
# For some reason, --crate-types needs separate invocations. We can't use
# #![crate_type] unfortunately, as using it with #![cfg_attr] has been
# deprecated. <https://github.com/rust-lang/rust/issues/91632>
$(CARGO) rustc $(CARGO_FLAGS) --crate-type=cdylib $(RUSTC_FLAGS)
$(CARGO) rustc $(CARGO_FLAGS) --crate-type=staticlib $(RUSTC_FLAGS)
#$(CARGO) rustc $(CARGO_FLAGS) --crate-type=cdylib $(RUSTC_FLAGS)
#$(CARGO) rustc $(CARGO_FLAGS) --crate-type=staticlib $(RUSTC_FLAGS)

.PHONY: release
release: target/release
Expand Down
Loading