Skip to content

Fix: Unit tests

Fix: Unit tests #179

Workflow file for this run

name: Build
on: push
jobs:
analyze:
name: Analyze
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.11"]
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 prerequisites
run: |
sudo apt-get update && sudo apt-get install libnotify4 libsdl2-mixer-2.0-0 libsdl2-image-2.0-0 libsdl2-2.0-0
python -m pip install --upgrade pip
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 wxPython==4.2.1
pip install wheel coveralls
pip install -r requirements.txt
- name: Run unit test
run: |
rm -f .coverage
shopt -s globstar
for i in **/test_*.py; do
xvfb-run --auto-servernum python -m coverage run --source=asn1editor -a -m unittest $i -v
done
python -m coverage html -d coverage
- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage/index.html
- name: Lint with flake8
run: |
pip install flake8
flake8 asn1editor --max-line-length=160
release:
name: Release to PyPI
needs: [ analyze ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Set up Python 3.11
- uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install pypa/build
run: |
python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: |
git clean -dfx
python -m build --sdist --wheel --outdir dist/ .
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: wheel
path: dist/*.whl
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
skip_existing: true
password: ${{ secrets.pypi_password }}