diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 04f388c8..00000000 --- a/.drone.yml +++ /dev/null @@ -1,146 +0,0 @@ ---- -kind: pipeline -name: default - -platform: - os: linux - arch: amd64 - -clone: - disable: true - -steps: -- name: git-clone - image: public.ecr.aws/prima/drone-git:1.3-3 - environment: - PLUGIN_DEPTH: 5 - -- name: cargo-deps - image: rust:1.64 - commands: - - cargo fetch - environment: - CARGO_HOME: /drone/src/.cargo - depends_on: - - git-clone - -- name: cargo-format - image: rust:1.64 - commands: - - rustup component add rustfmt && cargo fmt --all -- --check - environment: - CARGO_HOME: /drone/src/.cargo - depends_on: - - cargo-deps - -- name: cargo-doc-ci - image: rust:1.64 - commands: - - cargo doc --document-private-items --workspace --all-features --no-deps - environment: - RUSTDOCFLAGS: -Dwarnings - depends_on: - - cargo-format - -- name: cargo-clippy-ci - image: rust:1.64 - commands: - - rustup component add clippy - - cargo clippy --workspace -- -D warnings - - cargo clippy --workspace --all-features -- -D warnings - - cargo clippy --workspace --release -- -D warnings - - cargo clippy --workspace --release --all-features -- -D warnings - environment: - BUILD_ENV: dev - CARGO_HOME: /drone/src/.cargo - depends_on: - - cargo-doc-ci - -- name: cargo-test - image: rust:1.64 - commands: - - cargo test --all && cargo test --all --features toggle - environment: - BUILD_ENV: dev - CARGO_HOME: /drone/src/.cargo - depends_on: - - cargo-clippy-ci - -trigger: - event: - - push - ---- -kind: pipeline -name: build-production - -platform: - os: linux - arch: amd64 - -clone: - disable: true - -steps: -- name: git-clone - image: public.ecr.aws/prima/drone-git:1.3-3 - environment: - PLUGIN_DEPTH: 5 - -- name: build-production - image: rust:1.64 - commands: - - ./deploy/build production - environment: - CARGO_AUTH_KEY: - from_secret: cargo_auth_key - depends_on: - - git-clone - -trigger: - event: - - tag - ref: - - refs/tags/*.*.* - ---- -kind: pipeline -name: email-failure - -platform: - os: linux - arch: amd64 - -clone: - disable: true - -steps: -- name: email-failure - image: public.ecr.aws/prima/drone-email - settings: - from: drone@prima.it - host: email-smtp.eu-west-1.amazonaws.com - environment: - PLUGIN_PASSWORD: - from_secret: email_password - PLUGIN_USERNAME: - from_secret: email_username - -trigger: - status: - - failure - target: - exclude: - - qa-stack - - qa-it - - qa - -depends_on: -- default -- build-production - ---- -kind: signature -hmac: 66badf18a9b2157be8df165e445ffeb0d793c1a9031ad1aafb32f30da1a0edfd - -... diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6eaade4d..c1217bd9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,3 +7,11 @@ updates: # Check for cargo updates at 3am UTC time: "03:00" open-pull-requests-limit: 10 + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + # Check for cargo updates at 3am UTC + time: "03:00" + open-pull-requests-limit: 3 diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 00000000..bf133e9e --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,24 @@ +name: CD + +on: + release: + types: [published] + +env: + CARGO_TERM_COLOR: always + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: install cargo-release + uses: taiki-e/install-action@v2 + with: + tool: cargo-release@0.24 + - name: login + run: cargo login "$CARGO_AUTH_KEY" + env: + CARGO_AUTH_KEY: ${{ secrets.CARGO_AUTH_KEY }} + - name: publish + run: cargo release publish --no-confirm --allow-branch "*" --workspace --all-features --execute diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..c0f333f2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: CI + +on: [push, pull_request] + +env: + CARGO_TERM_COLOR: always + +jobs: + lint: + # Avoid duplicate jobs on PR from a branch on the same repo + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + + name: "Continuous Integration / lint" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: Swatinem/rust-cache@v2 + - name: Build + run: cargo build --workspace --all-features + - name: cargo fmt + run: cargo fmt --all -- --check + - name: Clippy + run: cargo clippy --workspace --all-features -- -D warnings + - name: Build docs + run: cargo doc --document-private-items --workspace --all-features --no-deps + env: + RUSTDOCFLAGS: -Dwarnings + test: + # Avoid duplicate jobs on PR from a branch on the same repo + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + + name: "Continuous Integration / test" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: Swatinem/rust-cache@v2 + - name: Run tests for no features + run: cargo test --all + - name: Run tests with toggle feature + run: cargo test --all --features toggle diff --git a/deploy/build b/deploy/build deleted file mode 100755 index 3093b505..00000000 --- a/deploy/build +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash - -# script exit when a command fails -set -o errexit -# catch a command error in pipe execution -set -o pipefail -# exit when try to use undeclared variables -# set -o nounset -# print and expand each command to stdout before executing it -set -o xtrace - -if [ $# -eq 0 ]; then - echo "Missing required argument: environment" - exit 1 -fi - -export ENV=$1 -export VERSION="${DRONE_TAG:-$DRONE_COMMIT_SHA}" - -version=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2) - -if [[ "$DRONE_TAG" != "$version" ]]; then - echo "Package version $version does not match release version $DRONE_TAG" - exit 1 -fi - -apt-get update -apt-get install jq -y - -git checkout . - -cargo install cargo-release --version "0.23.*" -cargo login "$CARGO_AUTH_KEY" -cargo release publish --execute --no-confirm --allow-branch "*" --workspace --all-features diff --git a/src/private.rs b/src/private.rs index ceac73b2..e2a49db7 100644 --- a/src/private.rs +++ b/src/private.rs @@ -5,19 +5,19 @@ use std::{ }; pub enum RedactSpecialization { - /// Whether the type we're redacting is an Option or not. Poor man's specialization! This is detected + /// Whether the type we're redacting is an [`Option`] or not. Poor man's specialization! This is detected /// by the proc macro reading the path to the type, so it's not perfect. /// /// This could be improved & rid of in a number of different ways in the future: /// /// * Once specialization is stabilized, we can use a trait to override redacting behavior for some types, - /// one of which would be Option. + /// one of which would be [`Option`]. /// /// * Once std::ptr::metadata and friends are stabilized, we could use it to unsafely cast the dyn Debug pointer - /// to a concrete Option and redact it directly. Probably not the best idea. + /// to a concrete [`Option`] and redact it directly. Probably not the best idea. /// /// * Once trait upcasting is stabilized, we could use it to upcast the dyn Debug pointer to a dyn Any and then - /// downcast it to a concrete Option and redact it directly. + /// downcast it to a concrete [`Option`] and redact it directly. Option, } diff --git a/veil-macros/src/enums.rs b/veil-macros/src/enums.rs index 5a36a0b4..c6443463 100644 --- a/veil-macros/src/enums.rs +++ b/veil-macros/src/enums.rs @@ -152,9 +152,7 @@ pub(super) fn derive_redact( } } syn::Fields::Unnamed(syn::FieldsUnnamed { unnamed, .. }) => { - let args = (0..unnamed.len()) - .into_iter() - .map(|i| syn::Ident::new(&format!("arg{i}"), unnamed.span())); + let args = (0..unnamed.len()).map(|i| syn::Ident::new(&format!("arg{i}"), unnamed.span())); quote! { ( #(#args),* ) } diff --git a/veil-macros/src/fmt.rs b/veil-macros/src/fmt.rs index f9ce3d1a..7924dd88 100644 --- a/veil-macros/src/fmt.rs +++ b/veil-macros/src/fmt.rs @@ -6,7 +6,7 @@ use quote::ToTokens; use syn::spanned::Spanned; #[rustfmt::skip] -/// Returns whether a syn::Type is an Option +/// Returns whether a [`syn::Type`] is an [`Option`] /// /// We try and match as many possible paths as possible because /// some macros can output very verbose paths to items.