Skip to content

Commit

Permalink
integrated flow
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrj committed Jan 29, 2024
1 parent 1acd82f commit 8e2cdf2
Show file tree
Hide file tree
Showing 4 changed files with 209 additions and 9 deletions.
144 changes: 136 additions & 8 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: win_lin_release

on:
push:
branches: [ "main","devel","nuitka" ]
branches: [ "main","devel" ]

permissions: read-all

jobs:
##########################################################################
win-gen-version-build:
win-pyinstaller-gen-version:
runs-on: windows-latest

steps:
Expand Down Expand Up @@ -41,6 +41,7 @@ jobs:
path: ./src/version.txt
if-no-files-found: error

#####################################
- name: convert icons to python source
working-directory: ./scripts
run: "icons.convert.bat"
Expand All @@ -52,17 +53,119 @@ jobs:
run: "pyinstaller.run.bat"
shell: cmd

- name: upload win distro
#####################################
- name: upload win pyinstaller distro
uses: actions/upload-artifact@v4
with:
name: pyinstaller-win
path: ./build-pyinstaller/librer.win.zip
if-no-files-found: error

##########################################################################
build-lin-release:
win-nuitka:
needs: [win-pyinstaller-gen-version]
runs-on: windows-latest

steps:
- name: checkout
uses: actions/checkout@v4

- name: python setup
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
check-latest: true

- name: pip upgrade
run: python -m pip install --upgrade pip

- name: install requirements
run: pip install -r requirements.txt

#####################################
- name: version download
uses: actions/download-artifact@v4
with:
name: version
path: ./src

#####################################
- name: convert icons to python source
working-directory: ./scripts
run: "icons.convert.bat"
shell: cmd

#####################################
- name: run nuitka
working-directory: ./scripts
run: "nuitka.run.bat"
shell: cmd

#####################################
- name: upload win nuitka distro
uses: actions/upload-artifact@v4
with:
name: nuitka-win
path: ./build-nuitka/librer.win.zip
if-no-files-found: error

##########################################################################
lin-nuitka:
permissions: write-all
needs: [win-gen-version-build]
needs: [win-nuitka]
runs-on: ubuntu-20.04

steps:
- name: checkout
uses: actions/checkout@v4

- name: python setup
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
check-latest: true

- name: pip upgrade
run: python -m pip install --upgrade pip

- name: install requirements
run: pip install -r requirements.txt

- name: strip python binaries
run: find $pythonLocation -name *.so* -type f -exec strip {} \;

#####################################
- name: version download
uses: actions/download-artifact@v4
with:
name: version
path: ./src

#####################################
- name: convert icons to python source
working-directory: ./scripts
run: bash "icons.convert.sh"

#####################################
- name: run nuitka
working-directory: ./scripts
run: bash "nuitka.run.sh"


#####################################
- name: upload lin distro
uses: actions/upload-artifact@v4
with:
name: nuitka-lin
path: ./build-nuitka/librer.lin.zip
if-no-files-found: error

##########################################################################
lin-pyinstaller:
permissions: write-all
needs: [lin-nuitka]
runs-on: ubuntu-20.04

steps:
Expand All @@ -85,6 +188,7 @@ jobs:
- name: strip python binaries
run: find $pythonLocation -name *.so* -type f -exec strip {} \;

#####################################
- name: version download
uses: actions/download-artifact@v4
with:
Expand All @@ -100,6 +204,7 @@ jobs:
working-directory: ./scripts
run: bash "pyinstaller.run.sh"

#####################################
- name: upload lin distro
uses: actions/upload-artifact@v4
with:
Expand All @@ -116,7 +221,7 @@ jobs:
run: mv ./build-pyinstaller/librer.lin.zip ./librer_devel.${{ steps.version.outputs.version }}.portable.linux.zip

#####################################
- name: download windows distro
- name: download windows pyinstaller distro
uses: actions/download-artifact@v4
with:
name: pyinstaller-win
Expand All @@ -125,16 +230,39 @@ jobs:
- name: rename windows distro
run: mv ./librer.win.zip ./librer_devel.${{ steps.version.outputs.version }}.portable.windows.zip

#####################################
- name: download windows nuitka distro
uses: actions/download-artifact@v4
with:
name: nuitka-win
path: ./

- name: rename windows distro
run: mv ./librer.win.zip ./librer_devel.${{ steps.version.outputs.version }}.nuitka.portable.windows.zip

#####################################
- name: download linux nuitka distro
uses: actions/download-artifact@v4
with:
name: nuitka-lin
path: ./

- name: rename linux distro
run: mv ./librer.lin.zip ./librer_devel.${{ steps.version.outputs.version }}.nuitka.portable.linux.zip

#####################################
- name: Create GitHub release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.version }}
name: Release ${{ steps.version.outputs.version }}
draft: false
name: librer-devel Release ${{ steps.version.outputs.version }}
draft: true
prerelease: true
files: |
librer_devel.${{ steps.version.outputs.version }}.portable.linux.zip
librer_devel.${{ steps.version.outputs.version }}.portable.windows.zip
librer_devel.${{ steps.version.outputs.version }}.nuitka.portable.linux.zip
librer_devel.${{ steps.version.outputs.version }}.nuitka.portable.windows.zip
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ psutil==5.9.7
pympler==1.0.1
ciso8601==2.3.1
pywin32==306; sys.platform == 'win32'

nuitka==2.0
35 changes: 35 additions & 0 deletions scripts/nuitka.run.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@cd "%~dp0.."
@echo building with nuitka
@cd src

@set /p VERSION=<version.txt
@SET VERSION=%VERSION:~1,10%
@echo VERSION=%VERSION%

@SET OUTDIR=..\build-nuitka

@if exist %OUTDIR% rmdir /s /q %OUTDIR%
@mkdir %OUTDIR%

@echo.
@echo running-nuitka
@echo wd:%CD%

@echo|set /p="Nuitka " > distro.info.txt
python -m nuitka --version >> distro.info.txt

@echo.
@echo running-nuitka-stage_librer
python -m nuitka --windows-icon-from-ico=./icon.ico --include-data-file=./distro.info.txt=./distro.info.txt --include-data-file=./version.txt=./version.txt --include-data-file=../LICENSE=./LICENSE --output-dir=%outdir% --standalone --lto=yes --follow-stdlib --assume-yes-for-downloads --product-version=%VERSION% --copyright="2023-2024 Piotr Jochymek" --file-description="Librer" --enable-plugin=tk-inter --windows-disable-console --output-filename=librer ./librer.py

@echo.
@echo running-nuitka-stage_record
python -m nuitka --windows-icon-from-ico=./icon.ico --include-data-file=./distro.info.txt=./distro.info.txt --include-data-file=./version.txt=./version.txt --include-data-file=../LICENSE=./LICENSE --output-dir=%outdir% --standalone --lto=yes --follow-stdlib --assume-yes-for-downloads --product-version=%VERSION% --copyright="2023-2024 Piotr Jochymek" --file-description="Librer-record" ./record.py --output-filename=record

move %OUTDIR%\record.dist\record.exe %OUTDIR%\librer.dist
move %OUTDIR%\librer.dist %OUTDIR%\librer

@echo.
@echo packing
powershell Compress-Archive %OUTDIR%\librer %OUTDIR%\librer.win.zip

37 changes: 37 additions & 0 deletions scripts/nuitka.run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

dir="$(readlink -m $(dirname "$0"))"
cd $dir/../src

VERSION=`cat ./version.txt`
VERSION=${VERSION:1:10}
echo VERSION=$VERSION

outdir=../build-nuitka$venvname

rm -rf $outdir
mkdir $outdir

echo ''
echo running-nuitka
echo wd:`pwd`

echo -n "Nuitka: " > distro.info.txt
python3 -m nuitka --version >> distro.info.txt

echo ''
echo running-nuitka-stage_librer
python3 -m nuitka --include-data-file=./distro.info.txt=./distro.info.txt --include-data-file=./version.txt=./version.txt --include-data-file=../LICENSE=./LICENSE --enable-plugin=tk-inter --lto=yes --follow-stdlib --assume-yes-for-downloads --windows-disable-console --output-dir=$outdir --standalone ./librer.py --output-filename=librer

echo ''
echo running-nuitka-stage_record
python3 -m nuitka --include-data-file=./distro.info.txt=./distro.info.txt --include-data-file=./version.txt=./version.txt --include-data-file=../LICENSE=./LICENSE --output-dir=$outdir --lto=yes --follow-stdlib --assume-yes-for-downloads --standalone ./record.py --output-filename=record

mv -v $outdir/record.dist/record $outdir/librer.dist
mv -v $outdir/librer.dist $outdir/librer

echo ''
echo packing
cd $outdir
zip -9 -r -m ./librer.lin.zip ./librer

0 comments on commit 8e2cdf2

Please sign in to comment.