Skip to content

Commit

Permalink
build: declare Minimum Supported Rust Version (MSRV) as 1.42
Browse files Browse the repository at this point in the history
* Test build with MSRV version in CI as well.
  • Loading branch information
intgr committed Dec 10, 2023
1 parent 5acc441 commit 85bb0f3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
docker build . --pull \
-f varia/Dockerfile.tests \
--target=cargo-build \
--build-arg=channel=nightly \
--build-arg=rust=nightly \
--tag=posixacl-nightly
- name: Test suite
run: docker run --rm posixacl-nightly cargo test --color=always
Expand All @@ -44,7 +44,7 @@ jobs:
docker build . --pull \
-f varia/Dockerfile.tests \
--target=cargo-build \
--build-arg=channel=stable \
--build-arg=rust=stable \
--tag=posixacl-stable
- name: Test suite
run: docker run --rm posixacl-stable cargo test --color=always
Expand All @@ -54,3 +54,15 @@ jobs:
run: docker run --rm posixacl-stable cargo clippy --color=always
- name: rustfmt
run: docker run --rm posixacl-stable cargo fmt -- --color=always --check

rust-msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build on Rust MSRV
run: |
docker build . --pull \
-f varia/Dockerfile.tests \
--target=cargo-build \
--build-arg=rust=msrv \
--tag=posixacl-msrv
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "posix-acl"
version = "1.1.0"
edition = "2018"
rust-version = "1.42.0"

# Metadata
authors = ["Marti Raudsepp <marti@juffo.org>"]
Expand Down
18 changes: 11 additions & 7 deletions varia/Dockerfile.tests
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# This Dockerfile is mostly for CI, see .github/workflows/tests.yml
# Run with --build-arg=channel=stable OR --build-arg=channel=nightly (default)
ARG channel=nightly
ARG rust=nightly

# Using Dockerfile conditionals
#### Base image for STABLE
FROM rust AS cargo-base-stable
ENV components="rustfmt clippy"
ENV components="rustfmt clippy" buildflags="--tests"

#### Base image for NIGHTLY
FROM rustlang/rust:nightly AS cargo-base-nightly
# clippy and rustfmt are frequently broken in nightly
ENV components=""
ENV components="" buildflags="--tests"

#### Base image for MSRV
FROM rust:1.42.0 AS cargo-base-msrv
# Don't build tests: dev-dependencies are incompatible with MSRV.
ENV components="" buildflags=""

#### Common logic for base image
FROM cargo-base-$channel AS cargo-build
FROM cargo-base-$rust AS cargo-build
WORKDIR /root/build
# Make warnings fatal
ENV RUSTFLAGS="-D warnings"
Expand All @@ -26,10 +30,10 @@ RUN if test -n "$components"; then rustup component add $components; fi
COPY Cargo.toml ./
RUN mkdir src/ && \
echo "pub fn main() {println!(\"dummy function\")}" > src/lib.rs && \
cargo build --lib --tests --color=always && \
cargo build --lib $buildflags --color=always && \
rm -rdv target/*/deps/posix_acl-* \
target/*/.fingerprint/posix-acl-*

# Do the actual build
COPY . .
RUN cargo build --lib --tests --color=always
RUN cargo build --lib $buildflags --color=always

0 comments on commit 85bb0f3

Please sign in to comment.