Skip to content

Commit

Permalink
Moving from Travis to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Nagasaki45 committed Jun 16, 2024
1 parent 59ccaca commit bcd90fe
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 11 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/ci_pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: CI Pipeline

on: [push]

jobs:
test:
name: Test 🧪
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9"]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Setup BibTex
uses: teatimeguest/setup-texlive-action@v3
with:
packages: bibtex

- name: Setup OS dependencies
run: sudo apt-get -yqq install xclip xvfb

- name: Install dependencies
run: pip install .[dev]

- name: Check code formatting
run: black . --check

- name: Run type check
run: mypy . --exclude build

- name: Run unit tests with Xvfb, necessary for clipboard tests
run: xvfb-run coverage run -m pytest

- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"

- name: Install pypa/build
run: pip install build

- name: Build a binary wheel and a source tarball
run: python -m build

- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: Publish Python 🐍 distribution 📦 to PyPI
if: github.ref == 'refs/heads/master' # only publish to PyPI on pushes to master
needs:
- test
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/bibo
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Moving from Travis-CI to GitHub Actions.

## [0.1.7] - 2022-03-09

### Changed
Expand Down
2 changes: 1 addition & 1 deletion bibo/bibo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import click_constraints
import click_plugins # type: ignore
import pybibs
import pylatexenc.latex2text
import pylatexenc.latex2text # type: ignore
import pyperclip # type: ignore
import requests

Expand Down
3 changes: 2 additions & 1 deletion bibo/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import pybibs

from . import models
from typing import Optional

BIBO_DATABASE_ENV_VAR = "BIBO_DATABASE"
_ANSI_BOLD = "\033[1m"
Expand Down Expand Up @@ -223,7 +224,7 @@ def highlight_text(text: str, highlight: str) -> str:


def highlight_match(
text: str, result: models.SearchResult, extra_match_info: dict = None
text: str, result: models.SearchResult, extra_match_info: Optional[dict] = None
) -> typing.Tuple[str, dict]:
"""
Highlight `text` with `result.match` info. Every bit of info that is in
Expand Down
2 changes: 1 addition & 1 deletion bibo/stubs/pylatexenc/latex2text.pyi
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
class LatexNodes2Text:
def latex_to_text(self, latex: str) -> str: ...
def latex_to_text(self, latex: str) -> str: ...
8 changes: 5 additions & 3 deletions docs/contribution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ Then, preferably in a virtual environment, run
pip install -e .[dev]
Running tests
-------------
Running tests, code formatting and and type checking
----------------------------------------------------

.. code-block:: bash
pytest
black . --check
mypy .
It automatically checks code formatting with `black <https://github.com/psf/black>`_. If code formatting errors are detected they can be manually fixed, or try running ``black .``.
If code formatting errors are detected they can be manually fixed, or try running ``black .``.


Generating the documentation
Expand Down
2 changes: 0 additions & 2 deletions pytest.ini

This file was deleted.

4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#
# py_modules=["my_module"],
#
packages=find_packages(),
packages=find_packages(exclude=["tests*"]),
# This field lists other packages that your project depends on to run.
# Any package you put here will be installed by pip when your project is
# installed, so they must be valid existing projects.
Expand All @@ -83,8 +83,6 @@
"codecov",
"mypy",
"pytest",
"pytest-black",
"pytest-mypy",
"sphinx",
"sphinx-click",
"types-requests",
Expand Down

0 comments on commit bcd90fe

Please sign in to comment.