From ff4fd327d16b5c1210fdf1e7976ba225c6c559fe Mon Sep 17 00:00:00 2001 From: continuist Date: Sat, 20 Sep 2025 12:43:38 -0400 Subject: [PATCH] Add test-frontend, build-backend, and build-frontend stages to CI workflow --- .forgejo/workflows/ci.yml | 81 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index da18308..122f32b 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -123,4 +123,83 @@ jobs: - name: Debug DB (on failure) if: failure() - run: podman --remote logs --tail=200 test-postgres-${{ env.RUN_ID }} || true \ No newline at end of file + run: podman --remote logs --tail=200 test-postgres-${{ env.RUN_ID }} || true + + test-frontend: + runs-on: [ci] + needs: test-backend + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Pass-through (no frontend tests yet) + run: echo "Frontend tests placeholder - no tests implemented yet" + + build-backend: + runs-on: [ci] + needs: [test-backend, test-frontend] + + env: + CONTAINER_HOST: unix:///run/user/1001/podman/podman.sock + XDG_RUNTIME_DIR: /tmp + RUN_ID: ${{ github.run_id }} + BACKEND_IMAGE: ${{ secrets.REGISTRY_HOST }}/${{ github.repository }}/sharenet-backend-api-postgres + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Login to container registry with PAT + run: | + echo "${{ secrets.REGISTRY_TOKEN }}" | podman --remote login \ + -u "${{ secrets.REGISTRY_USERNAME }}" \ + --password-stdin \ + "${{ secrets.REGISTRY_HOST }}" + + - name: Build backend container image + run: | + podman --remote build \ + -f backend/Dockerfile \ + -t "$BACKEND_IMAGE:${{ github.sha }}" \ + -t "$BACKEND_IMAGE:latest" \ + backend + + - name: Push backend container image + run: | + podman --remote push "$BACKEND_IMAGE:${{ github.sha }}" + podman --remote push "$BACKEND_IMAGE:latest" + + build-frontend: + runs-on: [ci] + needs: [test-backend, test-frontend] + + env: + CONTAINER_HOST: unix:///run/user/1001/podman/podman.sock + XDG_RUNTIME_DIR: /tmp + RUN_ID: ${{ github.run_id }} + FRONTEND_IMAGE: ${{ secrets.REGISTRY_HOST }}/${{ github.repository }}/sharenet-frontend + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Login to container registry with PAT + run: | + echo "${{ secrets.REGISTRY_TOKEN }}" | podman --remote login \ + -u "${{ secrets.REGISTRY_USERNAME }}" \ + --password-stdin \ + "${{ secrets.REGISTRY_HOST }}" + + - name: Build frontend container image + run: | + podman --remote build \ + -f frontend/Dockerfile \ + -t "$FRONTEND_IMAGE:${{ github.sha }}" \ + -t "$FRONTEND_IMAGE:latest" \ + frontend + + - name: Push frontend container image + run: | + podman --remote push "$FRONTEND_IMAGE:${{ github.sha }}" + podman --remote push "$FRONTEND_IMAGE:latest" \ No newline at end of file