Skip to content

Commit

Permalink
Merge pull request #8 from jaspersiebring/executable_all_platforms
Browse files Browse the repository at this point in the history
Automatically build executables for all platforms
  • Loading branch information
jaspersiebring committed Aug 16, 2023
2 parents 2ad16b4 + 35f58b9 commit d1bf06f
Show file tree
Hide file tree
Showing 5 changed files with 219 additions and 206 deletions.
70 changes: 48 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ on:
branches:
- main # Pushes to main (i.e. after a merged PR)
jobs:
checks_and_release:
runs-on: ubuntu-latest
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Check out repository code
uses: actions/checkout@v3
Expand All @@ -17,14 +20,8 @@ jobs:
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 }}-
cache: poetry

- name: Install dependencies
run: |
sudo apt update
Expand All @@ -45,13 +42,16 @@ jobs:
libtiff-dev \
libwebkit2gtk-4.0-dev \
libxtst-dev \
libgtk2.0-dev
libgtk2.0-dev
if: matrix.os == 'ubuntu-latest'
- name: Installing Poetry environment
run: poetry install
- name: Setting tag to package version
shell: bash
run: |
echo "VERSION=$(poetry version | awk '{print $2}')" >> $GITHUB_ENV
echo "RELEASE_NAME=$(poetry version | tr ' ' '-')" >> $GITHUB_ENV
echo "RELEASE_VERSION=$(poetry version -s)" >> $GITHUB_ENV
- name: Running pytest
id: pytest
run: poetry run pytest -v
Expand All @@ -64,26 +64,52 @@ jobs:
- 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'
if: steps.pytest.outcome == 'success' && steps.mypy.outcome == 'success' && steps.pylint.outcome == 'success' && steps.coverage.outcome == 'success' && github.event_name == 'push'

- 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'
if: steps.build.outcome == 'success' && matrix.os == 'ubuntu-latest'
- name: Publish on PYPI
run: poetry publish
if: steps.build.outcome == 'success' && github.event_name == 'push'
if: steps.build.outcome == 'success' && matrix.os == 'ubuntu-latest'
- name: Make executable from wheel
run: poetry run pyinstaller ./build.spec
env:
EXE_NAME: ${{ env.RELEASE_NAME }}-${{ matrix.os }}-standalone
id: freeze
if: steps.build.outcome == 'success' && github.event_name == 'push'
- name: Publish on Github
if: steps.build.outcome == 'success'
- name: Upload build artifacts
uses: actions/upload-artifact@v3
if: steps.build.outcome == 'success'
with:
name: ${{ env.RELEASE_NAME }}
path: dist/*

outputs:
RELEASE_NAME: ${{ env.RELEASE_NAME }}
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
PASSED_BUILD: ${{ steps.build.outcome }}

release:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Collect all artifacts
uses: actions/download-artifact@v3
id: collect
if: ${{ needs.build.outputs.PASSED_BUILD }} == 'success'
- name: Upload all artifacts to Github
uses: softprops/action-gh-release@v1
if: steps.collect.outcome == 'success'
with:
files: dist/*
tag_name: ${{ env.VERSION }}
files: ${{ needs.build.outputs.RELEASE_NAME }}/*
tag_name: ${{ needs.build.outputs.RELEASE_VERSION }}
prerelease: false
if: steps.build.outcome == 'success' && github.event_name == 'push' && steps.freeze.outcome == 'success'



11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# libretro_finder
[![PyPI](https://img.shields.io/pypi/v/libretro-finder)](https://pypi.org/project/libretro-finder/)
[![Downloads](https://static.pepy.tech/badge/libretro-finder)](https://pepy.tech/project/libretro-finder)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/libretro-finder)
![PyPI - License](https://img.shields.io/pypi/l/libretro-finder)
[![Build passing (main)](https://github.com/jaspersiebring/libretro_finder/actions/workflows/main.yml/badge.svg?branch=main&event=push)](https://github.com/jaspersiebring/libretro_finder/actions/workflows/main.yml)
[![Build passing](https://github.com/jaspersiebring/libretro_finder/actions/workflows/main.yml/badge.svg)](https://github.com/jaspersiebring/libretro_finder/actions/workflows/main.yml)


Simple tool that finds and prepares your BIOS files for usage with Libretro (or its RetroArch frontend).
Expand All @@ -16,7 +17,7 @@ This repository does **NOT** include the BIOS files themselves.
- Scriptable command line interface (CLI)
- Works on Windows, Linux and MacOS
- Available through the Python Package Index (Python >=3.8)
- Available as portable executable (currently only on X86 Windows machines)
- Available as portable executable (no installation required)


<p float="left">
Expand All @@ -34,11 +35,7 @@ pip install libretro-finder
# [Optional] Install as isolated application through pipx (https://pypa.github.io/pipx/)
pipx install libretro-finder
````
You can also download the prebuilt standalone executable which includes Python and all the program's dependencies, no installation required (currently only available for X86 Windows machines). See [releases](https://github.com/jaspersiebring/libretro_finder/releases).

<p float="left">
<img src="https://github.com/jaspersiebring/libretro_finder/assets/25051531/3ee6056c-0311-4071-8423-2b120ffff68e" width="150" height = 130/>
</p>
You can also download the standalone executables for Windows, Ubuntu and MacOS. This already contains all of the program's dependencies, no installation required. See [releases](https://github.com/jaspersiebring/libretro_finder/releases).

## Example of usage

Expand Down
2 changes: 1 addition & 1 deletion build.spec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exe = EXE(pyz,
a.zipfiles,
a.datas,
[],
name='libretro_finder',
name=os.environ.get('EXE_NAME', 'libretro_finder'),
debug=False,
bootloader_ignore_signals=False,
strip=False,
Expand Down

0 comments on commit d1bf06f

Please sign in to comment.