Skip to content
Merged
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
65 changes: 52 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ defaults:
env:
CC: clang
CC_LD: lld
CI_CARGO_ARGS: >-
--all-features
--all-targets
--verbose
--workspace
CI_MESON_ARGS: >-
--buildtype debugoptimized
--warnlevel 2
Expand Down Expand Up @@ -68,7 +73,7 @@ jobs:
uses: actions/checkout@v4

- name: "Run Analyzer"
run: cargo check --all-targets --features libc --verbose --workspace
run: cargo check ${CI_CARGO_ARGS}

#
# A complete but basic build of the project, running on common x86-64 ubuntu
Expand All @@ -89,7 +94,7 @@ jobs:
uses: actions/checkout@v4

- name: "Build and Test"
run: cargo test --all-targets --features libc --verbose --workspace
run: cargo test ${CI_CARGO_ARGS}

#
# A simple no-op job that serves as guard. All extended jobs depend on this
Expand Down Expand Up @@ -124,7 +129,7 @@ jobs:
uses: actions/checkout@v4

- name: "Build and Test"
run: cargo test --all-targets --features libc --verbose --workspace
run: cargo test ${CI_CARGO_ARGS}

#
# A matrix of project builds with different settings. All builds run the
Expand All @@ -146,8 +151,8 @@ jobs:

# Explicitly set all options here to document them.
cargoargs: >-
--all-features
--all-targets
--features libc
--profile=release
image: "ghcr.io/readaheadeu/rae-ci-archlinux:latest"
toolchain: stable
Expand All @@ -157,15 +162,32 @@ jobs:
name: "Ubuntu-x86_64-nightly-release"

cargoargs: >-
--all-features
--all-targets
--features libc
--profile=release
image: "ghcr.io/readaheadeu/rae-ci-ubuntu:latest"
toolchain: nightly

# Test a nightly build with polonius, verifying the code that works
# around deficiencies of non-polonius builds.
- id: "polonius"
name: "Ubuntu-x86_64-nightly-polonius"

cargoargs: >-
--all-features
--all-targets
--profile=release
image: "ghcr.io/readaheadeu/rae-ci-ubuntu:latest"
rustflags: >-
--cfg polonius
-Z polonius=next
toolchain: nightly

container:
image: ${{ matrix.image }}
options: "--user root"
env:
RUSTFLAGS: ${{ matrix.rustflags }}
runs-on: "ubuntu-latest"

steps:
Expand Down Expand Up @@ -201,14 +223,7 @@ jobs:
uses: actions/checkout@v4

- name: "Build and Test"
run: |
cargo \
test \
--all-targets \
--features libc \
--target i686-unknown-linux-gnu \
--verbose \
--workspace
run: cargo test ${CI_CARGO_ARGS} --target i686-unknown-linux-gnu

#
# A development build using the meson build system.
Expand All @@ -234,3 +249,27 @@ jobs:

- name: "Run Tests"
run: meson test -C "./build"

#
# A development build using the MSRV. To avoid updating our own container
# images with that version all the time, use the official images for it.
# This means, we cannot rely on any other utilities to be present, so just
# run a straight cargo build.
#
ext_msrv:
name: "Ext: msrv @ rust:<msrv>"
needs: ext_guard

container:
image: "rust:1.91-alpine"
defaults:
run:
shell: "sh"
runs-on: "ubuntu-latest"

steps:
- name: "Fetch Sources"
uses: actions/checkout@v4

- name: "Build and Test"
run: cargo test ${CI_CARGO_ARGS}
8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ homepage = "https://www.bus1.eu"
license = "MIT OR Apache-2.0 OR LGPL-2.1-or-later"
readme = "README.md"
repository = "https://github.com/bus1/sys"
rust-version = "1.84"
rust-version = "1.91"

[workspace.dependencies]
libc = { default-features = false, version = "0.2.175" }
osi = { path = "./lib/osi", version = "1.0.0" }
sys = { path = "./lib/sys", version = "1.0.0" }
tmp = { path = "./lib/tmp", version = "1.0.0" }

[workspace.lints.rust.unexpected_cfgs]
level = "warn"
check-cfg = [
"cfg(polonius)"
]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ system specific interfaces.

The requirements for this project are:

* `rustc >= 1.83`
* `rustc >= 1.91`

### Repository:

Expand Down
3 changes: 3 additions & 0 deletions lib/osi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ rust-version.workspace = true

[features]
std = []

[lints]
workspace = true
4 changes: 4 additions & 0 deletions lib/sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ repository.workspace = true
rust-version.workspace = true

[features]
libc = ["dep:libc"]
std = []

[dependencies]
libc = { optional = true, workspace = true }
osi = { workspace = true }

[lints]
workspace = true
6 changes: 3 additions & 3 deletions lib/tmp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ readme.workspace = true
repository.workspace = true
rust-version.workspace = true

[features]
polonius = []

[dependencies]
osi = { workspace = true }
sys = { workspace = true }

[lints]
workspace = true
2 changes: 1 addition & 1 deletion lib/tmp/src/fmt/json/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ impl<'read> Dec<'read> {
// correctness of Polonius.
let fixed = {
osi::cfg::cond! {
(feature = "polonius") { v },
(polonius) { v },
{
// SAFETY: Workaround for NLL, unneeded with Polonius.
unsafe { core::mem::transmute(v) }
Expand Down
30 changes: 19 additions & 11 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ project(
add_languages('rust', native: false)

rust_edition = '2021'
rust_msv = '1.74'
rust_msv = '1.91'

mod_rust = import('rust')
rust = meson.get_compiler('rust')
Expand Down Expand Up @@ -92,11 +92,21 @@ endif

use_std = get_option('std')

#
# Global configuration
#

rlib_rust_args = [
'--check-cfg=cfg(feature, values("libc", "std"))',
'--check-cfg=cfg(polonius)',
'--check-cfg=cfg(test)',
]

#
# Target: libosi
#

libosi_rlib_rust_args = []
libosi_rlib_rust_args = rlib_rust_args

if use_std
libosi_rlib_rust_args += ['--cfg=feature="std"']
Expand All @@ -120,7 +130,7 @@ meson.override_dependency('libosi-' + libosi_major, libosi_dep, static: true)
#

libsys_rlib_deps = [libosi_dep]
libsys_rlib_rust_args = []
libsys_rlib_rust_args = rlib_rust_args

if use_libc
libsys_rlib_deps += [dep_libc]
Expand Down Expand Up @@ -150,20 +160,18 @@ meson.override_dependency('libsys-' + libsys_major, libsys_dep, static: true)
# Target: libtmp
#

libtmp_rlib_deps = [libosi_dep, libsys_dep]
libtmp_rlib_rust_args = rlib_rust_args

libtmp_rlib = static_library(
'tmp',
['lib/tmp/src/lib.rs'],
dependencies: [
libosi_dep,
libsys_dep,
],
dependencies: libtmp_rlib_deps,
rust_args: libtmp_rlib_rust_args,
)

libtmp_dep = declare_dependency(
dependencies: [
libosi_dep,
libsys_dep,
],
dependencies: libtmp_rlib_deps,
link_with: libtmp_rlib,
version: libtmp_version,
)
Expand Down