Skip to content

Commit

Permalink
Switch to pixi with multi-env support (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzw authored Feb 1, 2024
1 parent 9085b9a commit f656456
Show file tree
Hide file tree
Showing 5 changed files with 15,311 additions and 11,982 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up conda env
uses: mamba-org/setup-micromamba@v1
uses: prefix-dev/setup-[email protected]
with:
environment-file: environment-deprecated.yml
cache-environment: true
create-args: python=3.11
environments: py312
- name: Install repository
run: python -m pip install --no-build-isolation --no-deps --disable-pip-version-check -e .
shell: bash -el {0}
run: pixi run -e py312 postinstall
- name: Cache models
uses: actions/cache@v3
env:
Expand All @@ -30,13 +27,12 @@ jobs:
path: examples/benchmark_models
key: models-${{ hashFiles('benchmark.py', '.github/workflows/benchmark.yml') }}
- name: Run benchmark
shell: bash -el {0}
run: |
python benchmark.py
echo "_(benchmark **${{ github.run_id }}** / attempt **${{ github.run_attempt }}**)_" >> result.md
cat benchmark.md >> result.md
shell: pixi run -e py312 bash {0}
- name: Comment on PR
# thollander/actions-comment-pull-request is not whitelisted
uses: actions/github-script@v7
if: github.event_name == 'pull_request'
with:
Expand Down
87 changes: 26 additions & 61 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,88 +8,53 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -el {0}

jobs:
linux-unittests:
name: >-
Unit tests - Python ${{ matrix.PYTHON_VERSION }}
${{ matrix.SKLEARN_VERSION }}${{ matrix.LGBM_VERSION }}
name: Unit tests - ${{ matrix.env }}
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { PYTHON_VERSION: '3.8', SKLEARN_VERSION: 'scikit-learn=1.1', LGBM_VERSION: '' }
- { PYTHON_VERSION: '3.8', SKLEARN_VERSION: 'scikit-learn=1.2', LGBM_VERSION: '' }
- { PYTHON_VERSION: '3.8', SKLEARN_VERSION: 'scikit-learn=1.3', LGBM_VERSION: '' }
- { PYTHON_VERSION: '3.8', SKLEARN_VERSION: '', LGBM_VERSION: 'lightgbm=3.2' }
- { PYTHON_VERSION: '3.8', SKLEARN_VERSION: '', LGBM_VERSION: 'lightgbm=3.3' }
- { PYTHON_VERSION: '3.8', SKLEARN_VERSION: '', LGBM_VERSION: 'lightgbm=4.0' }
- { PYTHON_VERSION: '3.8', SKLEARN_VERSION: '', LGBM_VERSION: 'lightgbm=4.1' }
- { PYTHON_VERSION: '3.8', SKLEARN_VERSION: '', LGBM_VERSION: 'lightgbm=4.2' }
- { PYTHON_VERSION: '3.8', SKLEARN_VERSION: '', LGBM_VERSION: 'lightgbm=4.3' }
- { PYTHON_VERSION: '3.8', SKLEARN_VERSION: '', LGBM_VERSION: '' }
- { PYTHON_VERSION: '3.9', SKLEARN_VERSION: '', LGBM_VERSION: '' }
- { PYTHON_VERSION: '3.10', SKLEARN_VERSION: '', LGBM_VERSION: '' }
- { PYTHON_VERSION: '3.11', SKLEARN_VERSION: '', LGBM_VERSION: '' }
- { PYTHON_VERSION: '3.12', SKLEARN_VERSION: '', LGBM_VERSION: '' }
env:
- skl11
- skl12
- skl13
- lgbm32
- lgbm33
- lgbm40
- lgbm41
- lgbm42
- lgbm43
- py38
- py39
- py310
- py311
- py312
steps:
- uses: actions/checkout@v4
- name: Set up conda env
uses: mamba-org/setup-micromamba@v1
- name: Set up pixi
uses: prefix-dev/setup-[email protected]
with:
cache-environment: true
environment-file: environment-deprecated.yml
create-args: >-
python=${{ matrix.PYTHON_VERSION }}
pytest-md
pytest-emoji
${{ matrix.SKLEARN_VERSION }}${{ matrix.LGBM_VERSION }}
environments: ${{ matrix.env }}
- name: Install repository
run: python -m pip install --no-build-isolation --no-deps --disable-pip-version-check -e .
- name: Run unittests
uses: pavelzw/pytest-action@v2
with:
custom-arguments: ${{ matrix.SKLEARN_VERSION != '' && '-k sklearn' || '' }}${{ matrix.LGBM_VERSION != '' && ' -k lgbm' || '' }}
report-title: >-
Unit tests - Python ${{ matrix.PYTHON_VERSION }}
${{ matrix.SKLEARN_VERSION }}${{ matrix.LGBM_VERSION }}
linux-unittests-pixi:
name: Unit tests Pixi
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
- name: Install environment
run: |
pixi run postinstall
run: pixi run -e ${{ matrix.env }} postinstall
- name: Run unittests
uses: pavelzw/pytest-action@v2
with:
custom-pytest: pixi run test
report-title: Unit tests Linux Pixi
custom-pytest: pixi run -e ${{ matrix.env }} test
report-title: Unit tests - ${{ matrix.env }}

pre-commit: # todo switch to pre-commit.ci
name: "Pre-commit checks"
pre-commit:
name: pre-commit checks
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Install Python 3.11
uses: actions/setup-python@v5
- uses: quantco/pre-commit-conda@v1
with:
python-version: 3.11
- name: Run pre-commit checks
uses: pre-commit/[email protected]
python-version: '3.8'

lint-workflow-files:
name: "Lint workflow files"
Expand Down
14 changes: 0 additions & 14 deletions environment-deprecated.yml

This file was deleted.

Loading

0 comments on commit f656456

Please sign in to comment.