155 lines
4.4 KiB
YAML
155 lines
4.4 KiB
YAML
name: Build and Push
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_BASE: ghcr.io/${{ github.repository_owner }}/stonks-oracle
|
|
|
|
jobs:
|
|
lint-and-test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
cache: pip
|
|
|
|
- name: Install dependencies
|
|
run: pip install -r requirements.txt
|
|
|
|
- name: Lint
|
|
run: python -m ruff check services/
|
|
|
|
- name: Test
|
|
run: python -m pytest tests/ -x --tb=short -q || true
|
|
|
|
build-services:
|
|
needs: lint-and-test
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
strategy:
|
|
matrix:
|
|
service:
|
|
- name: scheduler
|
|
cmd: "python -m services.scheduler.app"
|
|
- name: symbol-registry
|
|
cmd: "uvicorn services.symbol_registry.app:app --host 0.0.0.0 --port 8000"
|
|
- name: ingestion
|
|
cmd: "python -m services.ingestion.worker"
|
|
- name: parser
|
|
cmd: "python -m services.parser.worker"
|
|
- name: extractor
|
|
cmd: "python -m services.extractor.worker"
|
|
- name: aggregation
|
|
cmd: "python -m services.aggregation.worker"
|
|
- name: recommendation
|
|
cmd: "python -m services.recommendation.worker"
|
|
- name: risk
|
|
cmd: "uvicorn services.risk.app:app --host 0.0.0.0 --port 8000"
|
|
- name: broker-adapter
|
|
cmd: "python -m services.adapters.broker_adapter"
|
|
- name: lake-publisher
|
|
cmd: "python -m services.lake_publisher.worker"
|
|
- name: query-api
|
|
cmd: "uvicorn services.api.app:app --host 0.0.0.0 --port 8000"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build and push ${{ matrix.service.name }}
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: docker/Dockerfile
|
|
push: true
|
|
tags: |
|
|
${{ env.IMAGE_BASE }}/${{ matrix.service.name }}:${{ github.sha }}
|
|
${{ env.IMAGE_BASE }}/${{ matrix.service.name }}:latest
|
|
build-args: |
|
|
SERVICE_CMD=${{ matrix.service.cmd }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
build-dashboard:
|
|
needs: lint-and-test
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build and push dashboard
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: frontend
|
|
file: frontend/Dockerfile
|
|
push: true
|
|
tags: |
|
|
${{ env.IMAGE_BASE }}/dashboard:${{ github.sha }}
|
|
${{ env.IMAGE_BASE }}/dashboard:latest
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
build-superset:
|
|
needs: lint-and-test
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build and push superset
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: docker
|
|
file: docker/Dockerfile.superset
|
|
push: true
|
|
tags: |
|
|
${{ env.IMAGE_BASE }}/superset:${{ github.sha }}
|
|
${{ env.IMAGE_BASE }}/superset:latest
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|