Skip to content

Commit 8f162b7

Browse files
committed
Moves Clippy lints checking to a separate job.
This fixes #468. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
1 parent 2dfc315 commit 8f162b7

File tree

7 files changed

+58
-22
lines changed

7 files changed

+58
-22
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- name: Build the container
6464
run: docker build -t fedoracontainer tss-esapi/tests/ --file tss-esapi/tests/Dockerfile-fedora
6565
- name: Run the tests
66-
run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi/tss-esapi fedoracontainer dbus-run-session -- /tmp/rust-tss-esapi/tss-esapi/tests/all-fedora.sh
66+
run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi/tss-esapi --env USE_FROZEN_LOCKFILE=1 fedoracontainer dbus-run-session -- /tmp/rust-tss-esapi/tss-esapi/tests/all-fedora.sh
6767

6868
tests-fedora-rawhide:
6969
name: Fedora rawhide tests
@@ -96,3 +96,16 @@ jobs:
9696
run: docker build -t ubuntucontainer tss-esapi/tests/ --file tss-esapi/tests/Dockerfile-ubuntu
9797
- name: Check documentation
9898
run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi/tss-esapi -e RUSTDOCFLAGS="-Dwarnings" ubuntucontainer cargo doc --document-private-items --no-deps
99+
100+
# Check that there are no Clippy lint errors.
101+
clippy:
102+
name: Check Clippy lints
103+
runs-on: ubuntu-latest
104+
steps:
105+
- uses: actions/checkout@v2
106+
- name: Build the container
107+
run: docker build -t ubuntucontainer tss-esapi/tests/ --file tss-esapi/tests/Dockerfile-ubuntu --target tpm2-tss
108+
- name: Check Clippy lints MSRV
109+
run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi/tss-esapi --env RUST_TOOLCHAIN_VERSION=1.66.0 ubuntucontainer /tmp/rust-tss-esapi/tss-esapi/tests/lint-checks.sh
110+
- name: Check Clippy lints latest
111+
run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi/tss-esapi ubuntucontainer /tmp/rust-tss-esapi/tss-esapi/tests/lint-checks.sh

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ At the moment we test (via CI) and support the following Rust compiler versions:
1010
* On Ubuntu we test with:
1111
- The latest stable compiler version, as accessible through `rustup`.
1212
- The 1.66 compiler version.
13-
* On Fedora we test with the compiler version included with the Fedora 35 release.
13+
* On Fedora we test with the compiler version included with the Fedora 36 release.
14+
* On Fedora rawhide we test with the compiler version included.
1415

1516
If you need support for other versions of the compiler, get in touch with us to see what we can do!
1617

tss-esapi/tests/Dockerfile-fedora

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM fedora:35
1+
FROM fedora:36
22

33
RUN dnf install -y \
44
tpm2-tss-devel tpm2-abrmd tpm2-tools \

tss-esapi/tests/Dockerfile-ubuntu

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
FROM ghcr.io/tpm2-software/ubuntu-18.04:latest
1+
FROM ghcr.io/tpm2-software/ubuntu-18.04:latest AS base
22

3+
FROM base AS rust-toolchain
4+
# Install Rust toolchain
5+
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
6+
ENV PATH="/root/.cargo/bin:${PATH}"
7+
8+
FROM rust-toolchain AS tpm2-tss
9+
# Download and install the TSS library
310
ARG TPM2_TSS_VERSION=2.4.6
411
ENV TPM2_TSS_VERSION=$TPM2_TSS_VERSION
512
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig
6-
7-
# Download and install the TSS library
813
RUN git clone https://github.com/tpm2-software/tpm2-tss.git --branch $TPM2_TSS_VERSION
914
RUN cd tpm2-tss \
1015
&& ./bootstrap \
@@ -13,13 +18,10 @@ RUN cd tpm2-tss \
1318
&& make install \
1419
&& ldconfig
1520

21+
FROM tpm2-tss AS tpm2-tools
1622
# Download and install TPM2 tools
1723
RUN git clone https://github.com/tpm2-software/tpm2-tools.git --branch 4.1
1824
RUN cd tpm2-tools \
1925
&& ./bootstrap \
2026
&& ./configure --enable-unit \
2127
&& make install
22-
23-
# Install Rust toolchain
24-
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
25-
ENV PATH="/root/.cargo/bin:${PATH}"

tss-esapi/tests/all-fedora.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@
33
# Copyright 2019 Contributors to the Parsec project.
44
# SPDX-License-Identifier: Apache-2.0
55

6-
# This script executes static checks and tests for the tss-esapi crate.
6+
# This script executes tests for the tss-esapi crate.
77
# It can be run inside the container which Dockerfile is in the same folder.
88
#
99
# Usage: ./tests/all.sh
1010

1111
set -euf -o pipefail
1212

13+
if [[ ! -z ${USE_FROZEN_LOCKFILE:+x} ]]; then
14+
# Some versions of Fedora that are used during testing are old
15+
# so in order to prevent any drift from the versions available
16+
# in the old versions the frozen Cargo lock is used.
17+
cp tests/Cargo.lock.frozen ../Cargo.lock
18+
fi
19+
1320
############################
1421
# Run the TPM SWTPM server #
1522
############################
@@ -33,11 +40,6 @@ tpm2-abrmd \
3340
--session \
3441
--flush-all &
3542

36-
##################
37-
# Execute clippy #
38-
##################
39-
cargo clippy --all-targets --all-features -- -D clippy::all -D clippy::cargo
40-
4143
###################
4244
# Build the crate #
4345
###################

tss-esapi/tests/all-ubuntu.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright 2019 Contributors to the Parsec project.
44
# SPDX-License-Identifier: Apache-2.0
55

6-
# This script executes static checks and tests for the tss-esapi crate.
6+
# This script executes tests for the tss-esapi crate.
77
# It can be run inside the container which Dockerfile is in the same folder.
88
#
99
# Usage: ./tests/all.sh
@@ -36,11 +36,6 @@ tpm_server &
3636
sleep 5
3737
tpm2_startup -c -T mssim
3838

39-
##################
40-
# Execute clippy #
41-
##################
42-
cargo clippy --all-targets --all-features -- -D clippy::all -D clippy::cargo
43-
4439
###################
4540
# Build the crate #
4641
###################

tss-esapi/tests/lint-checks.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2023 Contributors to the Parsec project.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
# This script executes static checks for the tss-esapi crate.
7+
8+
set -euf -o pipefail
9+
10+
#################################################
11+
# Change rust toolchain version
12+
#################################################
13+
if [[ ! -z ${RUST_TOOLCHAIN_VERSION:+x} ]]; then
14+
rustup override set ${RUST_TOOLCHAIN_VERSION}
15+
# Use the frozen Cargo lock to prevent any drift from MSRV being upgraded
16+
# underneath our feet.
17+
cp tests/Cargo.lock.frozen ../Cargo.lock
18+
fi
19+
20+
##################
21+
# Execute clippy #
22+
##################
23+
cargo clippy --all-targets --all-features -- -D clippy::all -D clippy::cargo

0 commit comments

Comments
 (0)