-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from jaspersiebring/linter
Added automatic testing and publishing through Github Actions
- Loading branch information
Showing
11 changed files
with
436 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Quality control and automated release | ||
on: | ||
pull_request: # Pull request events (default: open, synchronized, reopened) in any branch triggers the workflow. | ||
push: | ||
branches: | ||
- main # Pushes to main (i.e. after a merged PR) | ||
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 pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }} | ||
if: steps.build.outcome == 'success' && github.event_name == 'push' | ||
- name: Publish on PYPI | ||
run: poetry publish | ||
if: steps.build.outcome == 'success' && github.event_name == 'push' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.