Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST] Python Package CI - macos #2

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/python_package_ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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", "3.10", "3.11"]

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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ dist
*.egg-info
# Caches
__pycache__
# Test coverage output
.coverage

# NPM Files
###########
Expand Down
2 changes: 2 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
brew "icu4c"
brew "pkg-config"
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tool.pytest.ini_options]
pythonpath = "src"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ emoji>=2.2.0
mwparserfromhell>=0.6
packaging>=20.9
pandas>=1.5.3
PyICU>=2.10.2 # Make sure to fulfill PyICU dependencies, see https://gitlab.pyicu.org/main/pyicu#installing-pyicu
PyICU>=2.10.2
pytest-cov>=3.0.0
python-dateutil>=2.8.2
regex>=2023.3.23
Expand Down
4 changes: 4 additions & 0 deletions tests/load/test_update_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from scribe_data.load import update_utils

def test_get_language_qid():
assert update_utils.get_language_qid("french") == "Q150"