From d9a884a75df602fa3eaf02a312f3a82c164abde2 Mon Sep 17 00:00:00 2001 From: theOehrly <23384863+theOehrly@users.noreply.github.com> Date: Sat, 23 Dec 2023 18:46:43 +0100 Subject: [PATCH] MNT: update actions; add min version test --- .github/workflows/docs.yml | 6 +-- .github/workflows/tests.yml | 51 +++++++++----------- pyproject.toml | 2 + requirements-dev.txt => requirements/dev.txt | 0 requirements/minver.txt | 8 +++ 5 files changed, 37 insertions(+), 30 deletions(-) rename requirements-dev.txt => requirements/dev.txt (100%) create mode 100644 requirements/minver.txt diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 77f7b0394..71d131caa 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -28,14 +28,14 @@ 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 + python3 -m pip install --upgrade pip build setuptools wheel + python3 -m pip install -r requirements/requirements-dev.txt - name: Create cache directory run: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b357ed725..2fc702cd8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,8 +13,16 @@ jobs: runs-on: ubuntu-latest strategy: 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 @@ -28,14 +36,14 @@ 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 + python3 -m pip install --upgrade pip build setuptools wheel + python3 -m pip install -r requirements/dev.txt ${{ matrix.extra-requirements }} - name: Install Fast-F1 from sources run: | @@ -57,14 +65,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 @@ -73,16 +82,16 @@ 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 + python3 -m pip install --upgrade pip build setuptools wheel + python3 -m pip install -r requirements/dev.txt - - name: Install Fast-F1 from sources + - name: Install FastF1 from sources run: | python3 -m pip install -e . @@ -94,19 +103,6 @@ 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 @@ -124,14 +120,14 @@ 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 + python3 -m pip install --upgrade pip build setuptools wheel + python3 -m pip install -r requirements/dev.txt - name: Install Fast-F1 from sources run: | @@ -142,6 +138,7 @@ jobs: mkdir test_cache # not really need but pytest setup relies on it pytest -rf --prj-doc + run-sphinx-build-test: name: Test Docs uses: ./.github/workflows/docs.yml diff --git a/pyproject.toml b/pyproject.toml index 797eea4ad..f71dca427 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,9 @@ 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", diff --git a/requirements-dev.txt b/requirements/dev.txt similarity index 100% rename from requirements-dev.txt rename to requirements/dev.txt diff --git a/requirements/minver.txt b/requirements/minver.txt new file mode 100644 index 000000000..c6617d911 --- /dev/null +++ b/requirements/minver.txt @@ -0,0 +1,8 @@ +matplotlib==3.4.2 +numpy==1.20.3 +pandas==1.2.4 +requests==2.28.0 +requests-cache==0.8.0 +scipy==1.6.3 +timple==0.1.6 +websockets==8.1 \ No newline at end of file