mirror of
https://github.com/SamyRai/turash.git
synced 2025-12-26 23:01:33 +00:00
feat: Add Gitea Actions workflow for CI/CD
All checks were successful
CI/CD Pipeline / frontend-lint (push) Has been skipped
CI/CD Pipeline / backend-lint (push) Has been skipped
CI/CD Pipeline / backend-build (push) Has been skipped
CI/CD Pipeline / frontend-build (push) Has been skipped
CI/CD Pipeline / e2e-test (push) Has been skipped
All checks were successful
CI/CD Pipeline / frontend-lint (push) Has been skipped
CI/CD Pipeline / backend-lint (push) Has been skipped
CI/CD Pipeline / backend-build (push) Has been skipped
CI/CD Pipeline / frontend-build (push) Has been skipped
CI/CD Pipeline / e2e-test (push) Has been skipped
- 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
This commit is contained in:
parent
911c6f1a99
commit
b4715361cd
132
.gitea/workflows/ci.yml
Normal file
132
.gitea/workflows/ci.yml
Normal file
@ -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
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user