Files
poimen-memory/.forgejo/workflows/build.yaml
T
rock 43c8f7ff14
Build & Push Memory Image / build-push (push) Failing after 14s
Build and Push / Test (push) Failing after 5m22s
Build and Push / Build and push image (push) Skipped
ci: fix Dockerfile for Rust + correct Forgejo runner labels
Issues fixed:
- Dockerfile was Python/Uvicorn (wrong for Rust project)
  - Changed to multi-stage Rust build (rust:1.81 → debian:bookworm-slim)
  - Correct binary name: mem (not mem-cli)
  - Added proper health check with curl

- CI runner labels were incorrect (rust/golang → docker)
  - Changed test job to: runs-on: docker with rust:1.81-bookworm container
  - Changed build job to: runs-on: docker

- Docker build config was broken
  - Switched to standard actions (setup-buildx, login, build-push)
  - Added Cargo caching (registry, git, target)
  - Added format + clippy checks
  - Simplified login/build/push flow

Ready for CI/CD pipeline restart.
2026-09-05 14:07:11 -07:00

91 lines
2.1 KiB
YAML

name: Build and Push
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
REGISTRY: forgejo.riotpiao.com
IMAGE: forgejo.riotpiao.com/rock/poimen-memory
jobs:
test:
name: Test
runs-on: docker
container:
image: rust:1.81-bookworm
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-registry-
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: cargo-git-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-git-
- name: Cache build target
uses: actions/cache@v4
with:
path: target
key: cargo-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-target-
- name: Run tests
run: cargo test --all --verbose
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all -- -D warnings
build:
name: Build and Push Image
runs-on: docker
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get short SHA
id: sha
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Registry login
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: rock
password: ${{ secrets.REGISTRY_PAT }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ env.IMAGE }}:${{ steps.sha.outputs.short_sha }}
${{ env.IMAGE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max