Skip to content

🗓 Jun 30, 2024 2:45:57 PM #380

🗓 Jun 30, 2024 2:45:57 PM

🗓 Jun 30, 2024 2:45:57 PM #380

name: tests
on: [push, pull_request]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 6
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version:
- "3.12"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
# - uses: actions/cache@v3
# if: startsWith(runner.os, 'Linux')
# with:
# path: ~/.cache/pip
# key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
# restore-keys: |
# ${{ runner.os }}-pip-
# - uses: actions/cache@v3
# if: startsWith(runner.os, 'macOS')
# with:
# path: ~/Library/Caches/pip
# key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
# restore-keys: |
# ${{ runner.os }}-pip-
# - uses: actions/cache@v3
# if: startsWith(runner.os, 'Windows')
# with:
# path: ~\AppData\Local\pip\Cache
# key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
# restore-keys: |
# ${{ runner.os }}-pip-
- name: Install
# if: steps.devcache.outs.cache-hit != 'true'
run: |
git submodule update --init --recursive
pip install -r requirements.txt
python -m pip install --upgrade pip
pip install .[extras]
- name: Install test requirements
run: |
pip install sphinx recommonmark pytest==8.1.1 pytest-cov pyperclip
- name: Test with pytest
run: |
pytest -v --disable-pytest-warnings --cov-report=xml --cov=chepy --cov-config=.coveragerc tests/
coverage report -m
- name: Test plugins osx
if: matrix.os == 'macOS-latest'
run: |
sed -iE 's/enableplugins = false/enableplugins = true/' ~/.chepy/chepy.conf
sed -iE '/chepy/d' chepy/chepy_plugins/requirements.txt
pip install -r chepy/chepy_plugins/requirements.txt
pip install .
pytest -v --disable-pytest-warnings tests_plugins/
python -c "from chepy import Chepy"
- name: Test plugins ubuntu
if: contains(matrix.os, 'ubuntu')
run: |
sed -i 's/enableplugins = false/enableplugins = true/' ~/.chepy/chepy.conf
sed -i '/chepy/d' chepy/chepy_plugins/requirements.txt
pip install -r chepy/chepy_plugins/requirements.txt
pip install .
pytest --disable-pytest-warnings tests_plugins/
python -c "from chepy import Chepy"
- name: Test plugins windows
if: matrix.os == 'windows-latest'
run: |
Set-Content -Path ~/.chepy/chepy.conf -Value (Get-Content ~/.chepy/chepy.conf | %{$_ -replace "enableplugins = false","enableplugins = true"})
Set-Content -Path chepy/chepy_plugins/requirements.txt -Value (Get-Content -Path chepy/chepy_plugins/requirements.txt | Select-String -Pattern 'chepy' -NotMatch)
pip install -r chepy/chepy_plugins/requirements.txt
pytest --disable-pytest-warnings tests_plugins/
python -c "from chepy import Chepy"
# - name: Test with bandit
# run: |
# bandit --recursive chepy/ --ignore-nosec --skip B101,B413,B303,B310,B112,B304,B320,B410,B404,B608,B311,B324
# - name: Test docs
# if: ${{ !env.ACT }} && contains(matrix.os, 'ubuntu')
# run: |
# make -C docs/ clean html
publish:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v4
- name: setup
uses: actions/setup-python@v5
with:
python-version: "3.7"
- name: build
run: |
python setup.py sdist
- name: publish
uses: pypa/[email protected]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}