Skip to content

Add health check service with HTTP port configuration and update dependencies #4

Add health check service with HTTP port configuration and update dependencies

Add health check service with HTTP port configuration and update dependencies #4

Workflow file for this run

name: Production CI/CD
on:
push:
branches: [ master ]
tags: [ 'v*.*.*' ] # Semantic version pattern
pull_request:
branches: [ master ]
workflow_dispatch: # Manual trigger
inputs:
environment:
description: 'Deployment Environment'
required: true
default: 'staging'
type: choice
options: [ staging, production ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
CARGO_TERM_COLOR: always
jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install the Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Enforce formatting
run: cargo fmt --check
clippy:
name: Clippy
runs-on: ubuntu-latest
env:
SQLX_OFFLINE: true
steps:
- uses: actions/checkout@v4
- name: Install the Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
- name: Install protocol buffer compiler
run: sudo apt-get install protobuf-compiler
- name: Linting
run: cargo clippy -- -D warnings
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install the Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install protocol buffer compiler
run: sudo apt-get install protobuf-compiler
- name: Run tests
run: cargo test
docker-build:
name: Build Docker Image
runs-on: ubuntu-latest
needs: [ test ]
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=semver,pattern={{version}}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
# platforms: linux/amd64
# provenance: true
# sbom: true
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max