Add missing dependencies for Buildozer in Android build workflow #58
Workflow file for this run
This file contains hidden or 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
name: Build Desktop & Pi Ejecutables - on New Version | |
on: | |
push: | |
tags: # Trigger on tags like v*.*.* | |
- 'v*.*.*' | |
jobs: | |
build-desktop: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
include: | |
- os: ubuntu-latest | |
os_name: linux | |
asset_suffix_cli: lin-x64 | |
asset_suffix_gui: gui-lin-x64 | |
artifact_path_cli: dist/fiscalberry-cli | |
artifact_path_gui: dist/fiscalberry-gui | |
python_platform: linux | |
- os: windows-latest | |
os_name: windows | |
asset_suffix_cli: win-x64.exe | |
asset_suffix_gui: gui-win-x64.exe | |
artifact_path_cli: dist/fiscalberry-cli.exe | |
artifact_path_gui: dist/fiscalberry-gui.exe | |
python_platform: win32 | |
- os: macos-latest | |
os_name: macos | |
asset_suffix_cli: mac-x64 # Adjust if building universal/arm64 | |
asset_suffix_gui: gui-mac-x64 # Adjust if building universal/arm64 | |
artifact_path_cli: dist/fiscalberry-cli | |
artifact_path_gui: dist/fiscalberry-gui | |
python_platform: darwin # sys.platform value for macOS | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install Linux dependencies (if applicable) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
libcups2-dev \ | |
# Add Kivy dependencies | |
libsdl2-dev \ | |
libsdl2_image-dev \ | |
libsdl2_mixer-dev \ | |
libsdl2_ttf-dev \ | |
libgstreamer1.0-dev \ | |
libgstreamer-plugins-base1.0-dev \ | |
libmtdev-dev \ | |
# Add xvfb | |
xvfb | |
# Add steps for macOS dependencies if needed (e.g., using brew) | |
# - name: Install macOS dependencies (if applicable) | |
# if: runner.os == 'macOS' | |
# run: | | |
# brew install sdl2 # Example | |
- name: Install PyInstaller | |
run: python -m pip install --upgrade pip pyinstaller | |
# --- Build GUI --- | |
- name: Install GUI dependencies (includes Kivy) | |
run: pip install -r requirements.kivy.txt # This should include CLI deps too | |
- name: Build GUI executable (${{ matrix.os_name }}) | |
# Wrap pyinstaller command with xvfb-run for Linux builds | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
xvfb-run --auto-servernum pyinstaller fiscalberry-gui.spec | |
else | |
pyinstaller fiscalberry-gui.spec | |
fi | |
- name: Rename GUI artifact | |
shell: bash # Use bash for consistent mv/move commands | |
run: | | |
mv ${{ matrix.artifact_path_gui }} artifacts/fiscalberry-gui-${{ matrix.asset_suffix_gui }} | |
# --- Build GUI --- | |
- name: Install GUI dependencies (includes Kivy) | |
run: pip install -r requirements.kivy.txt # This should include CLI deps too | |
- name: Build GUI executable (${{ matrix.os_name }}) | |
run: pyinstaller fiscalberry-gui.spec | |
- name: Rename GUI artifact | |
shell: bash # Use bash for consistent mv/move commands | |
run: | | |
mv ${{ matrix.artifact_path_gui }} artifacts/fiscalberry-gui-${{ matrix.asset_suffix_gui }} | |
- name: Upload executables artifact (${{ matrix.os_name }}) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: fiscalberry-executables-${{ matrix.os_name }} | |
path: artifacts/ | |
build-raspberry-pi-cli: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build Docker image for ARM | |
run: | | |
docker buildx build --platform linux/arm64 -t fiscalberry-arm --load -f Dockerfile.build . | |
- name: Run Docker container to build Pi CLI | |
run: | | |
docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace fiscalberry-arm /bin/bash -c " | |
pip install -r requirements.cli.txt && | |
pyinstaller fiscalberry-cli.spec && | |
ls -la dist" | |
- name: Rename Pi CLI artifact | |
run: | | |
mkdir -p artifacts | |
mv dist/fiscalberry-pi artifacts/fiscalberry-cli-pi-arm64 | |
- name: Upload Pi CLI executable artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: fiscalberry-executables-pi | |
path: artifacts/fiscalberry-cli-pi-arm64 | |
create-release: | |
runs-on: ubuntu-latest | |
needs: [build-desktop, build-raspberry-pi-cli] # Wait for all builds | |
permissions: | |
contents: write # Needed to create release and upload assets | |
steps: | |
- name: Checkout code (optional, needed if release notes use repo files) | |
uses: actions/checkout@v4 | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./artifacts # Download all artifacts into artifacts directory | |
# No 'name' specified to download all artifacts from the workflow run | |
- name: List downloaded artifacts (debugging) | |
run: | | |
find ./artifacts -type f | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} # Use the tag that triggered the workflow | |
release_name: Release ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
# body: | # Optional: Add release notes | |
# Release notes for ${{ github.ref_name }} | |
# - Feature A | |
# - Bugfix B | |
- name: Set upload URL | |
run: echo "UPLOAD_URL=${{ steps.create_release.outputs.upload_url }}" >> $GITHUB_ENV | |
- name: Upload all assets to release | |
shell: bash | |
run: | | |
# Loop through all downloaded artifact directories (one per job/matrix entry) | |
for artifact_dir in ./artifacts/fiscalberry-executables-*; do | |
# Loop through each file in the artifact directory | |
find "$artifact_dir" -type f -print0 | while IFS= read -r -d $'\0' file; do | |
asset_name=$(basename "$file") | |
echo "Uploading $asset_name from $file" | |
gh release upload "${{ github.ref_name }}" "$file" --clobber -R "${{ github.repository }}" | |
done | |
done | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |