image: rust:latest clone: depth: full definitions: caches: cargo: /usr/local/cargo cargo-target: $BITBUCKET_CLONE_DIR/target steps: - step: &static-code-analysis name: Static Code Analysis caches: - cargo script: - rustup component add rustfmt - cargo fmt --all -- --check - rustup component add clippy - cargo clippy --all-targets --all-features -- -D warnings - step: &build name: Build caches: - cargo - cargo-target script: - cargo build -v - step: &test name: Test caches: - cargo - cargo-target script: - cargo test -v --no-fail-fast - command cargo tarpaulin -V &> /dev/null || cargo install cargo-tarpaulin - cargo tarpaulin --ciserver bitbucket --coveralls $CODECOV_TOKEN - curl -Os https://uploader.codecov.io/latest/linux/codecov && chmod +x codecov && ./codecov - step: &audit name: Audit caches: - cargo script: - cargo install cargo-audit - cargo audit - step: &deployment name: Deploy to Crates deployment: Crates caches: - cargo - cargo-target trigger: manual script: - cargo login $CARGO_TOKEN - cargo publish pipelines: default: - step: *static-code-analysis - step: *test branches: master: - step: *static-code-analysis - step: *audit - step: *build - step: *test - step: *deployment pull-requests: '**': - step: *static-code-analysis - step: *audit - step: *build - step: *test