turash/.gitea/workflows/ci.yml
Damir Mukimov 40a018b10b
fix: Make go list diagnostic non-failing in vet step
- Add || echo to prevent go list ./pkg/config from failing the step
- This was added as a diagnostic but shouldn't block the workflow
- go vet will still catch actual issues
2025-12-24 23:17:30 +01:00

144 lines
4.4 KiB
YAML

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
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
- name: Enable Corepack (for Yarn)
run: corepack enable
- 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: gitea.event_name == 'push' && gitea.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:${{ gitea.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
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25.3'
- name: Download dependencies
working-directory: bugulma/backend
env:
GO111MODULE: on
run: go mod download
- name: Vet
working-directory: bugulma/backend
env:
GO111MODULE: on
run: |
go mod tidy
go mod verify
go list -m
go list ./pkg/config || echo "Warning: pkg/config not found, but continuing..."
go vet ./...
- name: Test
working-directory: bugulma/backend
env:
GO111MODULE: on
run: go test -v -race -coverprofile=coverage.out ./...
- name: Coverage
working-directory: bugulma/backend
env:
GO111MODULE: on
run: go tool cover -html=coverage.out -o coverage.html
backend-build:
runs-on: ubuntu-latest
needs: backend-lint
if: gitea.event_name == 'push' && gitea.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:${{ gitea.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: gitea.event_name == 'push' && gitea.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
- name: Enable Corepack (for Yarn)
run: corepack enable
- 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