diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5aee762..5cda024 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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' diff --git a/.github/workflows/test_release.yml b/.github/workflows/test_release.yml new file mode 100644 index 0000000..02949da --- /dev/null +++ b/.github/workflows/test_release.yml @@ -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'