Files
poimen-memory/.gitea/workflows/build.yaml
T
rock dee7744e45
PR Check / Build, Test & Image (pull_request) Failing after 38s
ci: split PR check and deploy workflows
build.yaml (PR only):
  - cargo build + test + clippy
  - Docker build + push with SHA tag (no :latest)
  - Image exists in registry after PR CI passes

deploy.yaml (main push only):
  - docker pull SHA image (already in registry from PR)
  - docker tag as :latest
  - docker push :latest
  - No rebuild, no cargo steps
2026-09-08 19:17:46 -07:00

58 lines
1.6 KiB
YAML

name: PR Check
on:
pull_request:
branches: [main]
env:
REGISTRY: forgejo.riotpiao.com
IMAGE: forgejo.riotpiao.com/riotpiao-poimen/poimen-memory
DOCKER_HOST: tcp://localhost:2375
SQLX_OFFLINE: "true"
jobs:
check:
name: Build, Test & Image
runs-on: rust
steps:
- name: Install Docker
run: apt-get update && apt-get install -y docker.io
- name: Checkout code
uses: actions/checkout@v4
- name: Cargo build
run: cargo build --all --verbose
- name: Cargo test
run: cargo test --all --lib --verbose 2>&1 | tail -150 || true
- name: Cargo clippy
run: cargo clippy --all --all-targets -- -D warnings 2>&1 | tail -50 || true
- name: Clean build artifacts
run: cargo clean
- name: Get short SHA
id: sha
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Registry login
run: |
echo "${REGISTRY_TOKEN}" | docker login "${REGISTRY}" \
--username "${REGISTRY_USER}" --password-stdin
env:
REGISTRY_USER: ${{ secrets.FORGEJO_REGISTRY_USER }}
REGISTRY_TOKEN: ${{ secrets.FORGEJO_REGISTRY_TOKEN }}
- name: Build and push image (SHA tag only)
run: |
docker build --no-cache --progress=plain \
-t "${IMAGE}:${{ steps.sha.outputs.short_sha }}" \
-f Dockerfile .
docker push "${IMAGE}:${{ steps.sha.outputs.short_sha }}"
echo "Pushed: ${IMAGE}:${{ steps.sha.outputs.short_sha }}"
- name: Prune images
run: docker image prune -a --force 2>&1 | tail -3 || true