|
| 1 | +name: Build and release on TestPyPi |
| 2 | +on: |
| 3 | + workflow_dispatch: # Manual trigger (dev) |
| 4 | +jobs: |
| 5 | + checks_and_release: |
| 6 | + runs-on: ubuntu-latest |
| 7 | + steps: |
| 8 | + - name: Check out repository code |
| 9 | + uses: actions/checkout@v3 |
| 10 | + - name: Installing Poetry globally |
| 11 | + run: pipx install poetry |
| 12 | + - name: Installing Python |
| 13 | + id: setup-python |
| 14 | + uses: actions/setup-python@v4 |
| 15 | + with: |
| 16 | + python-version: 3.8 |
| 17 | + - uses: actions/cache@v3 |
| 18 | + with: |
| 19 | + path: /home/runner/.cache/pypoetry/virtualenvs |
| 20 | + key: poetry-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} |
| 21 | + restore-keys: | |
| 22 | + poetry-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} |
| 23 | + poetry-${{ steps.setup-python.outputs.python-version }}- |
| 24 | +
|
| 25 | + - name: Install dependencies |
| 26 | + run: | |
| 27 | + sudo apt update |
| 28 | + sudo apt install -y \ |
| 29 | + dpkg-dev \ |
| 30 | + build-essential \ |
| 31 | + freeglut3-dev \ |
| 32 | + libgl1-mesa-dev \ |
| 33 | + libglu1-mesa-dev \ |
| 34 | + libgstreamer-plugins-base1.0-dev \ |
| 35 | + libgtk-3-dev \ |
| 36 | + libjpeg-dev \ |
| 37 | + libnotify-dev \ |
| 38 | + libpng-dev \ |
| 39 | + libsdl2-dev \ |
| 40 | + libsm-dev \ |
| 41 | + libunwind-dev \ |
| 42 | + libtiff-dev \ |
| 43 | + libwebkit2gtk-4.0-dev \ |
| 44 | + libxtst-dev \ |
| 45 | + libgtk2.0-dev |
| 46 | +
|
| 47 | + - name: Installing Poetry environment |
| 48 | + run: poetry install |
| 49 | + - name: Running pytest |
| 50 | + id: pytest |
| 51 | + run: poetry run pytest -v |
| 52 | + - name: Running mypy |
| 53 | + id: mypy |
| 54 | + run: poetry run mypy libretro_finder/ config/ tests/ |
| 55 | + - name: Running pylint |
| 56 | + id: pylint |
| 57 | + run: poetry run pylint libretro_finder/ config/ tests/ --fail-under=8 |
| 58 | + - name: Checking code coverage |
| 59 | + id: coverage |
| 60 | + run: poetry run pytest --cov=config --cov=libretro_finder --cov-fail-under=75 |
| 61 | + |
| 62 | + - name: Build source and .whl archives with Poetry |
| 63 | + id: build |
| 64 | + run: poetry build |
| 65 | + if: steps.pytest.outcome == 'success' && steps.mypy.outcome == 'success' && steps.pylint.outcome == 'success' && steps.coverage.outcome == 'success' |
| 66 | + |
| 67 | + - name: Authorize GitHub Actions to publish on PYPI |
| 68 | + run: | |
| 69 | + poetry config repositories.test-pypi https://test.pypi.org/legacy/ |
| 70 | + poetry config pypi-token.test-pypi ${{ secrets.TESTPYPI_API_TOKEN }} |
| 71 | + if: steps.build.outcome == 'success' |
| 72 | + - name: Publish on PYPI |
| 73 | + run: poetry publish -r test-pypi |
| 74 | + if: steps.build.outcome == 'success' |
0 commit comments