Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 58 additions & 67 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,32 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Install build tools
run: |
sudo apt-get update
sudo apt-get install -y build-essential

- name: Set up Python
id: setup-python
uses: actions/setup-python@v6
with:
python-version: 3.12

- name: Cache Poetry installation
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -

- name: Cache dependencies

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Cache uv
uses: actions/cache@v4
with:
path: |
~/.cache/pypoetry
.venv
key: poetry-deps-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
path: ~/.cache/uv
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
poetry-deps-${{ runner.os }}-
uv-${{ runner.os }}-

- name: Install dependencies
run: poetry install --with dev
run: uv sync --all-groups

- name: Cache Rust build
uses: actions/cache@v4
with:
Expand All @@ -59,10 +50,10 @@ jobs:
key: rust-build-${{ runner.os }}-${{ hashFiles('smartscore/Rust/make_predictions/Cargo.lock') }}
restore-keys: |
rust-build-${{ runner.os }}-

- name: Compile Rust code
run: make compile

- name: Upload build artifacts
uses: actions/upload-artifact@v5
with:
Expand All @@ -80,33 +71,31 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ needs.setup.outputs.python-version }}

- name: Cache Poetry installation
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Cache dependencies

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Cache uv
uses: actions/cache@v4
with:
path: |
~/.cache/pypoetry
.venv
key: poetry-deps-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

path: ~/.cache/uv
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}

- name: Install dependencies
run: uv sync --all-groups

- name: Download build artifacts
uses: actions/download-artifact@v6
with:
name: build-artifacts

- name: Run lint
run: poetry run make lint
run: uv run make lint

test:
needs: setup
Expand All @@ -115,30 +104,35 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ needs.setup.outputs.python-version }}

- name: Cache Poetry installation

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Cache uv
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Cache dependencies
path: ~/.cache/uv
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}

- name: Install dependencies
run: uv sync --all-groups

- name: Cache Rust build
uses: actions/cache@v4
with:
path: |
~/.cache/pypoetry
.venv
key: poetry-deps-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Download build artifacts
uses: actions/download-artifact@v6
with:
name: build-artifacts
smartscore/Rust/make_predictions/target
key: rust-build-${{ runner.os }}-${{ hashFiles('smartscore/Rust/make_predictions/Cargo.lock') }}
restore-keys: |
rust-build-${{ runner.os }}-

- name: Compile Rust code
run: make compile_rust

- name: Run tests
run: make test
Expand Down Expand Up @@ -167,19 +161,18 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y build-essential # Install gcc and make

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.12

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install dependencies
run: poetry install --no-root
run: uv sync --no-dev

- name: Set environment variables
run: |
echo "SUPABASE_URL=${{ secrets.SUPABASE_URL }}" >> $GITHUB_ENV
Expand All @@ -199,7 +192,6 @@ jobs:
aws-region: us-east-1
- name: Run deploy script
run: |
export PATH="$HOME/.local/bin:$PATH"
chmod +x build_scripts/deploy.sh
./build_scripts/deploy.sh
env:
Expand Down Expand Up @@ -227,12 +219,11 @@ jobs:
with:
python-version: 3.12

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install dependencies
run: poetry install --no-root
run: uv sync --all-groups

- name: Set environment variables
run: |
Expand All @@ -249,4 +240,4 @@ jobs:
aws-region: us-east-1

- name: Run dev integration tests (mocked NHL)
run: make integration
run: make integration
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ smartscore/Rust/weight_optimizer/target/*
.env
node_modules
.venv
.poetry
.pytest_cache
.ruff_cache
output
Expand Down
12 changes: 4 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@ default_language_version:
python: python3.12

repos:
- repo: https://github.com/python-poetry/poetry
rev: '2.0.1'
hooks:
- id: poetry-check
- repo: local
hooks:
- id: static-analysis
name: ruff-linter
entry: poetry run ruff check
entry: uv run ruff check
language: system
types:
- python
Expand All @@ -20,7 +16,7 @@ repos:
pass_filenames: false
- id: format
name: ruff-format
entry: poetry run ruff format
entry: uv run ruff format
language: system
types:
- python
Expand All @@ -29,7 +25,7 @@ repos:
pass_filenames: false
- id: asl-lint
name: asl-lint
entry: poetry run statelint
entry: uv run statelint
language: system
types: [json]
files: ^templates/.*\.asl\.json$
files: ^templates/.*\.asl\.json$
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
local-setup:
@echo Creating virtual environment
@poetry env activate
@uv sync
@$(MAKE) install

install:
@echo Installing all dev dependencies
@poetry install --with dev
@uv sync --all-groups

check-ci:
@echo "Checking CI configuration"
Expand All @@ -15,19 +15,19 @@ check-ci:

lint:
@echo "Linting code"
@poetry run pre-commit run -a
@uv run pre-commit run -a

test:
@echo "Running tests with coverage"
@poetry run pytest -v --cov=smartscore --cov-report=term-missing --cov-report=html
@uv run pytest -v --cov=smartscore --cov-report=term-missing --cov-report=html

test-no-cov:
@echo "Running tests without coverage"
@poetry run pytest -v
@uv run pytest -v

integration:
@echo "Running AWS-dev integration tests with mocked NHL data"
@poetry run pytest -v tests/integration
@uv run pytest -v tests/integration

compile:
@$(MAKE) compile_rust
Expand All @@ -39,12 +39,12 @@ compile_c:

compile_rust:
@echo "Compiling Rust code"
@poetry run maturin develop -r --manifest-path smartscore/Rust/make_predictions/Cargo.toml
@uv run maturin develop -r --manifest-path smartscore/Rust/make_predictions/Cargo.toml

get_odds:
@echo "Getting odds"
@ENV=prod poetry run python smartscore/scripts/get_odds.py
@ENV=prod uv run python smartscore/scripts/get_odds.py

watch_live:
@echo "Running live"
@poetry run python smartscore/scripts/live_updates.py
@uv run python smartscore/scripts/live_updates.py
12 changes: 10 additions & 2 deletions build_scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,16 @@ mkdir -p $OUTPUT_DIR

# update dependencies
echo "Updating dependencies..."
poetry export -f requirements.txt --output $OUTPUT_DIR/requirements.txt --without-hashes
poetry run pip install --no-deps -r $OUTPUT_DIR/requirements.txt -t $OUTPUT_DIR
uv export --no-dev --format requirements-txt --output-file $OUTPUT_DIR/requirements.txt --no-hashes
if [ $? -ne 0 ]; then
echo "Error: Dependency export failed."
exit 1
fi
uv run pip install --no-deps -r $OUTPUT_DIR/requirements.txt -t $OUTPUT_DIR
if [ $? -ne 0 ]; then
echo "Error: Dependency install failed."
exit 1
fi
rm -f $OUTPUT_DIR/requirements.txt

# compile C code
Expand Down
Loading
Loading