diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..92bf028 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,354 @@ +# Woodpecker CI pipeline for Stonks Oracle +# Translates .github/workflows/build.yml into Woodpecker native format +# Images push to registry.celestium.life/stonks-oracle/: and :latest + +steps: + lint-python: + image: python:3.12-slim + commands: + - pip install ruff==0.15.10 --quiet + - ruff check services/ + + test-python: + image: python:3.12-slim + commands: + - pip install -r requirements.txt --quiet + - pytest tests/ -x --tb=short -q + + test-frontend: + image: node:24-slim + commands: + - cd frontend + - npm ci + - npx vitest --run + + build-scheduler: + image: woodpeckerci/plugin-docker-buildx + privileged: true + settings: + repo: registry.celestium.life/stonks-oracle/scheduler + registry: registry.celestium.life + tags: + - ${CI_COMMIT_SHA} + - latest + dockerfile: docker/Dockerfile + context: . + build_args: + - SERVICE_CMD=python -m services.scheduler.app + when: + event: push + branch: main + depends_on: + - lint-python + - test-python + - test-frontend + + build-symbol-registry: + image: woodpeckerci/plugin-docker-buildx + privileged: true + settings: + repo: registry.celestium.life/stonks-oracle/symbol-registry + registry: registry.celestium.life + tags: + - ${CI_COMMIT_SHA} + - latest + dockerfile: docker/Dockerfile + context: . + build_args: + - SERVICE_CMD=uvicorn services.symbol_registry.app:app --host 0.0.0.0 --port 8000 + when: + event: push + branch: main + depends_on: + - lint-python + - test-python + - test-frontend + + build-ingestion: + image: woodpeckerci/plugin-docker-buildx + privileged: true + settings: + repo: registry.celestium.life/stonks-oracle/ingestion + registry: registry.celestium.life + tags: + - ${CI_COMMIT_SHA} + - latest + dockerfile: docker/Dockerfile + context: . + build_args: + - SERVICE_CMD=python -m services.ingestion.worker + when: + event: push + branch: main + depends_on: + - lint-python + - test-python + - test-frontend + + build-parser: + image: woodpeckerci/plugin-docker-buildx + privileged: true + settings: + repo: registry.celestium.life/stonks-oracle/parser + registry: registry.celestium.life + tags: + - ${CI_COMMIT_SHA} + - latest + dockerfile: docker/Dockerfile + context: . + build_args: + - SERVICE_CMD=python -m services.parser.worker + when: + event: push + branch: main + depends_on: + - lint-python + - test-python + - test-frontend + + build-extractor: + image: woodpeckerci/plugin-docker-buildx + privileged: true + settings: + repo: registry.celestium.life/stonks-oracle/extractor + registry: registry.celestium.life + tags: + - ${CI_COMMIT_SHA} + - latest + dockerfile: docker/Dockerfile + context: . + build_args: + - SERVICE_CMD=python -m services.extractor.worker + when: + event: push + branch: main + depends_on: + - lint-python + - test-python + - test-frontend + + build-aggregation: + image: woodpeckerci/plugin-docker-buildx + privileged: true + settings: + repo: registry.celestium.life/stonks-oracle/aggregation + registry: registry.celestium.life + tags: + - ${CI_COMMIT_SHA} + - latest + dockerfile: docker/Dockerfile + context: . + build_args: + - SERVICE_CMD=python -m services.aggregation.worker + when: + event: push + branch: main + depends_on: + - lint-python + - test-python + - test-frontend + + build-recommendation: + image: woodpeckerci/plugin-docker-buildx + privileged: true + settings: + repo: registry.celestium.life/stonks-oracle/recommendation + registry: registry.celestium.life + tags: + - ${CI_COMMIT_SHA} + - latest + dockerfile: docker/Dockerfile + context: . + build_args: + - SERVICE_CMD=python -m services.recommendation.worker + when: + event: push + branch: main + depends_on: + - lint-python + - test-python + - test-frontend + + build-risk: + image: woodpeckerci/plugin-docker-buildx + privileged: true + settings: + repo: registry.celestium.life/stonks-oracle/risk + registry: registry.celestium.life + tags: + - ${CI_COMMIT_SHA} + - latest + dockerfile: docker/Dockerfile + context: . + build_args: + - SERVICE_CMD=uvicorn services.risk.app:app --host 0.0.0.0 --port 8000 + when: + event: push + branch: main + depends_on: + - lint-python + - test-python + - test-frontend + + build-broker-adapter: + image: woodpeckerci/plugin-docker-buildx + privileged: true + settings: + repo: registry.celestium.life/stonks-oracle/broker-adapter + registry: registry.celestium.life + tags: + - ${CI_COMMIT_SHA} + - latest + dockerfile: docker/Dockerfile + context: . + build_args: + - SERVICE_CMD=python -m services.adapters.broker_adapter + when: + event: push + branch: main + depends_on: + - lint-python + - test-python + - test-frontend + + build-lake-publisher: + image: woodpeckerci/plugin-docker-buildx + privileged: true + settings: + repo: registry.celestium.life/stonks-oracle/lake-publisher + registry: registry.celestium.life + tags: + - ${CI_COMMIT_SHA} + - latest + dockerfile: docker/Dockerfile + context: . + build_args: + - SERVICE_CMD=python -m services.lake_publisher.worker + when: + event: push + branch: main + depends_on: + - lint-python + - test-python + - test-frontend + + build-query-api: + image: woodpeckerci/plugin-docker-buildx + privileged: true + settings: + repo: registry.celestium.life/stonks-oracle/query-api + registry: registry.celestium.life + tags: + - ${CI_COMMIT_SHA} + - latest + dockerfile: docker/Dockerfile + context: . + build_args: + - SERVICE_CMD=uvicorn services.api.app:app --host 0.0.0.0 --port 8000 + when: + event: push + branch: main + depends_on: + - lint-python + - test-python + - test-frontend + + build-trading-engine: + image: woodpeckerci/plugin-docker-buildx + privileged: true + settings: + repo: registry.celestium.life/stonks-oracle/trading-engine + registry: registry.celestium.life + tags: + - ${CI_COMMIT_SHA} + - latest + dockerfile: docker/Dockerfile + context: . + build_args: + - SERVICE_CMD=uvicorn services.trading.app:app --host 0.0.0.0 --port 8000 + when: + event: push + branch: main + depends_on: + - lint-python + - test-python + - test-frontend + + build-dashboard: + image: woodpeckerci/plugin-docker-buildx + privileged: true + settings: + repo: registry.celestium.life/stonks-oracle/dashboard + registry: registry.celestium.life + tags: + - ${CI_COMMIT_SHA} + - latest + dockerfile: frontend/Dockerfile + context: frontend + when: + event: push + branch: main + depends_on: + - lint-python + - test-python + - test-frontend + + build-superset: + image: woodpeckerci/plugin-docker-buildx + privileged: true + settings: + repo: registry.celestium.life/stonks-oracle/superset + registry: registry.celestium.life + tags: + - ${CI_COMMIT_SHA} + - latest + dockerfile: docker/Dockerfile.superset + context: docker + when: + event: push + branch: main + depends_on: + - lint-python + - test-python + - test-frontend + + integration-test: + image: alpine/k8s:1.30.2 + commands: + - bash infra/inttest/run_pipeline.sh --image-tag ${CI_COMMIT_SHA} --results-file inttest-results.json + when: + event: push + branch: main + depends_on: + - build-scheduler + - build-symbol-registry + - build-ingestion + - build-parser + - build-extractor + - build-aggregation + - build-recommendation + - build-risk + - build-broker-adapter + - build-lake-publisher + - build-query-api + - build-trading-engine + - build-dashboard + - build-superset + + mirror-github: + image: alpine/git + commands: + - mkdir -p ~/.ssh + - echo "$GITHUB_SSH_KEY" > ~/.ssh/id_ed25519 + - chmod 600 ~/.ssh/id_ed25519 + - ssh-keyscan github.com >> ~/.ssh/known_hosts + - git remote add github git@github.com:celesrenata/stonks-oracle.git || git remote set-url github git@github.com:celesrenata/stonks-oracle.git + - git push github main --force + - git push github --tags --force + secrets: + - github_ssh_key + when: + event: push + branch: main + depends_on: + - integration-test