Skip to content

Commit

Permalink
use fbs~=1.2 (#554)
Browse files Browse the repository at this point in the history
Co-authored-by: dl1com <1631996+dl1com@users.noreply.github.com>
  • Loading branch information
t0mpr1c3 and dl1com authored Jul 26, 2023
1 parent 7f455f6 commit 16af9f2
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 76 deletions.
79 changes: 41 additions & 38 deletions .github/workflows/build-multi-os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ name: Build
on:
push:
tags:
- 'v*'
- 'test*'
- 'v?[0-9]+.[0-9]+.[0-9]+-?[a-zA-Z0-9]*'

jobs:
setup:
Expand Down Expand Up @@ -62,9 +61,8 @@ jobs:
run: |
echo ${{ steps.vars.outputs.tag }} > src/main/resources/base/ayab/package_version
# remove suffix from semver tag, as fbs does not support them
version_without_suffix=$(echo ${{ steps.vars.outputs.tag }} | sed -E 's/^(v?[0-9]+\.[0-9]+\.[0-9]+).*$/\1/')
sed -i 's/PACKAGE_VERSION/$version_without_suffix/' src/build/settings/base.json
cat src/main/resources/base/ayab/package_version
version_without_suffix=$(echo ${{ steps.vars.outputs.tag }} | sed -E 's/^v?([0-9]+\.[0-9]+\.[0-9]+).*$/\1/')
sed -i -e s/PACKAGE_VERSION/$version_without_suffix/ src/build/settings/base.json
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -113,6 +111,12 @@ jobs:
with:
path: src/main/resources/base/ayab/translations/*.qm
key: qm-${{ hashFiles('src/main/resources/base/ayab/translations/ayab-translation-master.tsv') }}
- name: Use cached `base.json` file
id: base-cache
uses: actions/cache@v3
with:
path: src/build/settings/base.json
key: base-${{ steps.vars.outputs.tag }}
- name: Convert UI and translation files
if: ${{ (steps.gui1-cache.outputs.cache-hit != 'true') ||
(steps.gui2-cache.outputs.cache-hit != 'true') ||
Expand Down Expand Up @@ -145,6 +149,12 @@ jobs:
with:
path: src/main/resources/base/ayab/translations/*.qm
key: qm-${{ hashFiles('src/main/resources/base/ayab/translations/ayab-translation-master.tsv') }}
- name: Cache `base.json` file
if: ${{ (steps.base-cache.outputs.cache-hit != 'true') }}
uses: actions/cache/save@v3
with:
path: src/build/settings/base.json
key: base-${{ steps.vars.outputs.tag }}

deploy:
name: Create and deploy source code documentation
Expand Down Expand Up @@ -189,14 +199,6 @@ jobs:
echo "tag=$(git describe --tags)" >> $GITHUB_OUTPUT
echo "draft=$(git describe --tags | sed -e 's/^test.*/true/;s/^v.*/false/')" >> $GITHUB_OUTPUT
echo "manifest=$(cat src/main/resources/base/ayab/firmware/manifest.txt)" >> $GITHUB_OUTPUT
- name: Set PACKAGE_VERSION
shell: bash
run: |
echo ${{steps.vars.outputs.tag}} > src/main/resources/base/ayab/package_version
# remove suffix from semver tag, as fbs does not support them
version_without_suffix=$(echo ${{ steps.vars.outputs.tag }} | sed -E 's/^(v?[0-9]+\.[0-9]+\.[0-9]+).*$/\1/')
sed -i 's/PACKAGE_VERSION/$version_without_suffix/' src/build/settings/base.json
cat src/main/resources/base/ayab/package_version
- name: Set up Python ${{ matrix.python-version }}
id: py
uses: actions/setup-python@v4
Expand Down Expand Up @@ -251,6 +253,14 @@ jobs:
key: qm-${{ hashFiles('src/main/resources/base/ayab/translations/ayab-translation-master.tsv') }}
enableCrossOsArchive: true
fail-on-cache-miss: true
- name: Restore cached `base.json` file
id: base-cache
uses: actions/cache@v3
with:
path: src/build/settings/base.json
key: base-${{ steps.vars.outputs.tag }}
enableCrossOsArchive: true
fail-on-cache-miss: true
- name: Remove unneeded files
shell: bash
run: |
Expand All @@ -273,16 +283,6 @@ jobs:
pwd
ls -l src/main/python/ayab/
ls -l src/main/resources/base/ayab/translations/
- name: Patch fbs package
shell: pwsh
run: |
$cwd = $(Get-Location).Path
$path = '${{ steps.py.outputs.python-path }}' -Replace '[^\\]*$', ''
echo $path
$fbs = $(Get-ChildItem -Path $path -Depth 3 -Filter 'fbs')[0].FullName + '\..\'
echo $fbs
Set-Location $fbs
patch -u -i $($cwd + '\windows-build\patch-fbs.diff') 'fbs/_defaults/src/installer/windows/Installer.nsi'
- name: Build app
shell: pwsh
run: python -m fbs freeze --debug
Expand Down Expand Up @@ -324,17 +324,11 @@ jobs:
submodules: recursive
- name: Set variables
id: vars
shell: bash
run: |
echo "sha-short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "tag=$(git describe --tags)" >> $GITHUB_OUTPUT
echo "manifest=$(cat src/main/resources/base/ayab/firmware/manifest.txt)" >> $GITHUB_OUTPUT
- name: Set PACKAGE_VERSION
run: |
echo ${{steps.vars.outputs.tag}} > src/main/resources/base/ayab/package_version
# remove suffix from semver tag, as fbs does not support them
version_without_suffix=$(echo ${{ steps.vars.outputs.tag }} | sed -E 's/^(v?[0-9]+\.[0-9]+\.[0-9]+).*$/\1/')
sed -i 's/PACKAGE_VERSION/$version_without_suffix/' src/build/settings/base.json
cat src/main/resources/base/ayab/package_version
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -380,6 +374,14 @@ jobs:
path: src/main/resources/base/ayab/translations/*.qm
key: qm-${{ hashFiles('src/main/resources/base/ayab/translations/ayab-translation-master.tsv') }}
fail-on-cache-miss: true
- name: Restore cached `base.json` file
id: base-cache
uses: actions/cache@v3
with:
path: src/build/settings/base.json
key: base-${{ steps.vars.outputs.tag }}
enableCrossOsArchive: true
fail-on-cache-miss: true
- name: Remove unneeded files
run: |
rm src/main/python/ayab/*_gui.ui
Expand Down Expand Up @@ -438,14 +440,6 @@ jobs:
echo "python=python${{matrix.python-version}}" >> $GITHUB_OUTPUT
echo "manifest=$(cat src/main/resources/base/ayab/firmware/manifest.txt)" >> $GITHUB_OUTPUT
echo "python-appimage=python${{matrix.python-version}}.15-cp36-cp36m-manylinux2014_x86_64.AppImage" >> $GITHUB_OUTPUT
- name: Set PACKAGE_VERSION
run: |
cd git
echo ${{steps.vars.outputs.tag}} > src/main/resources/base/ayab/package_version
# remove suffix from semver tag, as fbs does not support them
version_without_suffix=$(echo ${{ steps.vars.outputs.tag }} | sed -E 's/^(v?[0-9]+\.[0-9]+\.[0-9]+).*$/\1/')
sed -i 's/PACKAGE_VERSION/$version_without_suffix/' src/build/settings/base.json
cat src/main/resources/base/ayab/package_version
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -506,13 +500,22 @@ jobs:
path: src/main/resources/base/ayab/translations/*.qm
key: qm-${{ hashFiles('src/main/resources/base/ayab/translations/ayab-translation-master.tsv') }}
fail-on-cache-miss: true
- name: Restore cached `base.json` file
id: base-cache
uses: actions/cache@v3
with:
path: src/build/settings/base.json
key: base-${{ steps.vars.outputs.tag }}
enableCrossOsArchive: true
fail-on-cache-miss: true
- name: Move cached files
run: |
mv src/main/resources/base/ayab/firmware/*.hex squashfs-root/src/main/resources/base/ayab/firmware/
mv src/main/python/ayab/*_gui.py squashfs-root/src/main/python/ayab/
mv src/main/python/ayab/engine/*_gui.py squashfs-root/src/main/python/ayab/engine/
mv src/main/python/ayab/ayab_logo_rc.py squashfs-root/src/main/python/ayab/
mv src/main/resources/base/ayab/translations/*.qm squashfs-root/src/main/resources/base/ayab/translations/
mv src/build/settings/base.json squashfs-root/src/build/settings/base.json
- name: Remove unneeded files
run: |
rm squashfs-root/src/main/python/ayab/*_gui.ui
Expand Down
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,6 @@ Then convert the PyQt5 `.ui` files and generate the translation files:

.\setup-environment.ps1

Finally, the `fbs` module needs a small patch.

conda install -c free patch
$dir = $(pwd).Path
cd $Env:CONDA_PREFIX\Lib\site-packages\fbs\
patch -u -i $dir\windows-build\patch-fbs.diff _defaults\src\installer\windows\Installer.nsi

Now start AYAB with:

fbs run
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
fbs==0.8.6
PyInstaller==3.4
fbs~=1.2
PyInstaller~=3.4
pyqt5==5.9.2
Pillow==7.1.2
pyserial==3.4
pyserial~=3.4
sliplib==0.4.0
pytest==5.4.1
mock==3.0.5
Expand Down
28 changes: 0 additions & 28 deletions windows-build/patch-fbs.diff

This file was deleted.

0 comments on commit 16af9f2

Please sign in to comment.