Dev knot #1675
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the action will run. | |
on: [push, pull_request] | |
# Older settings: | |
# Triggers the workflow on push request events for the master branch, | |
# and pull request events for all branches. | |
#on: | |
# push: | |
# branches: [ master ] | |
# pull_request: | |
# branches: [ '**' ] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ${{ matrix.os }} | |
env: | |
UV_CACHE_DIR: /tmp/.uv-cache | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
os: [ubuntu-latest, macos-latest] #, windows-latest] # Run macos tests if really required, since they charge 10 times more for macos | |
include: | |
- os: ubuntu-latest | |
path: ~/.cache/pip | |
- os: macos-latest | |
path: ~/Library/Caches/pip | |
#- os: windows-latest | |
# path: ~\AppData\Local\pip\Cache | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
defaults: | |
run: | |
shell: bash | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
# Ref: https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-python | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
uv-version: latest | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# You can test your matrix by printing the current Python version | |
- name: Display Python version | |
run: python -c "import sys; print(sys.version)" | |
# Set up cache | |
- name: Set up cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ matrix.path }} | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('uv.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('uv.lock') }} | |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} | |
# Install dependencies | |
- name: Install dependencies | |
run: | | |
make install-dev-deps | |
uv cache prune --ci | |
source .venv/bin/activate | |
# Runs a single command using the runners shell | |
- name: Welcome message | |
run: echo Hello, world! Welcome PyElastica Build, lets start testing! | |
# Run style checks (black and flake8) | |
- name: Run style checks | |
if: always() | |
run: | | |
make check-codestyle | |
# Test PyElastica using pytest | |
- name: Run tests | |
if: always() | |
run: | | |
make test | |
- name: Typechecking | |
if: ${{ startsWith(runner.os, 'macOS') }} | |
run: | | |
make mypy | |
report-coverage: # Report coverage from python 3.10 and mac-os. May change later | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
os: [macos-latest] | |
include: | |
- os: macos-latest | |
path: ~/Library/Caches/pip | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
uv-version: latest | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set up cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ matrix.path }} | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('uv.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('uv.lock') }} | |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} | |
- name: Install dependencies | |
run: | | |
make install-dev-deps | |
uv cache prune --ci | |
source .venv/bin/activate | |
- name: Test PyElastica using pytest | |
if: startsWith(runner.os, 'macOS') | |
run: | | |
make test_coverage_xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |