Skip to content

Commit

Permalink
Migrate to pixi
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzw committed Aug 8, 2024
1 parent 2421147 commit 6e0566e
Show file tree
Hide file tree
Showing 17 changed files with 18,176 additions and 2,315 deletions.
10 changes: 0 additions & 10 deletions .flake8

This file was deleted.

1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

*.{py,yaml,yml,sh} text eol=lf
*.bat text eol=crlf
pixi.lock linguist-language=YAML linguist-generated=true
29 changes: 0 additions & 29 deletions .github/actions/setup/action.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/actions/test/action.yml

This file was deleted.

12 changes: 7 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: github-actions
directory: /
schedule:
interval: "weekly"
reviewers:
- "quantco/ci"
interval: monthly
groups:
gh-actions:
patterns:
- "*"
File renamed without changes.
52 changes: 38 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,54 @@ name: Release

on:
push:
branches:
- main
tags:
- '*.*.*'
pull_request:

jobs:
release:
name: 'Build and Release on PyPi'
build:
name: Build Package
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup
- name: Set up pixi
uses: prefix-dev/setup[email protected]
with:
python-version: '3.11'
environments: release

- name: Build
run: poetry build
run: pixi run -e release hatch build

- name: Check distributions
run: ls -la dist
- name: List files
run: ls -l dist/

- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: artifact
path: dist/*

release:
name: Publish Package
if: startsWith(github.ref, 'refs/tags/')
needs: [build]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
environment: pypi
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- name: Publish package on TestPyPi
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish package on PyPi
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0
60 changes: 33 additions & 27 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,56 +13,62 @@ on:
- '**'

jobs:

Linting:
name: "Linting - pre-commit hooks - Python 3.9"
lint:
name: Pre-commit Checks
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 10
steps:
- name: Checkout branch
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Python 3.9
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.9

- name: Linting - Run pre-commit checks
uses: pre-commit/[email protected].0
uses: pre-commit/[email protected].1

Tests:
name: "${{ matrix.os }} / ${{ matrix.python-version }}"
runs-on: ${{ matrix.os }}-latest
test:
name: pytest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [Ubuntu]
python-version: ['3.9', '3.10', '3.11']
os:
- ubuntu-latest
environment:
- py39
- py310
- py311
- py312ibmdb
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup
- name: Setup Pixi
uses: prefix-dev/setup[email protected]
with:
python-version: ${{ matrix.python-version }}
poetry-flags: --all-extras --with=tests
environments: ${{ matrix.environment }}

- name: Start Docker Compose
uses: isbang/compose-action@v1.4.1
uses: isbang/compose-action@e5813a5909aca4ae36058edae58f6e52b9c971f8
with:
compose-file: ./docker-compose.yaml
compose-file: docker-compose.yaml

- name: Install Microsoft ODBC
run: sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18

- name: Wait for Docker Servers
timeout-minutes: 1
shell: bash
run: |
until bash ./.github/workflows/resources/docker_compose_ready.sh; do
sleep 2
until bash ./.github/scripts/docker_compose_ready.sh; do
sleep 1
done
- name: Run Tests
uses: ./.github/actions/test
with:
arguments: --postgres --mssql
- name: Run tests
env:
SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }}
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_USER }}
run: |
pixi run -e ${{ matrix.environment }} pytest tests -ra ${RUNNER_DEBUG:+-v} --color=yes --workers=4 --postgres --mssql
36 changes: 36 additions & 0 deletions .github/workflows/update-lockfiles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Update lockfiles

permissions:
contents: write
pull-requests: write

on:
workflow_dispatch:
schedule:
- cron: 0 5 1 * *

jobs:
pixi-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up pixi
uses: prefix-dev/[email protected]
with:
run-install: false
- name: Update lockfiles
run: |
set -euo pipefail
pixi update --json --no-install | pixi exec pixi-diff-to-markdown >> diff.md
- name: Create pull request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update pixi lockfile
title: Update pixi lockfile
body-path: diff.md
branch: update-pixi
base: main
labels: pixi
delete-branch: true
add-paths: pixi.lock
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,6 @@ mlruns

# direnv
.envrc
# pixi environments
.pixi
*.egg-info
14 changes: 2 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
language_version: python3.9
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.270
rev: v0.5.7
hooks:
- id: ruff
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args:
- --py39-plus
- id: ruff-format
23 changes: 9 additions & 14 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,16 @@
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"
jobs:
post_create_environment:
- pip install poetry
post_install:
# Install dependencies with 'docs' dependency group
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
# VIRTUAL_ENV needs to be set manually for now.
# See https://github.com/readthedocs/readthedocs.org/pull/11152/
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs

python: mambaforge-latest
commands:
- mamba install -c conda-forge -c nodefaults pixi
- pixi run -e docs postinstall
- pixi run -e docs docs
- pixi run -e docs readthedocs
sphinx:
builder: html
configuration: docs/source/conf.py
configuration: docs/source/conf.py
formats:
- pdf
Loading

0 comments on commit 6e0566e

Please sign in to comment.