CI: Set COVERAGE_CORE
to speed up tests
#56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- master | |
- github_ci | |
tags: | |
- '*' | |
jobs: | |
build_and_test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
include: | |
- name: macos | |
os: macos-latest | |
python-version: "3.x" | |
- name: windows | |
os: windows-latest | |
python-version: "3.x" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
key: ${{ runner.os}}-pip-${{ matrix.python-version }} | |
path: ~/.cache/pip | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Update package list | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo apt-get update | |
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
uses: MatteoH2O1999/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache-build: true | |
- run: | | |
lsb_release -a | |
uname -a | |
if: startsWith(matrix.os, 'ubuntu') | |
- run: python --version | |
- name: Install dependencies | |
run: | | |
pip install -U pytest pytest-cov codecov coveralls | |
pip install scrutinizer-ocular | |
pip install pandas | |
- name: Install package | |
run: | | |
pip install -e ".[all]" | |
- run: pip list | |
- name: Test | |
run: | | |
py.test -v --doctest-glob='*.md' --cov src | |
env: | |
COVERAGE_CORE: sysmon | |
- name: Convert coverage | |
run: python -m coverage xml | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v3 | |
- name: Upload to Coveralls | |
if: startsWith(matrix.os, 'ubuntu') && matrix.python-version != '2.7' | |
run: | | |
python -m coveralls --service=github | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_PARALLEL: true | |
COVERALLS_FLAG_NAME: py${{ matrix.python-version }} | |
coverage: | |
needs: build_and_test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
- name: Finish coverage collection | |
run: | | |
python -m pip install -U pip | |
python -m pip install -U coveralls | |
python -m coveralls --finish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
deploy: | |
name: Deploy to PyPi | |
needs: build_and_test | |
runs-on: ubuntu-latest | |
# Specifying a GitHub environment is optional, but strongly encouraged | |
environment: deploy | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: python -m pip install --upgrade pip | |
- run: python -m pip install build twine check-wheel-contents | |
- name: Build package | |
run: python -m build --sdist --wheel . | |
- run: ls -alF dist/ | |
- run: check-wheel-contents dist/*.whl | |
- name: Check long_description | |
run: python -m twine check dist/* | |
- name: Publish package to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
skip-existing: true | |
- name: Publish tagged release to PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip-existing: true |