Skip to content

Build Python Application with PyInstaller #36

Build Python Application with PyInstaller

Build Python Application with PyInstaller #36

Workflow file for this run

name: Build Python Application with PyInstaller
on:
workflow_dispatch:
jobs:
build:
strategy:
matrix:
#os: [ubuntu-latest, macos-latest, windows-latest]
#os: [ubuntu-latest, macos-latest, macos-15, windows-latest]
#os: [ubuntu-22.04, macos-latest, macos-15, windows-latest]
#os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, macos-13, windows-latest]
#os: [ubuntu-20.04, macos-13, windows-latest]
os: [ubuntu-22.04, ubuntu-24.04, windows-latest]
#os: [windows-latest]
runs-on: ${{ matrix.os }}
env:
SCRIPT_NAME: "rclone_pygui"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install packages
if: runner.os == 'Linux'
run: |
sudo apt-get install --no-install-recommends --no-install-suggests -y libgtk-3-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip
#pip install pyinstaller pysimplegui pyside2 wxPython
pip install pyinstaller pyside6 boto3
#pip install -r requirements.txt
- name: Build executable for Windows
if: runner.os == 'Windows'
run: |
cd python
mv ./${SCRIPT_NAME}.py ./${SCRIPT_NAME}.pyw
pyinstaller --noconsole --onefile --add-data "./images/spinner.gif:./images" ./${SCRIPT_NAME}.pyw
shell: bash
- name: Build executable for Linux
if: runner.os == 'Linux'
run: |
cd python
pyinstaller --noconsole --onefile --add-data "./images/spinner.gif:./images" ./${SCRIPT_NAME}.py
shell: bash
- name: Build executable for MacOS
if: runner.os == 'macOS'
run: |
cd python
# --target-architecture x86_64, arm64, universal2
pyinstaller --noconsole --onefile --add-data "./images/spinner.gif:./images" ./${SCRIPT_NAME}.py
shell: bash
- name: run_tests.sh
run: |
echo "${{ runner.os }}"
export RUNNER="${{ runner.os }}"
./run_tests.sh
shell: bash
- name: Build artifact for Windows
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: windows-build
path: ./python/dist
- name: Build artifact for Linux (${{ matrix.os }})
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: linux-${{ matrix.os }}-build
path: ./python/dist
- name: Build artifact for MacOS (${{ matrix.os }})
if: runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
name: linux-${{ matrix.os }}-build
path: ./python/dist