ci: Don't re-run CI for deploy

This commit is contained in:
Bu5hm4nn
2026-04-07 12:52:45 +02:00
parent b2bc4db41a
commit 4ca4752bfb
2 changed files with 39 additions and 102 deletions

View File

@@ -30,26 +30,6 @@ jobs:
- name: Run black - name: Run black
run: black --check app tests scripts run: black --check app tests scripts
test:
runs-on: [linux, docker]
container:
image: catthehacker/ubuntu:act-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
set -x
python -m pip install --upgrade pip
pip install pytest pytest-asyncio httpx
pip install nicegui fastapi uvicorn yfinance polars pandas pydantic pyyaml
pip list
- name: Run tests
run: pytest -v --tb=short
type-check: type-check:
runs-on: [linux, docker] runs-on: [linux, docker]
container: container:
@@ -70,5 +50,25 @@ jobs:
- name: Run mypy - name: Run mypy
run: | run: |
echo "Running mypy on core modules..." echo "Running mypy on core modules..."
mypy app/core app/models app/strategies app/services app/domain --ignore-missing-imports --show-error-codes --show-traceback mypy app/core app/models app/strategies app/services app/domain --show-error-codes --show-traceback
echo "Type check completed successfully" echo "Type check completed successfully"
test:
runs-on: [linux, docker]
container:
image: catthehacker/ubuntu:act-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
set -x
python -m pip install --upgrade pip
pip install pytest pytest-asyncio httpx
pip install nicegui fastapi uvicorn yfinance polars pandas pydantic pyyaml
pip list
- name: Run tests
run: pytest -v --tb=short

View File

@@ -1,98 +1,31 @@
name: Build and Deploy name: Build and Deploy
on: on:
push: workflow_run:
workflows: [CI]
types: [completed]
branches: [main] branches: [main]
workflow_dispatch: workflow_dispatch:
env: env:
REGISTRY: ${{ vars.REGISTRY || '10.100.0.2:3000' }} REGISTRY: ${{ vars.REGISTRY || '10.100.0.2:3000' }}
IMAGE_NAME: ${{ github.repository }} IMAGE_NAME: ${{ github.repository }}
RESOLVED_SHA: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}
RESOLVED_REF: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch || github.ref_name }}
jobs: jobs:
lint:
runs-on: [linux, docker]
container:
image: catthehacker/ubuntu:act-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff black
- name: Run ruff
run: ruff check app tests scripts
- name: Run black
run: black --check app tests scripts
test:
runs-on: [linux, docker]
container:
image: catthehacker/ubuntu:act-latest
env:
APP_ENV: test
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
set -x
python -m pip install --upgrade pip
pip install pytest pytest-asyncio httpx
pip install nicegui fastapi uvicorn yfinance polars pandas pydantic pyyaml databento
pip list
- name: Run tests
run: |
pytest \
tests/test_pricing.py \
tests/test_strategies.py \
tests/test_portfolio.py \
tests/test_turnstile.py \
tests/test_workspace.py \
tests/test_hedge_contract_count.py \
tests/test_backtest_settings.py \
-v --tb=short
type-check:
runs-on: [linux, docker]
container:
image: catthehacker/ubuntu:act-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
set -x
python -m pip install --upgrade pip
pip install mypy types-requests
pip install nicegui fastapi uvicorn yfinance polars pandas pydantic pyyaml databento
pip list
- name: Show working directory
run: pwd && ls -la
- name: Run mypy
run: |
echo "Running mypy on core modules..."
mypy app/core app/models app/strategies app/services app/domain --ignore-missing-imports --show-error-codes --show-traceback
echo "Type check completed successfully"
build: build:
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
runs-on: [linux, docker] runs-on: [linux, docker]
needs: [lint, test]
container: container:
image: catthehacker/ubuntu:act-latest image: catthehacker/ubuntu:act-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
ref: ${{ env.RESOLVED_SHA }}
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
@@ -115,14 +48,16 @@ jobs:
context: . context: .
push: true push: true
tags: | tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.RESOLVED_SHA }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
provenance: false provenance: false
deploy: deploy:
runs-on: [linux, docker] runs-on: [linux, docker]
needs: build needs: build
if: github.ref == 'refs/heads/main' if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main')
container: container:
image: catthehacker/ubuntu:act-latest image: catthehacker/ubuntu:act-latest
env: env:
@@ -131,7 +66,7 @@ jobs:
DEPLOY_PORT: ${{ vars.DEPLOY_PORT || '22' }} DEPLOY_PORT: ${{ vars.DEPLOY_PORT || '22' }}
DEPLOY_PATH: ${{ vars.DEPLOY_PATH || '/opt/vault-dash' }} DEPLOY_PATH: ${{ vars.DEPLOY_PATH || '/opt/vault-dash' }}
DEPLOY_SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }} DEPLOY_SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
APP_IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} APP_IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.RESOLVED_SHA }}
APP_ENV: production APP_ENV: production
APP_NAME: Vault Dashboard APP_NAME: Vault Dashboard
APP_PORT: "8000" APP_PORT: "8000"
@@ -140,6 +75,8 @@ jobs:
DATABENTO_API_KEY: ${{ secrets.DATABENTO_API_KEY }} DATABENTO_API_KEY: ${{ secrets.DATABENTO_API_KEY }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
ref: ${{ env.RESOLVED_SHA }}
- name: Install dependencies - name: Install dependencies
run: | run: |