Files
poimen-memory/.forgejo/workflows/build.yaml
T
rock 29a708b34c
Build & Push Memory Image / build-push (push) Failing after 3m23s
Build and Push / Test (push) Failing after 2m11s
Build and Push / Build and push image (push) Skipped
ci: simplify workflow - remove third-party actions that don't work on Forgejo
Issues that caused stuck CI:
- docker/setup-buildx-action@v3 (not reliable on Forgejo)
- docker/login-action@v3 (not reliable on Forgejo)
- docker/build-push-action@v5 (too complex)
- GHA caching (type=gha not supported on Forgejo)

Fixed with:
- Plain docker commands (login, build, push)
- No buildx complexity
- Direct progress output
- Proper cleanup on failure
- Timeout-safe (no hanging processes)
2026-09-05 14:21:36 -07:00

77 lines
1.9 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: Run tests
run: |
echo "Building and testing..."
cargo test --all --quiet
echo "✅ Tests passed"
- 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'
env:
DOCKER_HOST: unix:///var/run/docker.sock
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get commit info
id: info
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
COMMIT_MSG=$(git log -1 --pretty=%B | head -1)
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
echo "commit_msg=${COMMIT_MSG}" >> $GITHUB_OUTPUT
echo "Build: ${SHORT_SHA} - ${COMMIT_MSG}"
- name: Docker login
run: |
echo "${{ secrets.REGISTRY_PAT }}" | docker login -u rock --password-stdin ${{ env.REGISTRY }}
- name: Build image
run: |
docker build \
--tag ${{ env.IMAGE }}:${{ steps.info.outputs.short_sha }} \
--tag ${{ env.IMAGE }}:latest \
--progress=plain \
.
echo "✅ Image built"
- name: Push image
run: |
docker push ${{ env.IMAGE }}:${{ steps.info.outputs.short_sha }}
docker push ${{ env.IMAGE }}:latest
echo "✅ Image pushed"
- name: Cleanup
if: always()
run: docker logout ${{ env.REGISTRY }} || true