turash/.gitea/workflows/ci.yml
Damir Mukimov da1074086c
Some checks failed
CI/CD Pipeline / backend-lint (push) Failing after 26s
CI/CD Pipeline / backend-build (push) Has been skipped
CI/CD Pipeline / frontend-lint (push) Failing after 50s
CI/CD Pipeline / frontend-build (push) Has been skipped
CI/CD Pipeline / e2e-test (push) Has been skipped
fix: Simplify workflow conditions to always run lint jobs
2025-12-24 22:39:01 +01:00

131 lines
4.1 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'
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: 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.23'
- 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: 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'
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