Add CI
This commit is contained in:
104
.gitea/workflows/ci.yml
Normal file
104
.gitea/workflows/ci.yml
Normal file
@@ -0,0 +1,104 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
tags: ["v*"]
|
||||
|
||||
env:
|
||||
IMAGE_BACKEND: ${{ secrets.ARTIFACTORY_HOST }}/otel-bi/backend
|
||||
IMAGE_FRONTEND: ${{ secrets.ARTIFACTORY_HOST }}/otel-bi/frontend
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
container: rockylinux/rockylinux:10
|
||||
defaults:
|
||||
run:
|
||||
working-directory: backend
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Python
|
||||
run: dnf install -y python3 && dnf clean all
|
||||
|
||||
- uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync --no-dev
|
||||
|
||||
- name: Run tests
|
||||
run: uv run pytest tests/ -q
|
||||
|
||||
test-analytics:
|
||||
runs-on: ubuntu-latest
|
||||
container: rockylinux/rockylinux:10
|
||||
defaults:
|
||||
run:
|
||||
working-directory: backend/analytics
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Go
|
||||
run: dnf install -y golang && dnf clean all
|
||||
|
||||
- name: Vet
|
||||
run: go vet ./...
|
||||
|
||||
- name: Test
|
||||
run: go test ./...
|
||||
|
||||
build-backend:
|
||||
needs: [test, test-analytics]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ secrets.ARTIFACTORY_HOST }}
|
||||
username: ${{ secrets.ARTIFACTORY_USER }}
|
||||
password: ${{ secrets.ARTIFACTORY_TOKEN }}
|
||||
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
|
||||
- uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: backend
|
||||
file: backend/Dockerfile
|
||||
push: true
|
||||
cache-from: type=registry,ref=${{ env.IMAGE_BACKEND }}:latest
|
||||
cache-to: type=inline
|
||||
tags: |
|
||||
${{ env.IMAGE_BACKEND }}:${{ github.sha }}
|
||||
${{ env.IMAGE_BACKEND }}:latest
|
||||
|
||||
build-frontend:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ secrets.ARTIFACTORY_HOST }}
|
||||
username: ${{ secrets.ARTIFACTORY_USER }}
|
||||
password: ${{ secrets.ARTIFACTORY_TOKEN }}
|
||||
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
|
||||
- uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: frontend
|
||||
file: frontend/Dockerfile
|
||||
push: true
|
||||
cache-from: type=registry,ref=${{ env.IMAGE_FRONTEND }}:latest
|
||||
cache-to: type=inline
|
||||
build-args: |
|
||||
VITE_API_BASE_URL=${{ vars.API_BASE_URL }}
|
||||
VITE_OTEL_COLLECTOR_ENDPOINT=${{ vars.OTEL_COLLECTOR_ENDPOINT }}
|
||||
tags: |
|
||||
${{ env.IMAGE_FRONTEND }}:${{ github.sha }}
|
||||
${{ env.IMAGE_FRONTEND }}:latest
|
||||
Reference in New Issue
Block a user