mirror of
https://github.com/SamyRai/turash.git
synced 2025-12-26 23:01:33 +00:00
Some checks failed
CI/CD Pipeline / frontend-lint (push) Successful in 1m43s
CI/CD Pipeline / frontend-build (push) Failing after 27s
CI/CD Pipeline / backend-lint (push) Failing after 5m8s
CI/CD Pipeline / backend-build (push) Has been skipped
CI/CD Pipeline / e2e-test (push) Has been skipped
- Update the installation step for GCC to include checks for various package managers - Improve error handling and output messages for GCC installation - Modify test execution to conditionally enable CGO based on GCC availability - Ensure compatibility with non-CGO builds by setting CGO_ENABLED appropriately
220 lines
7.5 KiB
YAML
220 lines
7.5 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
|
|
uses: aevea/action-kaniko@v0.9.0
|
|
with:
|
|
registry: registry.bk.glpx.pro
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
image: turash/turash-frontend
|
|
tag: latest,${{ gitea.sha }}
|
|
cache: true
|
|
cache_registry: registry.bk.glpx.pro/turash/turash-frontend
|
|
context: bugulma/frontend
|
|
dockerfile: bugulma/frontend/Dockerfile
|
|
kaniko_executor_image: gcr.io/kaniko-project/executor:debug-v1.24.0
|
|
|
|
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 CGO dependencies (for race detector)
|
|
id: cgo-setup
|
|
run: |
|
|
echo "Checking for gcc (required for race detector)..."
|
|
CGO_AVAILABLE=0
|
|
# Check if gcc is already available
|
|
if command -v gcc &> /dev/null; then
|
|
echo "✓ gcc is already available"
|
|
gcc --version
|
|
CGO_AVAILABLE=1
|
|
else
|
|
echo "gcc not found, attempting to install..."
|
|
# Detect package manager and install gcc
|
|
if command -v apt-get &> /dev/null; then
|
|
echo "Using apt-get (Debian/Ubuntu)..."
|
|
if [ "$(id -u)" -eq 0 ]; then
|
|
apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq build-essential && CGO_AVAILABLE=1 || true
|
|
else
|
|
(sudo apt-get update -qq && DEBIAN_FRONTEND=noninteractive sudo apt-get install -y -qq build-essential && CGO_AVAILABLE=1) || \
|
|
(apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq build-essential && CGO_AVAILABLE=1) || true
|
|
fi
|
|
elif command -v apk &> /dev/null; then
|
|
echo "Using apk (Alpine)..."
|
|
apk add --no-cache gcc musl-dev && CGO_AVAILABLE=1 || true
|
|
elif command -v yum &> /dev/null; then
|
|
echo "Using yum (RHEL/CentOS)..."
|
|
yum install -y gcc && CGO_AVAILABLE=1 || true
|
|
elif command -v dnf &> /dev/null; then
|
|
echo "Using dnf (Fedora)..."
|
|
dnf install -y gcc && CGO_AVAILABLE=1 || true
|
|
else
|
|
echo "⚠ No supported package manager found (apt-get, apk, yum, dnf)"
|
|
echo "⚠ gcc installation skipped - race detector will be disabled"
|
|
fi
|
|
|
|
# Verify installation
|
|
if command -v gcc &> /dev/null || [ -f /usr/bin/gcc ]; then
|
|
echo "✓ gcc successfully installed"
|
|
gcc --version || /usr/bin/gcc --version
|
|
CGO_AVAILABLE=1
|
|
else
|
|
echo "⚠ gcc installation failed - race detector will be disabled"
|
|
fi
|
|
fi
|
|
echo "cgo_available=$CGO_AVAILABLE" >> $GITHUB_OUTPUT
|
|
continue-on-error: true
|
|
- name: Install dependencies
|
|
working-directory: bugulma/backend
|
|
run: go mod download
|
|
env:
|
|
GO111MODULE: on
|
|
CGO_ENABLED: 1
|
|
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
|
|
CGO_ENABLED: 0
|
|
GOPROXY: https://proxy.golang.org,direct
|
|
GOSUMDB: sum.golang.org
|
|
- name: Verify module setup
|
|
working-directory: bugulma/backend
|
|
run: |
|
|
pwd
|
|
ls -la go.mod
|
|
go list -m
|
|
# Verify all packages can be listed
|
|
go list ./...
|
|
env:
|
|
GO111MODULE: on
|
|
CGO_ENABLED: 0
|
|
GOPROXY: https://proxy.golang.org,direct
|
|
GOSUMDB: sum.golang.org
|
|
- name: Build module to populate cache
|
|
working-directory: bugulma/backend
|
|
run: go build ./...
|
|
env:
|
|
GO111MODULE: on
|
|
CGO_ENABLED: 0
|
|
GOPROXY: https://proxy.golang.org,direct
|
|
GOSUMDB: sum.golang.org
|
|
- name: Vet
|
|
working-directory: bugulma/backend
|
|
run: go vet ./...
|
|
env:
|
|
GO111MODULE: on
|
|
CGO_ENABLED: 0
|
|
GOPROXY: https://proxy.golang.org,direct
|
|
GOSUMDB: sum.golang.org
|
|
- name: Test
|
|
working-directory: bugulma/backend
|
|
run: |
|
|
# Check if CGO is available for race detector
|
|
CGO_AVAILABLE="${{ steps.cgo-setup.outputs.cgo_available || '0' }}"
|
|
if [ "$CGO_AVAILABLE" = "1" ] && command -v gcc &> /dev/null; then
|
|
echo "Running tests with race detector..."
|
|
CGO_ENABLED=1 go test -v -race -coverprofile=coverage.out ./...
|
|
else
|
|
echo "Running tests without race detector (CGO not available)..."
|
|
CGO_ENABLED=0 go test -v -coverprofile=coverage.out ./...
|
|
fi
|
|
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
|
|
uses: aevea/action-kaniko@v0.9.0
|
|
with:
|
|
registry: registry.bk.glpx.pro
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
image: turash/turash-backend
|
|
tag: latest,${{ gitea.sha }}
|
|
cache: true
|
|
cache_registry: registry.bk.glpx.pro/turash/turash-backend
|
|
context: bugulma/backend
|
|
dockerfile: bugulma/backend/Dockerfile
|
|
kaniko_executor_image: gcr.io/kaniko-project/executor:debug-v1.24.0
|
|
|
|
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
|
|
|