turash/.gitea/workflows/ci.yml
Damir Mukimov 3f25e3a786
Some checks failed
CI/CD Pipeline / backend-lint (push) Failing after 30s
CI/CD Pipeline / backend-build (push) Has been skipped
CI/CD Pipeline / frontend-lint (push) Successful in 1m37s
CI/CD Pipeline / frontend-build (push) Failing after 25s
CI/CD Pipeline / e2e-test (push) Has been skipped
Refactor CI configuration to streamline Kaniko usage for Docker builds
- Update CI workflow to use Docker run commands for Kaniko instead of containerized execution
- Simplify Docker authentication setup by creating a temporary directory for config
- Ensure proper context and dockerfile paths are used for both frontend and backend builds
2025-12-26 12:56:10 +01:00

147 lines
4.7 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 --immutable
- 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: Build and push frontend with Kaniko
run: |
mkdir -p /tmp/kaniko-docker
echo "{\"auths\":{\"registry.bk.glpx.pro\":{\"username\":\"${{ secrets.DOCKER_USERNAME }}\",\"password\":\"${{ secrets.DOCKER_PASSWORD }}\"}}}" > /tmp/kaniko-docker/config.json
docker run --rm \
-v $(pwd):/workspace \
-v /tmp/kaniko-docker:/kaniko/.docker \
-e DOCKER_CONFIG=/kaniko/.docker \
gcr.io/kaniko-project/executor:v1.24.0 \
--dockerfile=/workspace/bugulma/frontend/Dockerfile \
--context=/workspace/bugulma/frontend \
--destination=registry.bk.glpx.pro/turash/turash-frontend:latest \
--destination=registry.bk.glpx.pro/turash/turash-frontend:${{ gitea.sha }} \
--cache=true \
--cache-ttl=168h \
--compressed-caching=false
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'
cache: true
- name: Install dependencies
working-directory: bugulma/backend
run: go mod download
env:
GO111MODULE: on
GOPROXY: https://proxy.golang.org,direct
GOSUMDB: sum.golang.org
- name: Tidy and verify modules
working-directory: bugulma/backend
run: |
go mod tidy
go mod verify
env:
GO111MODULE: on
GOPROXY: https://proxy.golang.org,direct
GOSUMDB: sum.golang.org
- name: Vet
working-directory: bugulma/backend
run: go vet ./...
env:
GO111MODULE: on
GOPROXY: https://proxy.golang.org,direct
GOSUMDB: sum.golang.org
- name: Test
working-directory: bugulma/backend
run: go test -v -race -coverprofile=coverage.out ./...
env:
GO111MODULE: on
GOPROXY: https://proxy.golang.org,direct
GOSUMDB: sum.golang.org
- 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: Build and push backend with Kaniko
run: |
mkdir -p /tmp/kaniko-docker
echo "{\"auths\":{\"registry.bk.glpx.pro\":{\"username\":\"${{ secrets.DOCKER_USERNAME }}\",\"password\":\"${{ secrets.DOCKER_PASSWORD }}\"}}}" > /tmp/kaniko-docker/config.json
docker run --rm \
-v $(pwd):/workspace \
-v /tmp/kaniko-docker:/kaniko/.docker \
-e DOCKER_CONFIG=/kaniko/.docker \
gcr.io/kaniko-project/executor:v1.24.0 \
--dockerfile=/workspace/bugulma/backend/Dockerfile \
--context=/workspace/bugulma/backend \
--destination=registry.bk.glpx.pro/turash/turash-backend:latest \
--destination=registry.bk.glpx.pro/turash/turash-backend:${{ gitea.sha }} \
--cache=true \
--cache-ttl=168h \
--compressed-caching=false
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 --immutable
- name: Run E2E tests
working-directory: bugulma/frontend
run: yarn test:e2e --headed=false