From 1c284867de162b563857e338d66abdb6b937f768 Mon Sep 17 00:00:00 2001 From: Jose Ignacio Tamayo Segarra <21063513+JoseIgnacioTamayo@users.noreply.github.com> Date: Thu, 12 Oct 2023 08:05:13 +0200 Subject: [PATCH] Correct GitHub actions and Release script (#319) * Ensure Linter Black runs as test * Update Release script * Correct Workflow names --- .../{python-package.yml => python-test.yml} | 26 +++++++++++-------- scripts/release.sh | 16 ++++++++---- 2 files changed, 26 insertions(+), 16 deletions(-) rename .github/workflows/{python-package.yml => python-test.yml} (64%) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-test.yml similarity index 64% rename from .github/workflows/python-package.yml rename to .github/workflows/python-test.yml index c27fd248..7023bf3e 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-test.yml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: Python test +name: Run TOX tests on: push: @@ -10,6 +10,16 @@ on: branches: [ "master" ] jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + - name: Install testing dependency + run: pip install tox + - name: Lint with black + run: tox -e black test: runs-on: ubuntu-latest strategy: @@ -23,14 +33,8 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: 'pip' # caching pip dependencies - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - - name: Install building and testing dependencies - run: pip install tox black build - - name: Run tox + - name: Install testing dependencies + run: pip install tox + - name: Run tox for ${{ matrix.python-version }} # Run tox using the version of Python in `PATH` - run: tox -e py - - name: Build package - run: python -m build + run: tox -e py \ No newline at end of file diff --git a/scripts/release.sh b/scripts/release.sh index d96e7707..37c9ef6f 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,16 +1,22 @@ #!/bin/bash THISDIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +BASEDIR=$THISDIR/.. +rm $BASEDIR/dist/*.whl $BASEDIR/dist/*.tar.gz -rm $THISDIR/../dist/*.whl $THISDIR/../dist/*.tar.gz +virtualenv $BASEDIR/pyvirtualenv +source $BASEDIR/pyvirtualenv/bin/activate -python $THISDIR/../setup.py bdist_wheel sdist - -coverage run setup.py test -q +pip install -r $BASEDIR/requirements.txt +pip install tox +python -m tox --root $BASEDIR/ if [ $? -ne 0 ]; then echo "FAILED: Cannot release a broken version!" exit 127 fi -twine upload -s $THISDIR/../dist/pyangbind* +pip install twine build +python -m build --outdir $BASEDIR/dist/ + +python -m twine upload -s $BASEDIR/dist/pyangbind*