diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 37ae693..0000000 --- a/.drone.yml +++ /dev/null @@ -1,269 +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: cache-restore - image: public.ecr.aws/prima/drone-tools:1.21.3 - commands: - - . /etc/profile.d/ecs-credentials-endpoint - - cache-restore - environment: - BUCKET_NAME: prima-ci-cache - volumes: - - name: ecs - path: /etc/profile.d/ecs-credentials-endpoint - - name: docker - path: /var/run/docker.sock - depends_on: - - git-clone - -- name: check-secrets - image: public.ecr.aws/prima/drone-tools:1.21.3 - commands: - - . /etc/profile.d/ecs-credentials-endpoint - - check-secrets-grants - volumes: - - name: ecs - path: /etc/profile.d/ecs-credentials-endpoint - depends_on: - - git-clone - -- name: check-public-docker-images - image: public.ecr.aws/prima/drone-tools:1.21.3 - commands: - - check-public-docker-images - depends_on: - - git-clone - -- name: build-image - image: public.ecr.aws/prima/drone-tools:1.21.3 - commands: - - sed -i 's/USER app/USER root/g' ./Dockerfile - - docker build -t prima/prima_tracing.rs-ci:${DRONE_COMMIT} ./ - volumes: - - name: docker - path: /var/run/docker.sock - depends_on: - - cache-restore - -- name: cargo-deps - image: prima/prima_tracing.rs-ci:${DRONE_COMMIT} - commands: - - cargo fetch - environment: - CARGO_HOME: /drone/src/.cargo - depends_on: - - build-image - -- name: cargo-format - image: prima/prima_tracing.rs-ci:${DRONE_COMMIT} - commands: - - cargo make --profile drone format-ci - environment: - CARGO_HOME: /drone/src/.cargo - depends_on: - - cargo-deps - -- name: cargo-clippy-ci - image: prima/prima_tracing.rs-ci:${DRONE_COMMIT} - commands: - - cargo make --profile drone clippy-ci - environment: - BUILD_ENV: dev - CARGO_HOME: /drone/src/.cargo - depends_on: - - cargo-format - -- name: cargo-test - image: prima/prima_tracing.rs-ci:${DRONE_COMMIT} - commands: - - cargo make --profile drone test - environment: - BUILD_ENV: dev - CARGO_HOME: /drone/src/.cargo - CARGO_HTTP_CAINFO: "" - depends_on: - - cargo-clippy-ci - -- name: cargo-build - image: prima/prima_tracing.rs-ci:${DRONE_COMMIT} - commands: - - cargo make --profile drone build-ci - environment: - BUILD_ENV: dev - CARGO_HOME: /drone/src/.cargo - when: - branch: - exclude: - - master - depends_on: - - cargo-test - -- name: cache-cleanup - image: prima/prima_tracing.rs-ci:${DRONE_COMMIT} - commands: - - cargo make --profile drone cache-cleanup - when: - branch: - - master - depends_on: - - cargo-build - - cargo-format - - cargo-clippy-ci - - cargo-test - -- name: cache-save - image: public.ecr.aws/prima/drone-tools:1.21.3 - commands: - - . /etc/profile.d/ecs-credentials-endpoint - - cache-save target - environment: - BUCKET_NAME: prima-ci-cache - volumes: - - name: ecs - path: /etc/profile.d/ecs-credentials-endpoint - - name: docker - path: /var/run/docker.sock - when: - branch: - - master - depends_on: - - cache-cleanup - -volumes: -- name: docker - host: - path: /var/run/docker.sock -- name: ecs - host: - path: /etc/profile.d/ecs-credentials-endpoint - -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: cache-restore - image: public.ecr.aws/prima/drone-tools:1.21.3 - commands: - - . /etc/profile.d/ecs-credentials-endpoint - - cache-restore - environment: - BUCKET_NAME: prima-ci-cache - volumes: - - name: ecs - path: /etc/profile.d/ecs-credentials-endpoint - - name: docker - path: /var/run/docker.sock - depends_on: - - git-clone - -- name: build-image - image: public.ecr.aws/prima/drone-tools:1.21.3 - commands: - - sed -i 's/USER app/USER root/g' ./Dockerfile - - docker build -t prima/prima_tracing.rs-ci:${DRONE_COMMIT} ./ - volumes: - - name: docker - path: /var/run/docker.sock - depends_on: - - cache-restore - -- name: build-production - image: prima/prima_tracing.rs-ci:${DRONE_COMMIT} - commands: - - . /etc/profile.d/ecs-credentials-endpoint - - ./deploy/build production - environment: - CARGO_AUTH_KEY: - from_secret: cargo_auth_key - volumes: - - name: ecs - path: /etc/profile.d/ecs-credentials-endpoint - depends_on: - - build-image - -volumes: -- name: docker - host: - path: /var/run/docker.sock -- name: ecs - host: - path: /etc/profile.d/ecs-credentials-endpoint - -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: aae1afdb1d2100b696969d10cd473ea681b1ed6c509b5c21364a660c33490f7e - -... diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..0b4582b --- /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@v4 + - 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 0000000..800bb58 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: CI + +on: + pull_request: + branches: + - master + +env: + CARGO_TERM_COLOR: always + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - 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: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - name: Run tests for no features + run: cargo test --all + + alls-green: + if: always() + needs: + - lint + - test + runs-on: ubuntu-latest + steps: + - uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} diff --git a/deploy/build b/deploy/build deleted file mode 100755 index c629629..0000000 --- a/deploy/build +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash - -############################################################################# -# # -# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN # -# # -############################################################################# - -# 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 AWS_DEFAULT_REGION="eu-west-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 - -git checkout . -cargo login "$CARGO_AUTH_KEY" -cargo publish