From b4715361cd36dd59ecf44ec299dc7e0f081f45d0 Mon Sep 17 00:00:00 2001 From: Damir Mukimov Date: Wed, 24 Dec 2025 20:58:26 +0100 Subject: [PATCH] feat: Add Gitea Actions workflow for CI/CD - Convert from Woodpecker CI to Gitea Actions - Remove Kubernetes deployment (ArgoCD handles CD) - Configure Harbor registry integration - Add lint, test, build, and push steps for frontend and backend - E2E tests after builds complete --- .gitea/workflows/ci.yml | 132 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 .gitea/workflows/ci.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..5c7e12d --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,132 @@ +name: CI/CD Pipeline + +on: + push: + branches: + - master + paths: + - 'bugulma/**' + - 'k8s/**' + - '.gitea/workflows/**' + pull_request: + branches: + - master + paths: + - 'bugulma/**' + - 'k8s/**' + +jobs: + frontend-lint: + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' || contains(github.event.head_commit.modified, 'bugulma/frontend') || contains(github.event.head_commit.added, 'bugulma/frontend') + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'yarn' + cache-dependency-path: bugulma/frontend/yarn.lock + - name: Install dependencies + working-directory: bugulma/frontend + run: yarn install --frozen-lockfile + - name: Lint + working-directory: bugulma/frontend + run: yarn lint + - name: Test + working-directory: bugulma/frontend + run: yarn test --run + + frontend-build: + runs-on: ubuntu-latest + needs: frontend-lint + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + steps: + - uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to Harbor + uses: docker/login-action@v3 + with: + registry: registry.bk.glpx.pro + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Build and push frontend + uses: docker/build-push-action@v5 + with: + context: bugulma/frontend + file: bugulma/frontend/Dockerfile + push: true + tags: | + registry.bk.glpx.pro/turash/turash-frontend:latest + registry.bk.glpx.pro/turash/turash-frontend:${{ github.sha }} + cache-from: type=registry,ref=registry.bk.glpx.pro/turash/turash-frontend:buildcache + cache-to: type=registry,ref=registry.bk.glpx.pro/turash/turash-frontend:buildcache,mode=max + + backend-lint: + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' || contains(github.event.head_commit.modified, 'bugulma/backend') || contains(github.event.head_commit.added, 'bugulma/backend') + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.21' + - name: Download dependencies + working-directory: bugulma/backend + run: go mod download + - name: Vet + working-directory: bugulma/backend + run: go vet ./... + - name: Test + working-directory: bugulma/backend + run: go test -v -race -coverprofile=coverage.out ./... + - name: Coverage + working-directory: bugulma/backend + run: go tool cover -html=coverage.out -o coverage.html + + backend-build: + runs-on: ubuntu-latest + needs: backend-lint + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + steps: + - uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to Harbor + uses: docker/login-action@v3 + with: + registry: registry.bk.glpx.pro + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Build and push backend + uses: docker/build-push-action@v5 + with: + context: bugulma/backend + file: bugulma/backend/Dockerfile + push: true + tags: | + registry.bk.glpx.pro/turash/turash-backend:latest + registry.bk.glpx.pro/turash/turash-backend:${{ github.sha }} + cache-from: type=registry,ref=registry.bk.glpx.pro/turash/turash-backend:buildcache + cache-to: type=registry,ref=registry.bk.glpx.pro/turash/turash-backend:buildcache,mode=max + + e2e-test: + runs-on: ubuntu-latest + needs: [frontend-build, backend-build] + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'yarn' + cache-dependency-path: bugulma/frontend/yarn.lock + - name: Install dependencies + working-directory: bugulma/frontend + run: yarn install --frozen-lockfile + - name: Run E2E tests + working-directory: bugulma/frontend + run: yarn test:e2e --headed=false +