Skip to content

Commit

Permalink
[Feat] Refactoring build process with Poetry and changing CI to Githu…
Browse files Browse the repository at this point in the history
…b Actions (#38)

* feat: rm travis and using poetry

* ci: fix lintings

* ci: fix linting path

* ci: change poetry steps and 3.10 version

* ci: fix cache

* ci: rm venv activate

* feat: supporting only 3.8 and above

* feat: dep 3.10 and above

* ci: activating poetry env

* docs: update readme

* ci: rm poetry use env

* ci: publish on release

* docs: update badges
  • Loading branch information
sammous authored Aug 21, 2022
1 parent 829433e commit e163377
Show file tree
Hide file tree
Showing 20 changed files with 1,846 additions and 493 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish
on:
release:
types:
- created

jobs:
publish:
strategy:
fail-fast: false
matrix:
python-version: [3.9]
poetry-version: [1.1.2]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install and set up Poetry
run: |
python get-poetry.py --preview -y
source $HOME/.poetry/env
poetry config virtualenvs.in-project true
- name: Publish on PyPi
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build
176 changes: 176 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
name: Tests

on: [push, pull_request]

jobs:
Linting:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Linting
uses: psf/black@stable
with:
options: "--check --verbose"
src: "./spacy_lefff ./tests"
version: "22.6"
Linux:
needs: Linting
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, '3.10']

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
- name: Test
run: |
poetry run spacy download fr_core_news_sm
poetry run pytest --cov=. --cov-report=xml
#----------------------------------------------
# upload coverage stats
# (requires CODECOV_TOKEN in repository secrets)
#----------------------------------------------
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }} # Only required for private repositories
file: ./coverage.xml
fail_ci_if_error: true
MacOS:
needs: Linting
runs-on: macos-latest
strategy:
matrix:
python-version: [3.8, 3.9, '3.10']

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
- name: Test
run: |
poetry run spacy download fr_core_news_sm
poetry run pytest --cov=. --cov-report=xml
#----------------------------------------------
# upload coverage stats
# (requires CODECOV_TOKEN in repository secrets)
#----------------------------------------------
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }} # Only required for private repositories
file: ./coverage.xml
fail_ci_if_error: true
Windows:
needs: Linting
runs-on: windows-latest
strategy:
matrix:
python-version: [3.8, 3.9, '3.10']

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
- name: Test
run: |
poetry run spacy download fr_core_news_sm
poetry run pytest --cov=. --cov-report=xml
#----------------------------------------------
# upload coverage stats
# (requires CODECOV_TOKEN in repository secrets)
#----------------------------------------------
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }} # Only required for private repositories
file: ./coverage.xml
fail_ci_if_error: true
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/sammous/spacy-lefff.svg?branch=master)](https://travis-ci.org/sammous/spacy-lefff)[![Coverage Status](https://codecov.io/gh/sammous/spacy-lefff/badge.svg?branch=master)](https://codecov.io/gh/sammous/spacy-lefff?branch=master)[![PyPI version](https://badge.fury.io/py/spacy-lefff.svg)](https://badge.fury.io/py/spacy-lefff)
[![Build Status](https://github.com/sammous/spacy-lefff/actions/workflows/test.yml/badge.svg?branch=master))](https://github.com/sammous/spacy-lefff/actions/workflows/test.yml?branch=master)[![Coverage Status](https://codecov.io/gh/sammous/spacy-lefff/badge.svg?branch=master)](https://codecov.io/gh/sammous/spacy-lefff?branch=master)[![PyPI version](https://badge.fury.io/py/spacy-lefff.svg)](https://badge.fury.io/py/spacy-lefff)

# spacy-lefff : Custom French POS and lemmatizer based on Lefff for spacy

Expand All @@ -8,6 +8,8 @@ _On version [v2.0.17](https://github.com/explosion/spaCy/releases/tag/v2.0.17),

_As of version *0.4.0* and above, `spacy-lefff` only supports python3.6+ and spacy v3_

_As of version *0.5.0* and above, `spacy-lefff` only supports python3.8+ and spacy v3_

## Description

This package allows to bring Lefff lemmatization and part-of-speech tagging to a spaCy custom pipeline.
Expand Down
5 changes: 2 additions & 3 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
codecov:
branch: master
bot: null

coverage:
precision: 2
Expand All @@ -10,8 +9,8 @@ coverage:

comment:
layout: "header, diff, changes, sunburst, uncovered, tree"
branches: null
behavior: default

ignore:
"setup.py"
- "setup.py"
- "./github/*"
Loading

0 comments on commit e163377

Please sign in to comment.