171 lines
5.9 KiB
YAML
171 lines
5.9 KiB
YAML
|
|
---
|
|
# Lint, build, and test.
|
|
# Clippy lint will make the subsequent build faster, and the result of the build
|
|
# is necessary for the test.
|
|
|
|
when:
|
|
- event: [manual, push, tag]
|
|
|
|
variables:
|
|
# Docker image of the latest stable Rust.
|
|
rust_image: &rust_image 'library/rust:slim'
|
|
rust_nightly_image: &rust_nightly_image 'rustlang/rust:nightly-slim'
|
|
configure_toolchain_cmds: &configure_toolchain_cmds
|
|
- cp .woodpecker/cargo-config.toml $${CARGO_HOME}/config.toml
|
|
# Use the Rust toolchain(s) cached in the CI workspace directory.
|
|
- export RUSTUP_HOME=$${CI_WORKSPACE}/.tmp-rustup-home && test -d $${RUSTUP_HOME}
|
|
- rustc --version && cargo --version
|
|
|
|
matrix:
|
|
RUST_CHANNEL:
|
|
- stable
|
|
BUILD_PROFILE:
|
|
- dev # equivalent to no --release flag (debug build)
|
|
- release # equivalent to --release flag
|
|
OPT_FEATURES:
|
|
- --features= # no features
|
|
- --features=default
|
|
- --all-features
|
|
# `minimal`: minimal dependency versions
|
|
# `direct-minimal`: minimal direct dependency versions
|
|
# `default`: default dependency versions (just ensures `Cargo.lock` exists)
|
|
# `updated`: explicitly updated dependency versions (cargo update)
|
|
RUST_DEP_VERSIONS:
|
|
- direct-minimal
|
|
- default
|
|
include:
|
|
# To see if updated dependencies break something.
|
|
- RUST_CHANNEL: stable
|
|
BUILD_PROFILE: dev
|
|
OPT_FEATURES: --all-features
|
|
RUST_DEP_VERSIONS: updated
|
|
|
|
# To see if updated toolchain reject something.
|
|
- RUST_CHANNEL: beta
|
|
BUILD_PROFILE: dev
|
|
OPT_FEATURES: --all-features
|
|
RUST_DEP_VERSIONS: direct-minimal
|
|
|
|
# To see if updated toolchain and dependencies break something.
|
|
- RUST_CHANNEL: beta
|
|
BUILD_PROFILE: dev
|
|
OPT_FEATURES: --all-features
|
|
RUST_DEP_VERSIONS: updated
|
|
|
|
clone:
|
|
git:
|
|
image: woodpeckerci/plugin-git
|
|
settings:
|
|
# Custom root CA certificate will be used in some local networks.
|
|
# The global environment variable WP_GIT_SKIP_VERIFY will be
|
|
# set to `true` in such environment.
|
|
skip-verify: ${WP_GIT_SKIP_VERIFY:-false}
|
|
lfs: false
|
|
|
|
steps:
|
|
- name: install Rust toolchain
|
|
image: *rust_image
|
|
commands:
|
|
- .woodpecker/scripts/prepare-toolchain.sh $${RUST_CHANNEL}
|
|
|
|
- name: prepare deps
|
|
image: *rust_image
|
|
commands:
|
|
# Ensure `Cargo.lock` exists.
|
|
- if [ ! -f Cargo.lock ] ; then echo "Cargo.lock is missing" >&2 ; exit 1 ; fi
|
|
when:
|
|
- matrix:
|
|
RUST_DEP_VERSIONS: default
|
|
|
|
- name: prepare deps
|
|
image: *rust_image
|
|
commands:
|
|
- <<: *configure_toolchain_cmds
|
|
- cargo update
|
|
when:
|
|
- matrix:
|
|
RUST_DEP_VERSIONS: updated
|
|
|
|
- name: prepare deps
|
|
image: *rust_nightly_image
|
|
commands:
|
|
- rustc --version && cargo --version
|
|
- cargo update -Zminimal-versions
|
|
when:
|
|
- matrix:
|
|
RUST_DEP_VERSIONS: minimal
|
|
|
|
- name: prepare deps
|
|
image: *rust_nightly_image
|
|
commands:
|
|
- rustc --version && cargo --version
|
|
- cargo update -Zdirect-minimal-versions
|
|
when:
|
|
- matrix:
|
|
RUST_DEP_VERSIONS: direct-minimal
|
|
|
|
- name: fetch deps
|
|
image: *rust_image
|
|
commands:
|
|
- <<: *configure_toolchain_cmds
|
|
- cargo fetch --locked
|
|
- mkdir -p .cargo
|
|
- cargo vendor --color=always --locked >> .cargo/config.toml
|
|
|
|
- name: clippy (allow warning)
|
|
image: *rust_image
|
|
commands:
|
|
- <<: *configure_toolchain_cmds
|
|
- rustup component add clippy
|
|
- cargo clippy --version
|
|
# TODO: Deny warnings for all the workspace members once the MSRV and deps are bumped.
|
|
#- cargo clippy --color=always --frozen --workspace --all-targets --no-deps --profile=${BUILD_PROFILE} --no-default-features ${OPT_FEATURES} -- --deny warnings
|
|
- cargo clippy --color=always --frozen --all-targets --no-deps --profile=${BUILD_PROFILE} --no-default-features ${OPT_FEATURES}
|
|
when:
|
|
- matrix:
|
|
RUST_DEP_VERSIONS: minimal
|
|
- matrix:
|
|
RUST_DEP_VERSIONS: direct-minimal
|
|
- matrix:
|
|
RUST_DEP_VERSIONS: default
|
|
|
|
- name: clippy
|
|
image: *rust_image
|
|
commands:
|
|
- <<: *configure_toolchain_cmds
|
|
- rustup component add clippy
|
|
- cargo clippy --version
|
|
# TODO: Deny warnings for all the workspace members once the MSRV and deps are bumped.
|
|
#- cargo clippy --color=always --frozen --workspace --all-targets --no-deps --profile=${BUILD_PROFILE} --no-default-features ${OPT_FEATURES} -- --deny warnings
|
|
- cargo clippy --color=always --frozen --all-targets --no-deps --profile=${BUILD_PROFILE} --no-default-features ${OPT_FEATURES} -- --deny warnings
|
|
when:
|
|
- matrix:
|
|
RUST_DEP_VERSIONS: updated
|
|
|
|
- name: build
|
|
image: *rust_image
|
|
commands:
|
|
- <<: *configure_toolchain_cmds
|
|
# TODO: Build all the workspace members once the MSRV and deps are bumped.
|
|
#- cargo build --color=always --frozen --workspace --all-targets --profile=${BUILD_PROFILE} --no-default-features ${OPT_FEATURES}
|
|
- cargo build --color=always --frozen --all-targets --profile=${BUILD_PROFILE} --no-default-features ${OPT_FEATURES}
|
|
|
|
- name: run tests
|
|
image: *rust_image
|
|
commands:
|
|
- <<: *configure_toolchain_cmds
|
|
- export RUST_BACKTRACE=1
|
|
# TODO: Test all the workspace members once the MSRV and deps are bumped.
|
|
#- cargo test --color=always --frozen --workspace --all-targets --profile=${BUILD_PROFILE} --no-default-features ${OPT_FEATURES}
|
|
- cargo test --color=always --frozen --all-targets --profile=${BUILD_PROFILE} --no-default-features ${OPT_FEATURES}
|
|
|
|
- name: run doctests
|
|
image: *rust_image
|
|
commands:
|
|
- <<: *configure_toolchain_cmds
|
|
- export RUST_BACKTRACE=1
|
|
# TODO: Test all the workspace members once the MSRV and deps are bumped.
|
|
#- cargo test --color=always --frozen --workspace --doc --profile=${BUILD_PROFILE} --no-default-features ${OPT_FEATURES}
|
|
- cargo test --color=always --frozen --doc --profile=${BUILD_PROFILE} --no-default-features ${OPT_FEATURES}
|