[cdd/tests/test_shared/test_pkg_utils.py] Work on `test_get_python_li… #577
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: Linting, testing, coverage, and release | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: | |
- opened | |
- reopened | |
jobs: | |
test_3_6: | |
name: ${{ matrix.os.name }} ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os.runs-on }} | |
strategy: | |
matrix: | |
python-version: [ 3.6 ] | |
os: | |
- name: Linux | |
runs-on: ubuntu-20.04 | |
python_platform: linux | |
- name: Windows | |
runs-on: windows-latest | |
python_platform: win32 | |
- name: macOS | |
runs-on: macos-latest | |
python_platform: darwin | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.6 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.6 | |
architecture: x64 | |
- name: install_dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade setuptools wheel | |
python -m pip install -r requirements.txt | |
- name: Test with unittest | |
run: | | |
python setup.py test | |
- name: Test coverage | |
run: | | |
python -m pip install codecov coverage | |
coverage run -m unittest discover | |
env | |
bash <(curl --proto '=https' --tlsv1.2 -sSf https://codecov.io/bash) | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
if: matrix.os.name == 'Linux' && github.ref == 'refs/heads/master' | |
test: | |
name: ${{ matrix.os.name }} ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os.runs-on }} | |
strategy: | |
matrix: | |
python-version: [3.7, 3.8, 3.9, '3.10', 3.11, 3.12] | |
os: | |
- name: Linux | |
runs-on: ubuntu-latest | |
python_platform: linux | |
- name: Windows | |
runs-on: windows-latest | |
python_platform: win32 | |
- name: macOS | |
runs-on: macos-latest | |
python_platform: darwin | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- name: install_dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade setuptools wheel | |
python -m pip install -r requirements.txt | |
- name: Test with unittest | |
run: | | |
python setup.py test | |
- name: Lint with flake8 | |
run: | | |
python -m pip install flake8 | |
flake8 . --count --select=$(printf '%s,' {A..Z}) --ignore='F811,W503,E203' --show-source --max-complexity=13 --max-line-length=119 --statistics | |
if: matrix.python-version == '3.8' && matrix.os.name == 'Linux' && github.ref == 'refs/heads/master' | |
- name: Check formatted with black | |
run: | | |
python -m pip install black | |
python -m black . --check --extend-exclude 'cdd/tests/mocks/cstify.py' | |
if: matrix.python-version == '3.8' && matrix.os.name == 'Linux' && github.ref == 'refs/heads/master' | |
- name: Doc coverage | |
run: | | |
python -m pip install interrogate | |
interrogate -e 'cdd/tests/mocks/cstify.py' --generate-badge '.github/doccoverage.svg' | |
sed -i 's/interrogate/doc coverage/g; s/data-doc c/data-doc-c/g' .github/doccoverage.svg | |
# Setup git config | |
email_author="$(git log -1 --pretty=format:'%an <%ce>')" | |
author="${email_author% *}" | |
email="${email_author#*<}"; email="${email::-1}" | |
git config --global user.name "$author" | |
git config --global user.email "$email" | |
# Only commit and push if there's a change | |
if git diff --name-only --diff-filter='M' | grep -qF '.github/doccoverage.svg'; then | |
git add .github/doccoverage.svg | |
git commit -m '[.github/doccoverage.svg] Updated coverage' | |
git push origin master | |
fi | |
if: matrix.python-version == '3.8' && matrix.os.name == 'Linux' && github.ref == 'refs/heads/master' | |
- name: Test coverage | |
run: | | |
python -m pip install codecov coverage | |
coverage run -m unittest discover | |
env | |
bash <(curl --proto '=https' --tlsv1.2 -sSf https://codecov.io/bash) | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
if: (matrix.python-version == '3.8' || matrix.python-version == '3.12') && matrix.os.name == 'Linux' && github.ref == 'refs/heads/master' | |
- name: PyPi release | |
run: | | |
python -m pip install twine | |
python setup.py sdist bdist_wheel | |
python -m twine upload --repository pypi dist/* | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | |
TWINE_NON_INTERACTIVE: 1 | |
if: matrix.python-version == '3.8' && matrix.os.name == 'Linux' && github.ref == 'refs/heads/master' |