artur 0.2.0

Universal config-driven Rust HTTP gateway and package orchestrator
Documentation
name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

permissions:
  contents: read
  packages: write

jobs:
  test:
    name: Format, lint, and test
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6.0.3

      - name: Install Rust
        uses: dtolnay/rust-toolchain@v1
        with:
          toolchain: stable
          components: rustfmt, clippy

      - name: Cache cargo
        uses: Swatinem/rust-cache@v2.9.1

      - name: Check formatting
        run: cargo fmt --all -- --check

      - name: Check
        run: cargo check --all-targets --all-features

      - name: Clippy
        run: cargo clippy --all-targets --all-features -- -D warnings

      - name: Test
        run: cargo test --all-features

  docker:
    name: Build and publish Docker image
    runs-on: ubuntu-latest
    needs: [test, data-test]
    steps:
      - name: Checkout
        uses: actions/checkout@v6.0.3

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v4.1.0

      - name: Docker metadata
        id: meta
        uses: docker/metadata-action@v6.1.0
        with:
          images: ghcr.io/${{ github.repository }}
          tags: |
            type=ref,event=branch
            type=ref,event=pr
            type=sha,prefix=sha-
            type=raw,value=latest,enable={{is_default_branch}}

      - name: Log in to GitHub Container Registry
        if: github.event_name != 'pull_request'
        uses: docker/login-action@v4.2.0
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Build and optionally push Docker image
        uses: docker/build-push-action@v7.2.0
        with:
          context: .
          push: ${{ github.event_name != 'pull_request' }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          cache-from: type=gha
          cache-to: type=gha,mode=max

  data-test:
    name: Docker Compose data flow
    runs-on: ubuntu-latest
    needs: test
    steps:
      - name: Checkout
        uses: actions/checkout@v6.0.3

      - name: Build and start service
        run: docker compose up --build -d artur

      - name: Run end-to-end data test
        run: python3 tests/data_e2e.py

      - name: Show service logs
        if: always()
        run: docker compose logs artur

      - name: Stop service
        if: always()
        run: docker compose down --volumes