Skip to content

Update GitHub actions #359

Update GitHub actions

Update GitHub actions #359

Workflow file for this run

#
# Copyright © 2022-present Peter M. Stahl pemistahl@gmail.com
#
# 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 expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: build
on:
push:
branches:
- pure-python-impl
paths:
- 'poetry.lock'
- 'pyproject.toml'
- '.github/**'
- 'lingua/**'
- 'scripts/**'
- 'tests/**'
pull_request:
branches:
- pure-python-impl
paths:
- 'poetry.lock'
- 'pyproject.toml'
- '.github/**'
- 'lingua/**'
- 'scripts/**'
- 'tests/**'
jobs:
build-and-test:
name: Build and test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.8
- name: Set up virtual environment
run: poetry env use ${{ matrix.python-version }}
- name: Install project dependencies
run: poetry install --only main,dev
- name: Check static types
run: poetry run mypy
- name: Check code formatting
run: poetry run black --check .
- name: Run unit tests with code coverage
run: |
poetry run coverage run -m pytest
poetry run coverage xml
- name: Upload code coverage report
if: ${{ github.event_name == 'push' && matrix.python-version == '3.12' }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true