Update Android build configuration and requirements for improved comp… #66
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-22.04, windows-latest] | |
include: | |
- os: ubuntu-22.04 | |
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 | |
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 \ | |
libgl1-mesa-glx libgles2-mesa libegl1-mesa libmtdev1 \ | |
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 }}) | |
# Specify bash shell explicitly for cross-platform compatibility of the script | |
shell: bash | |
# Wrap pyinstaller command with xvfb-run for Linux builds | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
echo "Running PyInstaller with xvfb-run on Linux..." | |
xvfb-run --auto-servernum pyinstaller fiscalberry-gui.spec | |
else | |
echo "Running PyInstaller directly on $RUNNER_OS..." | |
KIVY_NO_WINDOW=1 pyinstaller fiscalberry-gui.spec | |
fi | |
- name: List dist directory contents (after build) # Keep this for debugging if needed | |
if: always() | |
shell: bash # Also use bash here for consistency | |
run: | | |
echo "Listing contents of ./dist directory:" | |
ls -lR ./dist || echo "Dist directory not found or empty." | |
- name: Rename GUI artifact | |
shell: bash # Use bash for consistent mv/move commands | |
run: | | |
mkdir -p artifacts | |
# Ensure the source path exists before moving | |
if [ -e "${{ matrix.artifact_path_gui }}" ]; then | |
echo "Moving ${{ matrix.artifact_path_gui }} to artifacts/fiscalberry-gui-${{ matrix.asset_suffix_gui }}" | |
mv ${{ matrix.artifact_path_gui }} artifacts/fiscalberry-gui-${{ matrix.asset_suffix_gui }} | |
else | |
echo "ERROR: Source file ${{ matrix.artifact_path_gui }} not found!" | |
# Optionally fail the step: exit 1 | |
fi | |
- 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-22.04 | |
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 | |
sudo mv dist/fiscalberry-cli 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-22.04 | |
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 }} |