Skip to content

More cover

More cover #122

Workflow file for this run

name: CI/CD
on:
push:
branches: [ master, develop, "dev/*" ]
tags:
- '*'
pull_request:
branches: [ master, develop ]
jobs:
Test-python-27:
runs-on: ubuntu-20.04
container:
image: python:2.7.18-buster
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python -m pip install -r requirements.txt && \
python -m pip install -r requirements_dev.txt
- name: Test with pytest and coverage
run: |
pytest --rootdir=. --cov=./cert_chain_resolver --cov-report term-missing -n auto tests/
- name: Upload coverage artifact
if: success()
uses: actions/upload-artifact@v4
with:
name: coverage-2.7
path: .coverage
Test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -r requirements.txt && \
python -m pip install -r requirements_dev.txt
- name: Test with pytest and coverage
run: |
pytest --rootdir=. --cov=./cert_chain_resolver --cov-report term-missing -n auto tests/
- name: Upload coverage artifact
if: success()
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}
path: .coverage
combine-coverage:
runs-on: ubuntu-latest
needs:
- Test
- Test-python-27
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install coverage tools
run: |
python -m pip install coverage codecov
- name: Download coverage artifacts
uses: actions/download-artifact@v4
with:
pattern: coverage-*
- name: Combine coverage reports
run: |
set -x
coverage combine coverage-*/.coverage
coverage report
coverage xml -o ./coverage.xml
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
mypy:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install mypy -rrequirements_dev.txt -rrequirements.txt
- name: mypy static checker
run: |
mypy {cert_chain_resolver,tests}
Publish:
if: |
github.repository == 'rkoopmans/python-certificate-chain-resolver' &&
startsWith(github.ref, 'refs/tags') &&
github.event_name == 'push'
timeout-minutes: 10
needs: [Test, Test-python-27, mypy]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install build wheel
- name: Check if properly tagged
run: |
PACKAGE_VERSION="$(python -c 'from cert_chain_resolver import __version__;print(__version__)')";
CURRENT_TAG="${GITHUB_REF#refs/*/}";
if [[ "${PACKAGE_VERSION}" != "${CURRENT_TAG}" ]]; then
>&2 echo "Tag mismatch. Version in __init__.py does not match tagged commit"
>&2 echo "Skipping deploy"
exit 1;
fi
- name: Build package (sdist & wheel)
run: |
python -m build --sdist --wheel --outdir dist/
- name: Test sdist install
run: |
python -m venv sdist_env
./sdist_env/bin/pip install dist/cert_chain_resolver-*.tar.gz
- name: Test wheel install
run: |
python -m venv wheel_env
./wheel_env/bin/pip install dist/cert_chain_resolver-*.whl
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_ACCESS_TOKEN }}
packages_dir: dist/
print_hash: true