Pin python-version for lint check #273
This file contains 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
# GitHub Actions tests for the climbing_ratings Python package. | |
# Copyright Contributors to the Climbing Ratings project | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: climbing_ratings | |
on: | |
push: | |
paths: | |
- '**' | |
- '!.github/workflows/test-climbr.yml' | |
- '!climbr/**' | |
- '!**.R' | |
pull_request: | |
branches: | |
- 'main' | |
schedule: | |
# Weekly on Fridays at 03:28. | |
- cron: '28 3 * * 5' | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
pip3 install Cython numpy pytest mypy setuptools | |
python3 setup.py develop | |
pip3 freeze --all | |
- name: Build and test | |
run: | | |
python3 setup.py build_ext --inplace | |
python3 -X dev -m pytest | |
- name: mypy | |
run: | | |
if dpkg --compare-versions "${{ matrix.python-version }}" ge "3.10" ; then | |
python3 -m mypy --strict -p climbing_ratings | |
python3 -m mypy --strict tests/test_climbing_ratings.py | |
else | |
echo "skipping type checking; needs Python 3.10+" | |
fi | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
pip3 install black cython-lint | |
- name: black | |
run: | | |
python3 -m black --check climbing_ratings setup.py tests/*.py | |
- name: cython-lint | |
run: | | |
cython-lint . |