Skip to content

Commit

Permalink
MNT: update actions; add min version test
Browse files Browse the repository at this point in the history
  • Loading branch information
theOehrly committed Dec 23, 2023
1 parent 575bf92 commit 1397fca
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 58 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-cache-${{ hashFiles('requirements/*/*.txt') }}
key: pip-cache-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
pip-cache
- name: Install python requirements
run: |
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install -r requirements-dev.txt
python -m pip install --upgrade pip
python -m pip install --upgrade build setuptools twine
python -m pip install -r requirements/dev.txt
- name: Create cache directory
run: |
Expand All @@ -51,7 +52,7 @@ jobs:
- name: Install Fast-F1 from sources
run: |
python3 -m pip install -e .
python -m pip install -e .
- name: Create doc build dir
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade build twine
python -m pip install --upgrade build setuptools twine
# if this is a release, upload to PyPI
- name: Build and publish release
Expand Down
83 changes: 34 additions & 49 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,18 @@ jobs:
run-code-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12']
name: Tests on ${{ matrix.python-version }}
include:
- name-suffix: "(Minimum Versions)"
python-version: "3.8"
extra-requirements: "-c requirements/minver.txt"
- python-version: "3.8"
- python-version: "3.9"
- python-version: "3.10"
- python-version: "3.11"
- python-version: "3.12"
name: Tests on ${{ matrix.python-version }} ${{ matrix.name-suffix }}
steps:
- name: Setup python
uses: actions/setup-python@v4
Expand All @@ -28,14 +37,15 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-cache-${{ hashFiles('requirements/*/*.txt') }}
key: pip-cache-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
pip-cache
- name: Install python requirements
run: |
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install -r requirements-dev.txt
python -m pip install --upgrade pip
python -m pip install --upgrade build setuptools twine
python -m pip install -r requirements/dev.txt ${{ matrix.extra-requirements }}
- name: Install Fast-F1 from sources
run: |
Expand All @@ -57,14 +67,15 @@ jobs:
run: |
pytest -ra
run-lint-checks:
runs-on: ubuntu-latest
name: Linting Ruff
name: Linting (Ruff)
steps:
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.12'

- name: Checkout repo
uses: actions/checkout@v3
Expand All @@ -73,18 +84,19 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-cache-${{ hashFiles('requirements/*/*.txt') }}
key: pip-cache-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
pip-cache
- name: Install python requirements
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements-dev.txt
python -m pip install --upgrade pip
python -m pip install --upgrade build setuptools twine
python -m pip install -r requirements/dev.txt
- name: Install Fast-F1 from sources
- name: Install FastF1 from sources
run: |
python3 -m pip install -e .
python -m pip install -e .
- name: Run tests
if: ${{ github.ref != 'refs/heads/master' }}
Expand All @@ -94,53 +106,26 @@ jobs:
# ruff with default config
ruff check .
- name: Run tests (master push)
if: ${{ github.ref == 'refs/heads/master' && env.GITHUB_EVENT_NAME == 'push'}}
env:
LAST_PUSH_SHA: ${{ github.event.before }}
run: |
mkdir test_cache # make sure cache dir exists
git fetch origin --quiet
# flake8 with default config
flake8 fastf1 examples scripts
# flake8 check new shorter line length only on diff
echo "Flake8 line length check on diff against $LAST_PUSH_SHA"
git diff $LAST_PUSH_SHA -U0 --relative | flake8 --max-line-length 79 --diff --select E501 fastf1 examples scripts
run-readme-render-test:
name: Test readme renders on PyPi
runs-on: ubuntu-latest
steps:
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Checkout repo
uses: actions/checkout@v3

- name: Cache pip
uses: actions/cache@v3
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
path: ~/.cache/pip
key: pip-cache-${{ hashFiles('requirements/*/*.txt') }}
restore-keys: |
pip-cache
- name: Install python requirements
python-version: '3.12'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install -r requirements-dev.txt
python -m pip install --upgrade pip
python -m pip install --upgrade build setuptools twine
- name: Install Fast-F1 from sources
- name: Build release and check long form description
run: |
python3 -m pip install -e .
python -m build
twine check dist/*
- name: Run tests
run: |
mkdir test_cache # not really need but pytest setup relies on it
pytest -rf --prj-doc
run-sphinx-build-test:
name: Test Docs
Expand Down
14 changes: 11 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ readme = "README.md"

license = { file = "LICENSE" }

# minimum python version additionally needs to be changed in the test matrix
requires-python = ">=3.8"
# minimum package versions additionally need to be changed in requirement/minver.txt
dependencies = [
"matplotlib>=3.4.2,<4.0.0",
"numpy>=1.20.3,<2.0.0",
"numpy>=1.22.0,<2.0.0",
"pandas>=1.2.4,<2.1.0",
"python-dateutil",
"requests>=2.28.0",
"requests>=2.28.1",
"requests-cache>=0.8.0",
"scipy>=1.6.3,<2.0.0",
"thefuzz",
"timple>=0.1.6",
"websockets>=8.1",
"websockets>=10.3",
]

[project.urls]
Expand All @@ -33,6 +35,12 @@ dependencies = [
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = [""]
include = ["fastf1*"]
exclude = ["fastf1/testing*"]
namespaces = false

[tool.setuptools_scm]

[tool.ruff]
Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions requirements/minver.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
matplotlib==3.4.2
numpy==1.20.3
pandas==1.2.4
requests==2.28.1
requests-cache==0.8.0
scipy==1.6.3
timple==0.1.6
websockets==10.3

0 comments on commit 1397fca

Please sign in to comment.