Files
zavrsni-rad-otel-app/.gitea/workflows/ci.yml
Domagoj Andrić e41fd24325
Some checks failed
CI / test (push) Failing after 1m50s
CI / build-frontend (push) Has been skipped
CI / test-analytics (push) Failing after 6s
CI / build-backend (push) Has been skipped
Add CI
2026-05-11 11:00:29 +02:00

105 lines
2.6 KiB
YAML

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