Skip to content

Commit

Permalink
Adjust CI for uv and modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
CarloLepelaars committed Dec 2, 2024
1 parent 341c9ba commit f7c369c
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 44 deletions.
40 changes: 21 additions & 19 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,35 @@ on:
- main

jobs:
build:
coverage:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: '3.12'
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Create and activate virtual environment
run: |
uv venv
echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry config virtualenvs.create false --local
poetry install
- name: Run tests
uv pip install 'setuptools[pkg_resources]'
uv pip install -e ".[test]"
- name: Run tests with coverage
run: |
pytest -s --cov=blackscholes --cov-report term-missing --cov-config=.coveragerc --cov-report=xml
uv pip install pytest pytest-cov
pytest -s tests/ --cov=blackscholes --cov-report term-missing --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
directory: ./coverage/reports/
fail_ci_if_error: true
verbose: true
files: ./coverage.xml
fail_ci_if_error: false
verbose: true
25 changes: 19 additions & 6 deletions .github/workflows/deploy-mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,33 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'

- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Create and activate virtual environment
run: |
uv venv
echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
pip install poetry
poetry install
uv pip install 'setuptools[pkg_resources]'
uv pip install mkdocs mkdocs-material mkdocstrings mkdocstrings-python
- name: Install project
run: uv pip install -e .

- name: Build the MkDocs site
run: poetry run mkdocs build
run: mkdocs build

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
Expand Down
63 changes: 44 additions & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,51 @@
name: Tests
name: CI

on: [push, pull_request]
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']

python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry config virtualenvs.create false --local
poetry install
- name: Run tests
run: |
pytest -s --cov=blackscholes --cov-report term-missing --cov-config=.coveragerc
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Create and activate virtual environment
run: |
uv venv
echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
uv pip install 'setuptools[pkg_resources]'
uv pip install -e ".[test]"
- name: Run tests with coverage
run: |
uv pip install pytest-cov
pytest -s tests/ --cov=blackscholes --cov-report term-missing
- name: Build wheel
run: |
uv pip install build
python -m build --wheel
- name: Install built wheel
run: |
uv pip install dist/*.whl

0 comments on commit f7c369c

Please sign in to comment.