Skip to content

Commit

Permalink
Pushes to main now trigger a release on PyPi. Also added a workflow f…
Browse files Browse the repository at this point in the history
…or manually releasing on TestPyPi.
  • Loading branch information
jaspersiebring committed Aug 9, 2023
1 parent 54d1164 commit e02dbc0
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 6 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,8 @@ jobs:
if: steps.pytest.outcome == 'success' && steps.mypy.outcome == 'success' && steps.pylint.outcome == 'success' && steps.coverage.outcome == 'success'

- name: Authorize GitHub Actions to publish on PYPI
#run: poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi ${{ secrets.TESTPYPI_API_TOKEN }}
run: poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
if: steps.build.outcome == 'success' && github.event_name == 'push'
- name: Publish on PYPI
#run: poetry publish
run: poetry publish -r test-pypi
run: poetry publish
if: steps.build.outcome == 'success' && github.event_name == 'push'
74 changes: 74 additions & 0 deletions .github/workflows/test_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build and release on TestPyPi
on:
workflow_dispatch: # Manual trigger (dev)
jobs:
checks_and_release:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Installing Poetry globally
run: pipx install poetry
- name: Installing Python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: 3.8
- uses: actions/cache@v3
with:
path: /home/runner/.cache/pypoetry/virtualenvs
key: poetry-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
restore-keys: |
poetry-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
poetry-${{ steps.setup-python.outputs.python-version }}-
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y \
dpkg-dev \
build-essential \
freeglut3-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libgstreamer-plugins-base1.0-dev \
libgtk-3-dev \
libjpeg-dev \
libnotify-dev \
libpng-dev \
libsdl2-dev \
libsm-dev \
libunwind-dev \
libtiff-dev \
libwebkit2gtk-4.0-dev \
libxtst-dev \
libgtk2.0-dev
- name: Installing Poetry environment
run: poetry install
- name: Running pytest
id: pytest
run: poetry run pytest -v
- name: Running mypy
id: mypy
run: poetry run mypy libretro_finder/ config/ tests/
- name: Running pylint
id: pylint
run: poetry run pylint libretro_finder/ config/ tests/ --fail-under=8
- name: Checking code coverage
id: coverage
run: poetry run pytest --cov=config --cov=libretro_finder --cov-fail-under=75

- name: Build source and .whl archives with Poetry
id: build
run: poetry build
if: steps.pytest.outcome == 'success' && steps.mypy.outcome == 'success' && steps.pylint.outcome == 'success' && steps.coverage.outcome == 'success'

- name: Authorize GitHub Actions to publish on PYPI
run: |
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi ${{ secrets.TESTPYPI_API_TOKEN }}
if: steps.build.outcome == 'success'
- name: Publish on PYPI
run: poetry publish -r test-pypi
if: steps.build.outcome == 'success'

0 comments on commit e02dbc0

Please sign in to comment.