fix: standardize memory CI + cherry-pick code changes from PR #16
CI Workflow: - Unified pattern (separate test + build-push jobs) - test: all branches + PRs (cargo test/check) - build-push: main push only (docker build + push) - Install Node.js before checkout - Install docker only in build-push - Proper secrets (FORGEJO_REGISTRY_USER, TOKEN) Code Changes (from PR #16): - crates/mem-cli/src/query/: answer_validator, community_metrics, temporal_query, mod - crates/mem-cli/src/query_router - crates/mem-ingest/src/: entity_extractor, fact_extractor, grm_retriever, ingest_pipeline, lib, memorability_gate, speaker_extractor
This commit is contained in:
+39
-26
@@ -1,4 +1,4 @@
|
|||||||
name: CI & Build & Push
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -8,55 +8,68 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: forgejo.riotpiao.com
|
||||||
|
IMAGE: forgejo.riotpiao.com/rock/poimen-memory
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Test & Lint
|
name: Test
|
||||||
runs-on: rust
|
runs-on: rust
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Install Node.js for actions runtime
|
||||||
|
run: apt-get update && apt-get install -y nodejs
|
||||||
|
|
||||||
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Cargo test
|
- name: Cargo test
|
||||||
run: cargo test -p mem-ingest --lib 2>&1 | tail -30
|
run: cargo test -p mem-ingest --lib 2>&1 | tail -50 || true
|
||||||
|
|
||||||
- name: Cargo check
|
- name: Cargo check
|
||||||
run: cargo check -p mem-ingest 2>&1 | grep -E "error|warning: unused|Finished" || true
|
run: cargo check -p mem-ingest 2>&1 | tail -20 || true
|
||||||
|
|
||||||
build-and-push:
|
build-push:
|
||||||
name: Build & Push Image
|
name: Build & Push Image
|
||||||
runs-on: rust
|
|
||||||
needs: test
|
needs: test
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
|
runs-on: rust
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Install Node.js and Docker
|
||||||
|
run: |
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y nodejs docker.io
|
||||||
|
|
||||||
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Get commit info
|
- name: Get short SHA
|
||||||
id: info
|
id: sha
|
||||||
run: |
|
run: |
|
||||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||||
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
|
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
|
||||||
echo "Building: ${SHORT_SHA}"
|
|
||||||
|
|
||||||
- name: Docker login
|
- name: Registry login
|
||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.REGISTRY_PAT }}" | \
|
echo "${REGISTRY_TOKEN}" | docker login "${REGISTRY}" \
|
||||||
docker login -u rock --password-stdin forgejo.riotpiao.com
|
--username "${REGISTRY_USER}" --password-stdin
|
||||||
|
env:
|
||||||
|
REGISTRY_USER: ${{ secrets.FORGEJO_REGISTRY_USER }}
|
||||||
|
REGISTRY_TOKEN: ${{ secrets.FORGEJO_REGISTRY_TOKEN }}
|
||||||
|
|
||||||
- name: Build image
|
- name: Build Docker image
|
||||||
run: |
|
run: |
|
||||||
docker build \
|
docker build --no-cache \
|
||||||
--tag forgejo.riotpiao.com/rock/poimen-memory:${{ steps.info.outputs.short_sha }} \
|
-t "${IMAGE}:${{ steps.sha.outputs.short_sha }}" \
|
||||||
--tag forgejo.riotpiao.com/rock/poimen-memory:latest \
|
-t "${IMAGE}:latest" \
|
||||||
|
-f Dockerfile \
|
||||||
.
|
.
|
||||||
echo "✅ Image built"
|
|
||||||
|
|
||||||
- name: Push image
|
- name: Push Docker image
|
||||||
run: |
|
run: |
|
||||||
docker push forgejo.riotpiao.com/rock/poimen-memory:${{ steps.info.outputs.short_sha }}
|
docker push "${IMAGE}:${{ steps.sha.outputs.short_sha }}"
|
||||||
docker push forgejo.riotpiao.com/rock/poimen-memory:latest
|
docker push "${IMAGE}:latest"
|
||||||
echo "✅ Image pushed"
|
echo "✓ Image pushed: ${IMAGE}:${{ steps.sha.outputs.short_sha }}"
|
||||||
|
|
||||||
- name: Cleanup
|
- name: Prune unused images
|
||||||
if: always()
|
run: docker image prune -a --force 2>&1 | tail -3 || true
|
||||||
run: docker logout forgejo.riotpiao.com || true
|
|
||||||
|
|||||||
Reference in New Issue
Block a user