Build #20
Workflow file for this run
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 workflow builds the AYAB release packages | |
# for Windows, Mac OSX, and Ubuntu/Debian Linux. | |
# | |
# The build starts when a version tag is pushed. | |
# Release assets are also uploaded as workflow | |
# artifacts, so that they are still available | |
# for test releases after the release and its | |
# tag have been deleted. | |
# | |
# Script adapted from https://github.com/trappitsch/fbs-release-github-actions | |
# | |
# @author Tom Price | |
# @date July 2020 | |
name: Build | |
on: | |
push: | |
tags: | |
- "v?[0-9]+.[0-9]+.[0-9]+-?[a-zA-Z0-9]*" | |
jobs: | |
deploy: | |
name: Create and deploy source code documentation | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install dependencies for doxygen | |
run: | | |
sudo apt-get install doxygen graphviz -y | |
- name: Create .nojekyll so that filenames with underscores work on Github Pages | |
run: | | |
mkdir -p docs/html | |
touch docs/html/.nojekyll | |
- name: Deploy to pages | |
uses: DenverCoder1/doxygen-github-pages-action@v1.3.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
folder: docs/html | |
config_file: Doxyfile | |
build-windows: | |
name: Create and upload Windows release | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
python-version: [3.11] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: ./.github/actions/init-environment | |
id: vars | |
- name: Get firmware version matching manifest | |
shell: bash | |
run: | | |
cd src/main/resources/base/ayab/firmware/ | |
curl -O ${{ steps.vars.outputs.firmware-url }} | |
- name: Install dependencies | |
shell: pwsh | |
run: | | |
choco install patch | |
choco install vcredist-all # fixes dependency on msvcr100.dll | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade setuptools | |
python -m pip install -r requirements.build.txt | |
python -m pip install -r windows-build\windows_build_requirements.txt | |
- name: Convert UI and translation files | |
run: | | |
bash setup-environment.ps1 | |
- name: Remove unneeded files | |
shell: bash | |
run: | | |
rm src/main/python/main/ayab/*_gui.ui | |
rm src/main/python/main/ayab/ayab_logo_rc.qrc | |
- name: Change line endings to CRLF | |
shell: bash | |
run: | | |
for f in $(ls /main/python/main/ayab/*_gui.py) | |
do | |
unix2dos $f | |
done | |
for f in $(ls /main/python/main/ayab/engine/*_gui.py) | |
do | |
unix2dos $f | |
done | |
- name: Check cached files | |
shell: bash | |
run: | | |
pwd | |
ls -l src/main/python/main/ayab/ | |
ls -l src/main/resources/base/ayab/translations/ | |
- name: Build app | |
shell: pwsh | |
run: python -m fbs freeze | |
- name: Create installer | |
shell: pwsh | |
run: | | |
python -m fbs installer | |
Move-Item -Path target\AYABSetup.exe -Destination target\AYAB-${{ steps.vars.outputs.tag }}.exe | |
- name: Upload asset | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ steps.vars.outputs.tag }} | |
commit: ${{ steps.vars.outputs.sha }} | |
body: "" # release message, alternative to body_path | |
# body_path: release_text.md # uncomment if not used | |
draft: ${{ steps.vars.outputs.draft }} | |
prerelease: false | |
allowUpdates: true | |
artifacts: target/AYAB-${{ steps.vars.outputs.tag }}.exe | |
artifactContentType: application/exe | |
replacesArtifacts: true | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: AYAB-${{ steps.vars.outputs.tag }}.exe | |
path: target/AYAB-${{ steps.vars.outputs.tag }}.exe | |
build-macos: | |
name: Create and upload Mac OSX release | |
runs-on: macos-14 | |
strategy: | |
matrix: | |
python-version: [3.11] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: ./.github/actions/init-environment | |
id: vars | |
- name: Get firmware version matching manifest | |
shell: bash | |
run: | | |
cd src/main/resources/base/ayab/firmware/ | |
curl -O ${{ steps.vars.outputs.firmware-url }} | |
- name: Install dependencies | |
shell: zsh {0} | |
run: | | |
# brew install avrdude | |
# brew install qt | |
mkdir tmp-wheel/ | |
python -m pip install delocate | |
# Find platform values on e.g. https://pypi.org/project/numpy/1.26.4/#files | |
python -m pip download --only-binary=:all: --platform macosx_10_09_x86_64 "$(grep numpy requirements.build.txt)" | |
python -m pip download --only-binary=:all: --platform macosx_11_0_arm64 "$(grep numpy requirements.build.txt)" | |
delocate-fuse numpy*arm* numpy*x86* -w tmp-wheel/ | |
python -m pip download --only-binary=:all: --platform macosx_10_10_x86_64 "$(grep Pillow requirements.build.txt)" | |
python -m pip download --only-binary=:all: --platform macosx_11_0_arm64 "$(grep Pillow requirements.build.txt)" | |
delocate-fuse Pillow*arm* Pillow*x86* -w tmp-wheel/ | |
python -m pip download --only-binary=:all: --platform=macosx_10_9_universal2 "$(grep bitarray requirements.build.txt)" | |
python -m pip install tmp-wheel/*.whl bitarray*.whl | |
python -m pip install --no-binary charset_normalizer -r requirements.build.txt | |
- name: Convert UI and translation files | |
run: | | |
bash setup-environment.ps1 | |
- name: Remove unneeded files | |
run: | | |
rm src/main/python/main/ayab/*_gui.ui | |
rm src/main/python/main/ayab/ayab_logo_rc.qrc | |
- name: Check cached files | |
run: | | |
pwd | |
ls -l src/main/python/main/ayab/ | |
ls -l src/main/resources/base/ayab/translations/ | |
- name: Build app | |
run: | | |
python -m fbs freeze | |
codesign -s - --force --all-architectures --timestamp --deep ./target/AYAB-mac.app | |
- name: Create installer | |
run: | | |
python -m fbs installer | |
codesign -s - --force --all-architectures --timestamp --deep ./target/AYAB.dmg | |
mv target/AYAB.dmg target/AYAB-${{ steps.vars.outputs.tag }}.dmg | |
- name: Upload asset | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ steps.vars.outputs.tag }} | |
commit: ${{ steps.vars.outputs.sha }} | |
body: "" # release message, alternative to body_path | |
# body_path: release_text.md # uncomment if not used | |
draft: ${{ steps.vars.outputs.draft }} | |
prerelease: false | |
allowUpdates: true | |
artifacts: target/AYAB-${{ steps.vars.outputs.tag }}.dmg | |
artifactContentType: application/dmg | |
replacesArtifacts: true | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: AYAB-${{ steps.vars.outputs.tag }}.dmg | |
path: target/AYAB-${{ steps.vars.outputs.tag }}.dmg | |
# see https://github.com/AppImage/AppImageKit/wiki/Bundling-Python-apps | |
build-appimage: | |
name: Create and upload Linux AppImage release | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
python-version: [3.11] | |
steps: | |
- name: Checkout repo into AppDir | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: ./.github/actions/init-environment | |
id: vars | |
- name: Get firmware version matching manifest | |
shell: bash | |
run: | | |
cd src/main/resources/base/ayab/firmware/ | |
curl -O ${{ steps.vars.outputs.firmware-url }} | |
- name: Install Python modules | |
run: | | |
sudo apt-get install -y avrdude libasound2-dev | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade setuptools | |
python -m pip install -r requirements.build.txt | |
- name: Convert UI and translation files | |
run: | | |
bash setup-environment.ps1 | |
- name: Relocate | |
run: | | |
mkdir git | |
shopt -s extglob dotglob | |
cp -r !(git) git | |
shopt -u dotglob | |
- name: Download AppImage of Python designed for manylinux | |
run: wget -c https://github.com/niess/python-appimage/releases/download/${{steps.vars.outputs.python}}/${{steps.vars.outputs.python-appimage}} | |
- name: Extract the AppImage | |
run: | | |
chmod +x ${{steps.vars.outputs.python-appimage}} | |
./${{steps.vars.outputs.python-appimage}} --appimage-extract | |
- name: Move repo | |
run: mv git/* squashfs-root | |
- name: Install dependencies | |
run: | | |
cd squashfs-root | |
sudo apt-get install -y avrdude libasound2-dev | |
./AppRun -m pip install --upgrade pip | |
./AppRun -m pip install --upgrade setuptools | |
# hack to fix setup.py script with faulty include | |
./AppRun -m pip install --global-option=build_ext --global-option="-I$(pwd)/opt/${{steps.vars.outputs.python}}/include/${{steps.vars.outputs.python}}" simpleaudio | |
./AppRun -m pip install -r requirements.build.txt | |
- name: Add AppDir subdirectories to PATH | |
run: | | |
echo "usr/bin" >> $GITHUB_PATH | |
echo "opt/${{steps.vars.outputs.python}}/bin" >> $GITHUB_PATH | |
- name: Remove unneeded files | |
run: | | |
rm squashfs-root/src/main/python/main/ayab/*_gui.ui | |
rm squashfs-root/src/main/python/main/ayab/ayab_logo_rc.qrc | |
rm squashfs-root/src/main/python/main/ayab/engine/lowercase_e_rc.qrc | |
rm squashfs-root/src/main/python/main/ayab/engine/lowercase_e_reversed_rc.qrc | |
- name: Check cached files | |
run: | | |
pwd | |
ls -l squashfs-root/src/main/python/main/ayab/ | |
ls -l squashfs-root/src/main/resources/base/ayab/translations/ | |
- name: Replace AppRun | |
run: | | |
cd squashfs-root | |
rm AppRun | |
cp linux-build/appimage/AppRun . | |
- name: Add icon | |
run: | | |
cd squashfs-root | |
rm -f *.png | |
rm -rf usr/share/icons/ | |
cp linux-build/appimage/ayab.png ayab.png | |
mkdir -p usr/share/icons/hicolor/128x128/apps/ | |
cp ayab.png usr/share/icons/hicolor/128x128/apps/ | |
- name: Create desktop file | |
run: | | |
cd squashfs-root | |
rm -f python*.desktop | |
mkdir -p usr/share/applications/ | |
rm -f usr/share/applications/*.desktop | |
cp linux-build/appimage/com.ayab_knitting.ayab.desktop com.ayab_knitting.ayab.desktop | |
cp com.ayab_knitting.ayab.desktop usr/share/applications/com.ayab_knitting.ayab.desktop | |
- name: Add metadata | |
run: | | |
cd squashfs-root | |
mkdir -p usr/share/metainfo/ | |
rm -f usr/share/metainfo/*.appdata.xml | |
cp linux-build/appimage/ayab.appdata.xml usr/share/metainfo/ | |
- name: Convert to AppImage | |
run: | | |
wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep appimagetool-.*-x86_64.AppImage | head -n 1 | cut -d '"' -f 2) | |
chmod +x appimagetool-*-x86_64.AppImage | |
chmod 755 squashfs-root | |
sudo apt install appstream | |
VERSION=${{steps.vars.outputs.tag}} ./appimagetool-*-x86_64.AppImage squashfs-root/ | |
sudo apt remove appstream | |
mv ayab-${{ steps.vars.outputs.tag }}-x86_64.AppImage AYAB-${{ steps.vars.outputs.tag }}-x86_64.AppImage | |
- name: Upload asset | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ steps.vars.outputs.tag }} | |
commit: ${{ steps.vars.outputs.sha }} | |
body: "" # release message, alternative to body_path | |
# body_path: release_text.md # uncomment if not used | |
draft: ${{ steps.vars.outputs.draft }} | |
prerelease: false | |
allowUpdates: true | |
artifacts: AYAB-${{ steps.vars.outputs.tag }}-x86_64.AppImage | |
artifactContentType: application/AppImage | |
replacesArtifacts: true | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: AYAB-${{ steps.vars.outputs.tag }}-x86_64.AppImage | |
path: AYAB-${{ steps.vars.outputs.tag }}-x86_64.AppImage |