Merge pull request #404 from Otom-obhazi/patch-16 #14
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: Python Package CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- 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: Create and Activate Virtual Environment | |
run: | | |
python3 -m venv venv | |
source venv/bin/activate | |
- 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 "/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/icu4c/sbin:$PATH" >> $GITHUB_PATH | |
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/homebrew/opt/icu4c/lib/pkgconfig" >> $GITHUB_ENV | |
- name: Install Python Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pylint pytest pytest-cov | |
if [ -f requirements.txt ]; then 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 |