Skip to content

Add support for multiple clients #625

Add support for multiple clients

Add support for multiple clients #625

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
lint:
name: Format & Clippy
runs-on:
group: arc-public-large-amd64-runner
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 https://github.com/actions/checkout/releases/tag/v4.2.2
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # 2025-04-29
with:
toolchain: stable
- name: Get Rust version
id: rust_version
run: echo "version=$(rustc --version | awk '{print $2}')" >> $GITHUB_OUTPUT
- name: Check code formatting
run: cargo fmt -- --check
- name: Run clippy
run: cargo clippy --all-features
build-release:
name: Build Release
runs-on:
group: arc-public-large-amd64-runner
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 https://github.com/actions/checkout/releases/tag/v4.2.2
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # 2025-04-29
with:
toolchain: stable
- name: Build the project
run: cargo build --release --locked
test:
name: Tests
runs-on:
group: arc-public-4xlarge-amd64-runner
# Log in to Docker Hub if a token is provided to avoid public rate limiting
env:
IS_DOCKER_TOKEN_SET: ${{ (secrets.DOCKER_HUB_PULL_PUBLIC_IMAGES_TOKEN != '' && secrets.DOCKER_HUB_PULL_PUBLIC_IMAGES_USERNAME != '') && 'true' || 'false' }}
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 https://github.com/actions/checkout/releases/tag/v4.2.2
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # 2025-04-29
with:
toolchain: stable
- name: Log in to Docker Hub
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 https://github.com/docker/login-action/releases/tag/v3.6.0
if: ${{ env.IS_DOCKER_TOKEN_SET == 'true' }}
with:
username: ${{ secrets.DOCKER_HUB_PULL_PUBLIC_IMAGES_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PULL_PUBLIC_IMAGES_TOKEN }}
- name: Start LocalStack
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
run: |
docker compose up -d
# Wait for services to be ready
sleep 20
docker compose logs
- name: Health check LocalStack
run: curl -s http://localhost:4566/_localstack/health | jq -e '.services.s3 == "running"'
- name: Run tests
run: cargo test -- --nocapture
- name: Clean up
run: docker compose down
docker:
name: Test Docker build
runs-on:
group: arc-public-4xlarge-amd64-runner
permissions:
contents: read
env:
IS_DOCKER_TOKEN_SET: ${{ (secrets.DOCKER_HUB_PULL_PUBLIC_IMAGES_TOKEN != '' && secrets.DOCKER_HUB_PULL_PUBLIC_IMAGES_USERNAME != '') && 'true' || 'false' }}
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 https://github.com/actions/checkout/releases/tag/v4.2.2
- name: Log in to Docker Hub
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 https://github.com/docker/login-action/releases/tag/v3.6.0
if: ${{ env.IS_DOCKER_TOKEN_SET == 'true' }}
with:
username: ${{ secrets.DOCKER_HUB_PULL_PUBLIC_IMAGES_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PULL_PUBLIC_IMAGES_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 https://github.com/docker/setup-buildx-action/releases/tag/v3.11.1
- name: Build
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 https://github.com/docker/build-push-action/releases/tag/v6.18.0
id: docker_build
with:
push: false
load: true
tags: backup-service-ci:latest
cache-from: type=gha
cache-to: "type=gha,mode=max"
platforms: linux/amd64
- name: Start LocalStack
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
run: |
docker compose up -d
- name: Run Docker container
run: |
docker run -d --network host --env-file .env.example --name backup-service-ci-container backup-service-ci:latest
# Wait for the application to start
sleep 10
# Output logs to GitHub action
docker logs backup-service-ci-container
- name: Health check Docker container
run: curl -f http://0.0.0.0:8000/health
- name: Clean up
run: |
docker stop backup-service-ci-container
docker rm backup-service-ci-container
docker compose down
deny:
name: Cargo deny
runs-on:
group: arc-public-large-amd64-runner
env:
IS_DOCKER_TOKEN_SET: ${{ (secrets.DOCKER_HUB_PULL_PUBLIC_IMAGES_TOKEN != '' && secrets.DOCKER_HUB_PULL_PUBLIC_IMAGES_USERNAME != '') && 'true' || 'false' }}
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 https://github.com/actions/checkout/releases/tag/v4.2.2
- name: Log in to Docker Hub
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 https://github.com/docker/login-action/releases/tag/v3.6.0
if: ${{ env.IS_DOCKER_TOKEN_SET == 'true' }}
with:
username: ${{ secrets.DOCKER_HUB_PULL_PUBLIC_IMAGES_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PULL_PUBLIC_IMAGES_TOKEN }}
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # 2025-04-29
with:
toolchain: stable
- name: Run cargo-deny
uses: EmbarkStudios/cargo-deny-action@3fd3802e88374d3fe9159b834c7714ec57d6c979 # v2.0.15 https://github.com/EmbarkStudios/cargo-deny-action/releases/tag/v2.0.15
with:
command: check