climbing_ratings #243
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.7", "3.8", "3.9", "3.10"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Configure pip cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }} | |
restore-keys: | | |
pip-${{ matrix.python-version }}- | |
pip- | |
- name: Install dependencies | |
run: | | |
pip3 install Cython numpy pytest black mypy | |
python3 setup.py develop | |
pip3 freeze --all | |
- name: Lint | |
run: | | |
python3 -m black --check climbing_ratings setup.py tests/*.py | |
- name: Build and test | |
run: | | |
python3 setup.py build_ext --inplace | |
python3 -X dev -m pytest | |
- name: mypy | |
run: | | |
if test "${{ matrix.python-version }}" = "3.9" ; 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.9" | |
fi |