Merge pull request #716 from kitsuyui/renovate/spacy-3.x-lockfile #1471
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
name: Lint and Test Python | |
on: | |
# pull-request events are not triggered when a PR is merged | |
# push events are not triggered when a PR created from a fork repository | |
# So we need both to run tests on every PR and after merging | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: install shared libraries | |
run: | | |
brew install openblas | |
brew install lapack | |
- name: Set up Python | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "${{ matrix.python }}" | |
- name: Set up poetry | |
uses: abatilo/actions-poetry@v3 | |
- name: Cache | |
id: cache-python | |
uses: actions/cache@v4 | |
with: | |
# for macOS, use the following path: ~/Library/Caches/pypoetry/virtualenvs | |
path: | | |
~/Library/Caches/pypoetry/ | |
~/Library/Application Support/pypoetry | |
~/.cache/pypoetry/virtualenvs | |
.mypy_cache | |
key: ${{ runner.os }}-build-${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }} | |
${{ runner.os }}-build-${{ matrix.python }}- | |
# This step is needed to make sure that the correct Python version is used | |
- run: | | |
poetry env use python${{ matrix.python }} | |
- name: Install dependencies | |
run: poetry install | |
- name: Lint | |
run: poetry run poe check | |
- name: Check Python version | |
run: | | |
actual_version=$(poetry run python --version) | |
expected_version="Python ${{ matrix.python }}" | |
if [ "$actual_version" == *"$expected_version"* ]; then | |
echo "Expected $expected_version, but got $actual_version" | |
exit 1 | |
fi | |
- name: Test | |
run: poetry run poe test | |
- name: Coverage | |
run: poetry run poe coverage-xml | |
- name: Upload coverage report to Codecov | |
if: matrix.python == '3.12' | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
flags: unittests | |
name: codecov-umbrella | |
fail_ci_if_error: true | |
verbose: true |