From 29a708b34c81fb0c65f6866a543c053cb65b3551 Mon Sep 17 00:00:00 2001 From: rock Date: Sat, 5 Sep 2026 14:21:36 -0700 Subject: [PATCH] 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) --- .forgejo/workflows/build.yaml | 76 ++++++++++++++--------------------- 1 file changed, 31 insertions(+), 45 deletions(-) diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index a4fdbbf..89503ac 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -20,32 +20,11 @@ jobs: - 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 + run: | + echo "Building and testing..." + cargo test --all --quiet + echo "✅ Tests passed" - name: Check formatting run: cargo fmt --all -- --check @@ -58,33 +37,40 @@ jobs: 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 short SHA - id: sha + - 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: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Docker login + run: | + echo "${{ secrets.REGISTRY_PAT }}" | docker login -u rock --password-stdin ${{ env.REGISTRY }} - - name: Registry login - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: rock - password: ${{ secrets.REGISTRY_PAT }} + - name: Build image + run: | + docker build \ + --tag ${{ env.IMAGE }}:${{ steps.info.outputs.short_sha }} \ + --tag ${{ env.IMAGE }}:latest \ + --progress=plain \ + . + echo "✅ Image built" - - 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 + - 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