-
Notifications
You must be signed in to change notification settings - Fork 50
executable file
·70 lines (66 loc) · 2.39 KB
/
pipeline.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: CI/CD # pipeline's name that will appear in Github Actions
on: # events that trigger our pipeline: push on any branch and release creation
push:
release:
types: [created]
pull_request:
jobs: # jobs. We will have two jobs (test and publish) with multiple steps.
test:
# Our test job will run on ubuntu.
# We define matrix strategy for python-version so that
# our tests are run on multiple python versions:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run image # install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: latest
- name: Install dependencies # install all dependencies
run: |
python -m pip install --upgrade pip
poetry config virtualenvs.create false --local
poetry install --all-extras
pip install pytest pylint coverage mypy coveralls
# python -m nltk.downloader punkt stopwords
- name: Pylint # Run pylint static analysis
run: |
poetry run pylint newspaper --fail-under=8.0
- name: mypy # Run mypy static analysis
run: |
poetry run mypy -p newspaper
env:
MYPYPATH: stubs
- name: Pytest # Run pytest
run: |
poetry run coverage run -m --source=newspaper pytest tests
poetry run coverage report
# - name: Coveralls # Send coverage metrics to coveralls.io
# run: poetry run coveralls --service=github
# env:
# COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
publish:
# Our publish job will only run on release creation events,
# and only if the test job has passed
if: github.event_name == 'release' && github.event.action == 'created'
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Run image
uses: abatilo/actions-poetry@v2
with:
poetry-version: latest
- name: Build and publish # publish newspaper4k to PyPI
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: poetry publish -u __token__ -p $PYPI_TOKEN --build