Skip to content

Merge branch 'feature/neural_thompson_sampling' into 'main' #394

Merge branch 'feature/neural_thompson_sampling' into 'main'

Merge branch 'feature/neural_thompson_sampling' into 'main' #394

Workflow file for this run

name: CI Pipeline
# Controls when the workflow will run
on:
# Triggers the workflow on push and pull request events but only for the main branch
push:
branches: [main]
pull_request:
branches: [main, refactoring]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
static_tests:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install full package
run: |
python -m venv venv
. ./venv/bin/activate
pip install --upgrade pip wheel poetry==1.5.1 lightfm==1.17
poetry cache clear pypi --all
./poetry_wrapper.sh --experimental install --all-extras
- name: ruff
run: |
. ./venv/bin/activate
./poetry_wrapper.sh --generate
ruff check .
- name: black
run: |
. ./venv/bin/activate
./poetry_wrapper.sh --generate
black --check --diff -- .
- name: poetry-check
run: |
. ./venv/bin/activate
./poetry_wrapper.sh check
./poetry_wrapper.sh --experimental check
- name: toml-sort
run: |
. ./venv/bin/activate
./poetry_wrapper.sh --generate
toml-sort --check pyproject.toml
./poetry_wrapper.sh --experimental --generate
toml-sort --check pyproject.toml
pytest_core:
needs: static_tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install core package
run: |
python -m venv venv
. ./venv/bin/activate
pip install --upgrade pip wheel poetry==1.5.1
./poetry_wrapper.sh install
- name: pytest
run: |
. ./venv/bin/activate
pytest -m core tests/ --ignore=tests/experimental
mv .coverage coverage_core_${{ matrix.python-version }}
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage_core_${{ matrix.python-version }}
path: coverage_core_${{ matrix.python-version }}
pytest_torch:
needs: static_tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install torch package
run: |
python -m venv venv
. ./venv/bin/activate
pip install --upgrade pip wheel poetry==1.5.1
./poetry_wrapper.sh install -E torch
- name: pytest
run: |
. ./venv/bin/activate
pytest -m "not spark and not experimental" tests/ --ignore=tests/experimental
mv .coverage coverage_torch_${{ matrix.python-version }}
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage_torch_${{ matrix.python-version }}
path: coverage_torch_${{ matrix.python-version }}
pytest_spark:
needs: static_tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install spark package
run: |
python -m venv venv
. ./venv/bin/activate
pip install --upgrade pip wheel poetry==1.5.1
./poetry_wrapper.sh install -E spark
- name: pytest
run: |
. ./venv/bin/activate
pytest -m "not torch and not experimental" tests/ --ignore=tests/experimental --ignore=tests/models
mv .coverage coverage_spark_${{ matrix.python-version }}
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage_spark_${{ matrix.python-version }}
path: coverage_spark_${{ matrix.python-version }}
pytest_spark_torch:
needs: static_tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install full package
run: |
python -m venv venv
. ./venv/bin/activate
pip install --upgrade pip wheel poetry==1.5.1
./poetry_wrapper.sh install --all-extras
- name: pytest
run: |
. ./venv/bin/activate
pytest -m "not experimental" --ignore=replay/experimental --ignore=tests/experimental --ignore=tests/models
mv .coverage coverage_spark_and_torch_${{ matrix.python-version }}
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage_spark_and_torch_${{ matrix.python-version }}
path: coverage_spark_and_torch_${{ matrix.python-version }}
pytest_experimental:
needs: static_tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install experimental package
run: |
python -m venv venv
. ./venv/bin/activate
pip install --upgrade pip wheel poetry==1.5.1
pip install --upgrade --no-use-pep517 lightfm==1.17
./poetry_wrapper.sh --experimental install --all-extras
- name: pytest
run: |
. ./venv/bin/activate
pytest -m "experimental"
mv .coverage coverage_experimental_${{ matrix.python-version }}
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage_experimental_${{ matrix.python-version }}
path: coverage_experimental_${{ matrix.python-version }}
pytest_models:
needs: static_tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install full package
run: |
python -m venv venv
. ./venv/bin/activate
pip install --upgrade pip wheel poetry==1.5.1
./poetry_wrapper.sh install --all-extras
- name: pytest
run: |
. ./venv/bin/activate
pytest -m "not experimental" tests/models --ignore=replay/experimental --ignore=tests/experimental
mv .coverage coverage_models_${{ matrix.python-version }}
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage_models_${{ matrix.python-version }}
path: coverage_models_${{ matrix.python-version }}
merge_coverage:
needs: [pytest_core, pytest_torch, pytest_spark, pytest_spark_torch, pytest_models, pytest_experimental]
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install only dev package
run: |
python -m venv venv
. ./venv/bin/activate
pip install --upgrade pip wheel poetry==1.5.1 poetry-dynamic-versioning
./poetry_wrapper.sh install --only dev
- name: Download coverage reports
uses: actions/download-artifact@v4
with:
pattern: coverage_*
merge-multiple: true
- name: Combine coverage
run: |
. ./venv/bin/activate
coverage combine coverage_core_${{ matrix.python-version }} coverage_torch_${{ matrix.python-version }} coverage_spark_${{ matrix.python-version }} coverage_spark_and_torch_${{ matrix.python-version }} coverage_models_${{ matrix.python-version }} coverage_experimental_${{ matrix.python-version }}
coverage report --fail-under=100
coverage xml
build_production:
needs: merge_coverage
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install production package
run: |
python -m venv venv
. ./venv/bin/activate
pip install --upgrade pip wheel poetry==1.5.1 poetry-dynamic-versioning
./poetry_wrapper.sh install --all-extras
- name: Build
run: |
. ./venv/bin/activate
export PACKAGE_SUFFIX=.dev
./poetry_wrapper.sh build
build_experimental:
needs: merge_coverage
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install full package
run: |
python -m venv venv
. ./venv/bin/activate
pip install --upgrade pip wheel poetry==1.5.1 poetry-dynamic-versioning lightfm==1.17
./poetry_wrapper.sh --experimental install --all-extras
- name: Build
run: |
. ./venv/bin/activate
export PACKAGE_SUFFIX=.preview
./poetry_wrapper.sh --experimental build