2022-02-02 21:24:32 +00:00
|
|
|
name: Continuous integration
|
|
|
|
|
|
|
|
on:
|
2022-03-19 19:46:00 +00:00
|
|
|
push: # run when commits are added to master
|
2022-02-02 21:45:05 +00:00
|
|
|
branches:
|
|
|
|
- master
|
2022-03-19 19:46:00 +00:00
|
|
|
tags:
|
2022-03-19 20:10:02 +00:00
|
|
|
- '[0-9]+' # match version tags with only numbers
|
2022-03-19 19:46:00 +00:00
|
|
|
pull_request: # run on pr's against master
|
2022-02-02 21:45:05 +00:00
|
|
|
branches:
|
|
|
|
- master
|
2022-02-02 21:24:32 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
default-python: "3.10"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
2022-02-11 21:46:51 +00:00
|
|
|
check-code-formatting:
|
2022-06-26 16:25:28 +00:00
|
|
|
name: Check coding style
|
2022-02-11 21:46:51 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
2022-06-26 16:25:28 +00:00
|
|
|
- name: Set up Python ${{ env.default-python }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ env.default-python }}
|
|
|
|
- name: Upgrade pip, Install nox
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
python -m pip install nox
|
|
|
|
- name: Check coding style
|
|
|
|
run: |
|
|
|
|
nox --error-on-missing-interpreters --non-interactive --session format
|
2022-02-11 21:46:51 +00:00
|
|
|
|
2022-02-02 21:24:32 +00:00
|
|
|
check-coding-style:
|
|
|
|
name: Check coding style
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Python ${{ env.default-python }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ env.default-python }}
|
|
|
|
- name: Upgrade pip, Install nox
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
python -m pip install nox
|
|
|
|
- name: Check coding style
|
|
|
|
run: |
|
|
|
|
nox --error-on-missing-interpreters --non-interactive --session lint
|
|
|
|
|
|
|
|
check-static-types:
|
|
|
|
name: Check static types
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Python ${{ env.default-python }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ env.default-python }}
|
|
|
|
- name: Upgrade pip, Install nox
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
python -m pip install nox
|
|
|
|
- name: Check static types
|
|
|
|
run: |
|
|
|
|
nox --error-on-missing-interpreters --non-interactive --session types
|
|
|
|
|
|
|
|
tests:
|
|
|
|
name: Run tests
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ ubuntu-latest ]
|
|
|
|
python-version: [ "3.6", "3.7", "3.8", "3.9", "3.10" ]
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Determine pip cache directory
|
|
|
|
id: pip-cache
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=dir::$(pip cache dir)"
|
|
|
|
- name: Cache pip cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.pip-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-pip${{ matrix.python-version }}
|
|
|
|
- name: Upgrade pip and install nox
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
python -m pip install nox
|
|
|
|
- name: Run tests
|
|
|
|
run: |
|
|
|
|
nox --non-interactive --session tests-${{ matrix.python-version }}
|
|
|
|
|
|
|
|
build-docs:
|
|
|
|
name: Test building docs
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Python ${{ env.default-python }}
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ env.default-python }}
|
|
|
|
- name: Upgrade pip and install nox
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
python -m pip install nox
|
|
|
|
- name: Build docs
|
|
|
|
run: |
|
2022-03-19 19:46:00 +00:00
|
|
|
nox --error-on-missing-interpreters --non-interactive --session docs
|
|
|
|
|
|
|
|
publish:
|
|
|
|
name: Publish to PyPi
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- check-code-formatting
|
|
|
|
- check-coding-style
|
|
|
|
- check-static-types
|
|
|
|
- tests
|
|
|
|
- build-docs
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install dependencies
|
|
|
|
run: python -m pip install wheel
|
|
|
|
- name: Set version
|
|
|
|
run: |
|
|
|
|
if [[ "${{ github.ref }}" == "refs/tags/"* ]]
|
|
|
|
then
|
|
|
|
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,' | sed -e 's/^v//')
|
|
|
|
else
|
|
|
|
VERSION=$(date +%Y%m%d).$(date +%H%M%S)
|
|
|
|
fi
|
|
|
|
echo ${VERSION}
|
|
|
|
sed -i "s/__VERSION__/${VERSION}/g" pdfminer/__init__.py
|
|
|
|
- name: Build package
|
|
|
|
run: python setup.py sdist bdist_wheel
|
|
|
|
- name: Generate changelog
|
|
|
|
run: sed '1,/## \[/d;/## \[/Q' CHANGELOG.md > ${{ github.workspace }}-CHANGELOG.md
|
|
|
|
- name: Publish package to PyPi
|
|
|
|
if: startsWith(github.ref, 'refs/tags')
|
|
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
|
|
with:
|
|
|
|
user: __token__
|
|
|
|
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
|
|
- name: Create GitHub release
|
|
|
|
if: startsWith(github.ref, 'refs/tags')
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
id: create_release
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
|
|
|
body_path: ${{ github.workspace }}-CHANGELOG.md
|
|
|
|
files: |
|
|
|
|
dist/*.tar.gz
|
|
|
|
dist/*.whl
|