Skip to content

Add GitHub Actions workflow for code formatting PR check #183

Add GitHub Actions workflow for code formatting PR check

Add GitHub Actions workflow for code formatting PR check #183

name: Python Package CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
# Removing 'macos-latest' for now until build issue is fixed.
# https://github.com/scribe-org/Scribe-Data/issues/61
# - macos-latest
- ubuntu-latest
python-version:
- "3.9"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Install PyICU dependencies
run: |
brew bundle install --file=Brewfile
# configure PATH & PKG_CONFIG_PATH as per
# https://gitlab.pyicu.org/main/pyicu#installing-pyicu
echo "/usr/local/opt/icu4c/bin:/usr/local/opt/icu4c/sbin" >> $GITHUB_PATH
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/icu4c/lib/pkgconfig" >> $GITHUB_ENV
- name: Install Python dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install pylint pytest pytest-cov
if [ -f requirements.txt ]; then python3 -m pip install -r requirements.txt; fi
- name: Lint with pylint
run: |
# only report linting, do not fail ci run
pylint $(git ls-files '*.py') --exit-zero
- name: Test with pytest
run: |
pytest
- name: Test coverage with pytest-cov
run: |
pytest --cov=src