Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo-check: Run with both stable and MSRV Compilers #737

6 changes: 5 additions & 1 deletion .github/actions/ci_script/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ inputs:
ci-flags:
required: true
description: "Flags with which to run the ci.sh tests"
rs-version:
required: true
default: "stable"
description: "Rust version with which to run the tests"

runs:
using: "composite"
Expand All @@ -15,5 +19,5 @@ runs:
image-name: "${{ env.TEST_ALL_DOCKER_IMAGE }}"
image-path: "/tmp"
- name: Run the container to execute the test script
run: docker run -v $(pwd):/tmp/parsec -w /tmp/parsec -t ${{ env.TEST_ALL_DOCKER_IMAGE }} /tmp/parsec/ci.sh ${{ inputs.ci-flags }}
run: docker run -v $(pwd):/tmp/parsec -w /tmp/parsec --env RUST_TOOLCHAIN_VERSION=${{ inputs.rs-version }} -t ${{ env.TEST_ALL_DOCKER_IMAGE }} /tmp/parsec/ci.sh ${{ inputs.ci-flags }}
shell: bash
17 changes: 15 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,21 @@ jobs:
with:
ci-flags: "all"

build-all-providers:
name: Cargo check all-providers (current Rust stable & old compiler)
build-all-providers-msrv:
name: MSRV - Cargo check all-providers
runs-on: ubuntu-latest
if: ${{ always() }}
needs: [build-and-export-test-all-docker]
steps:
- uses: actions/checkout@v3
- name: Run the container to execute the test script
uses: ./.github/actions/ci_script
with:
ci-flags: "cargo-check"
rs-version: "1.66.0"
tgonzalezorlandoarm marked this conversation as resolved.
Show resolved Hide resolved

build-all-providers-stable:
name: Cargo check all-providers (current Rust stable)
runs-on: ubuntu-latest
if: ${{ always() }}
needs: [build-and-export-test-all-docker]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
with:
ref: "${{ github.event.inputs.rev }}"
- name: Run the container to execute the coverage script
run: docker run -v $(pwd):/tmp/parsec -w /tmp/parsec --security-opt seccomp=unconfined ghcr.io/parallaxsecond/parsec-service-test-all /tmp/parsec/ci.sh coverage
run: docker run -v $(pwd):/tmp/parsec -w /tmp/parsec --security-opt seccomp=unconfined --env RUST_TOOLCHAIN_VERSION=1.66.0 ghcr.io/parallaxsecond/parsec-service-test-all /tmp/parsec/ci.sh coverage
tgonzalezorlandoarm marked this conversation as resolved.
Show resolved Hide resolved
- name: Collect coverage results
run: bash <(curl -s https://codecov.io/bash)

Expand Down
19 changes: 6 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 12 additions & 13 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,12 @@ setup_mappings() {
fi
}

# Use the newest version of the Rust toolchain
# Change rust toolchain version
if [[ ! -z ${RUST_TOOLCHAIN_VERSION:+x} ]]; then
rustup override set ${RUST_TOOLCHAIN_VERSION}
fi

rustup update
MSRV=1.66.0

# Parse arguments
NO_CARGO_CLEAN=
Expand Down Expand Up @@ -274,13 +277,12 @@ fi
git submodule update --init

if [ "$PROVIDER_NAME" = "coverage" ]; then
rustup toolchain install ${MSRV}
PROVIDERS="trusted-service mbed-crypto tpm pkcs11"
EXCLUDES="fuzz/*,e2e_tests/*,src/providers/cryptoauthlib/*,src/authenticators/jwt_svid_authenticator/*"
UNIT_TEST_FEATURES="unix-peer-credentials-authenticator,direct-authenticator"
# Install tarpaulin
# TODO: Stop using the --version parameter when MSRV is upgraded.
cargo +${MSRV} install cargo-tarpaulin --version 0.26.1 --locked
# TODO: Stop using the --version parameter when MSRV is upgraded (>1.66.0)
cargo install cargo-tarpaulin --version 0.26.1 --locked

mkdir -p reports

Expand All @@ -296,7 +298,7 @@ if [ "$PROVIDER_NAME" = "coverage" ]; then
cp -r $(pwd)/e2e_tests/fake_mappings/* mappings

# Start service
RUST_LOG=info cargo +${MSRV} tarpaulin --out Xml --forward --command build --exclude-files="$EXCLUDES" \
RUST_LOG=info cargo tarpaulin --out Xml --forward --command build --exclude-files="$EXCLUDES" \
--output-dir $(pwd)/reports/$provider --features="$provider-provider,direct-authenticator" \
--run-types bins --timeout 3600 -- -c $CONFIG_PATH &
wait_for_service
Expand All @@ -314,7 +316,7 @@ if [ "$PROVIDER_NAME" = "coverage" ]; then
fi

# Start service
RUST_LOG=info cargo +${MSRV} tarpaulin --out Xml --forward --command build --exclude-files="$EXCLUDES" \
RUST_LOG=info cargo tarpaulin --out Xml --forward --command build --exclude-files="$EXCLUDES" \
--output-dir $(pwd)/reports/$provider --features="$provider-provider,direct-authenticator" \
--run-types bins --timeout 3600 -- -c $CONFIG_PATH &
wait_for_service
Expand All @@ -325,7 +327,7 @@ if [ "$PROVIDER_NAME" = "coverage" ]; then

# Run unit tests
mkdir -p reports/unit
cargo +${MSRV} tarpaulin --tests --out Xml --features=$UNIT_TEST_FEATURES --exclude-files="$EXCLUDES" --output-dir $(pwd)/reports/unit
cargo tarpaulin --tests --out Xml --features=$UNIT_TEST_FEATURES --exclude-files="$EXCLUDES" --output-dir $(pwd)/reports/unit

exit 0
fi
Expand Down Expand Up @@ -360,13 +362,10 @@ if [ "$PROVIDER_NAME" = "cargo-check" ]; then
# - openSUSE Tumbleweed
# - openSUSE Leap 15.4

rustup toolchain install ${MSRV}
# TODO: The "jwt-svid-authenticator" is currently not being used.
RUST_BACKTRACE=1 cargo +${MSRV} check --release --features=all-providers,direct-authenticator,unix-peer-credentials-authenticator
RUST_BACKTRACE=1 cargo check --release --features=all-providers,direct-authenticator,unix-peer-credentials-authenticator

# Latest stable
rustup toolchain install stable
RUST_BACKTRACE=1 cargo +stable check --release $FEATURES
RUST_BACKTRACE=1 cargo check --release $FEATURES

# We test that each feature still exist.
RUST_BACKTRACE=1 cargo check
Expand Down
Loading