Skip to content

Commit

Permalink
adapt tox and gh workflows for new build tool
Browse files Browse the repository at this point in the history
  • Loading branch information
mgor committed Apr 11, 2022
1 parent 5b814a5 commit 61a4961
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
20 changes: 8 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,19 @@ jobs:
python-version: ${{ matrix.python }}
- name: Update pip
run: |
pip install -U wheel
pip install -U setuptools
python -m pip install -U pip
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
run: echo "::set-output name=dir::$(python -m pip cache dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip|${{ runner.os }}|${{ matrix.python }}|${{ hashFiles('setup.py') }}
key: pip|${{ runner.os }}|${{ matrix.python }}|${{ hashFiles('setup.cfg') }}
- name: set full Python version in PY env var
# See https://pre-commit.com/#github-actions-example
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- run: pip install tox codecov
- run: tox -e ${{ matrix.tox }}
- run: python -m pip install tox
- run: python -m tox -e ${{ matrix.tox }}

verify_docker_build:
name: Always - Docker verify, push to tag 'master' if on master
Expand Down Expand Up @@ -121,11 +119,10 @@ jobs:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
python -m pip install --upgrade pip build
- name: Build + set TAG env var for later use
run: |
python setup.py sdist bdist_wheel
python -m build
echo "TAG=${GITHUB_REF#refs/*/}" | tee -a $GITHUB_ENV
- name: Publish tagged version to PyPI
uses: pypa/gh-action-pypi-publish@master
Expand Down Expand Up @@ -159,12 +156,11 @@ jobs:
- name: Install dependencies
if: ${{ env.NOT_MERGE_COMMIT == '' }}
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
python -m pip install --upgrade pip build
- name: Build
if: ${{ env.NOT_MERGE_COMMIT == '' }}
run: |
python setup.py sdist bdist_wheel
python -m build
- name: Publish prerelease version to PyPI
if: ${{ env.NOT_MERGE_COMMIT == '' }}
uses: pypa/gh-action-pypi-publish@master
Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[tox]
skipsdist = True
envlist =
flake8
black
Expand All @@ -24,7 +25,8 @@ allowlist_externals =
timeout
grep
commands =
coverage run -m unittest discover []
python3 -m pip install .
python3 -m coverage run -m unittest discover []
bash -ec 'PYTHONUNBUFFERED=1 timeout 2s python3 examples/debugging.py >out.txt 2>err.txt || true'
grep -qm 1 '/hello' out.txt
bash -ec '! grep . err.txt' # should be empty
Expand Down

0 comments on commit 61a4961

Please sign in to comment.