From e7b5f19b02512b7424954c868e7bacb93cdff9f2 Mon Sep 17 00:00:00 2001 From: rejbasket <39080670+rejbasket@users.noreply.github.com> Date: Tue, 20 May 2025 17:53:43 +0200 Subject: add linux arm build (#3740) --- .github/workflows/build.yml | 76 ++++++++++++++++++++++++++++++++++++++++- bin/build-distribution-archives | 21 ++++++++++-- bin/build-python | 7 ++-- bin/generate-version-file | 7 +++- 4 files changed, 104 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4ef7c932..5628abd6 100755 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,7 +79,76 @@ jobs: with: name: inkstitch-linux64 path: artifacts + linuxarm64: + runs-on: ubuntu-22.04-arm + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: actions/setup-python@v5 + with: + python-version: '3.11.x' + cache: 'pip' + - name: install dependencies + shell: bash + run: | + sudo apt-get update + sudo gem install fpm + python -m pip install --upgrade pip + python -m pip install wheel + + sudo apt-get install gettext + + # for wxPython + sudo apt install libnotify4 + sudo apt install glib-networking libsdl2-dev libsdl2-2.0-0 + + # for PyGObject + sudo apt install libgirepository1.0-dev libcairo2-dev + + # for shapely + sudo apt install build-essential libgtk-3-dev cmake + + # for numpy + sudo apt install gfortran libopenblas-dev liblapack-dev pkg-config + + uname -a + python --version + python -m pip --version + python -m pip debug + python -m pip install pycairo + python -m pip install PyGObject==3.50.0 + python -m pip install numpy --no-binary numpy + + python -m pip install -r requirements.txt + # for networkx + python -m pip install pandas + python -m pip install pyarrow + + python -m pip install pyinstaller + + echo "${{ env.pythonLocation }}\bin" >> $GITHUB_PATH + - name: Tests + shell: bash + run: | + pytest + - name: Mypy Type Checking + shell: bash + run: | + python -m pip install mypy + python -m mypy --output json | python .github/mypy-github-formatter + continue-on-error: true + - shell: bash + run: | + make dist + env: + BUILD: linux + INKSTITCH_GPG_KEY: ${{ secrets.INKSTITCH_GPG_KEY }} + - uses: actions/upload-artifact@v4 + with: + name: inkstitch-linuxarm64 + path: artifacts linux32: # Node required for actions, install follows # https://github.com/actions/upload-artifact/issues/616 @@ -424,7 +493,7 @@ jobs: release: runs-on: ubuntu-latest - needs: [linux32, linux64, windows64, macx86, macarm64] + needs: [linux32, linux64, linuxarm64, windows64, macx86, macarm64] if: always() steps: - name: determine release info @@ -447,6 +516,11 @@ jobs: with: name: 'inkstitch-linux64' path: 'artifacts/' + - name: download linuxarm64 + uses: actions/download-artifact@v4 + with: + name: 'inkstitch-linuxarm64' + path: 'artifacts/' - name: download linux32 uses: actions/download-artifact@v4 with: diff --git a/bin/build-distribution-archives b/bin/build-distribution-archives index 72da7c7b..1ac920b0 100644 --- a/bin/build-distribution-archives +++ b/bin/build-distribution-archives @@ -112,12 +112,21 @@ if [ "$BUILD" = "linux" ] || [ "$BUILD" = "linux32" ]; then VERSION="0.0.1-${VERSION}" fi + echo -n "$INKSTITCH_GPG_KEY" | base64 -d | gpg --import cat < $HOME/.rpmmacros %_gpg_name EA93BCE2CCD0FB2E77B2CC29E8120E50709E5C44 %_signature gpg EOF + # set the rpm file name for cpu arch + if [[ "$BUILD" = "linux32" ]]; then + linux_arch="i386" + else + linux_arch=${ARCH} + fi + + echo "Creating deb" deb_version="$(sed -E 's/[^a-zA-Z0-9.+]/./g' <<< "$VERSION")" fpm -s dir \ -t deb \ @@ -134,11 +143,13 @@ EOF --verbose \ dist/inkstitch=/opt + echo "Creating rpm" fpm -s dir \ -t rpm \ -n inkstitch \ -v "$VERSION" \ -d "inkscape >= 1.0.0" \ + -a "$linux_arch" \ --rpm-compression xz \ --license "GPL-3.0" \ --description "An open-source machine embroidery design platform based on Inkscape" \ @@ -152,6 +163,12 @@ EOF rpmsign --addsign inkstitch*.rpm mv inkstitch*.deb inkstitch*.rpm artifacts/ - tar -C dist -Jcf artifacts/inkstitch-${VERSION}-${OS}.tar.xz inkstitch - cat "$(dirname "$0")/linux-sh-installer" artifacts/inkstitch-${VERSION}-${OS}.tar.xz > artifacts/inkstitch-${VERSION}-${OS}.sh + # set file name for each cpu arch + if [[ "$BUILD" = "linux32" ]]; then + tar -C dist -Jcf artifacts/inkstitch-${VERSION}-${OS}-i386.tar.xz inkstitch + cat "$(dirname "$0")/linux-sh-installer" artifacts/inkstitch-${VERSION}-${OS}-i386.tar.xz > artifacts/inkstitch-${VERSION}-${OS}-i386.sh + else + tar -C dist -Jcf artifacts/inkstitch-${VERSION}-${OS}-${ARCH}.tar.xz inkstitch + cat "$(dirname "$0")/linux-sh-installer" artifacts/inkstitch-${VERSION}-${OS}-${ARCH}.tar.xz > artifacts/inkstitch-${VERSION}-${OS}-${ARCH}.sh + fi fi diff --git a/bin/build-python b/bin/build-python index 17f49c1e..5a93f610 100755 --- a/bin/build-python +++ b/bin/build-python @@ -2,6 +2,7 @@ set -e info_year=$( date "+%Y" ) +ARCH="$(uname -m)" # PyInstaller v6.x rearranges folder configuration causing broken builds, This re-enables old onedir layout. pyinstaller_args+="--contents-directory . " @@ -20,8 +21,8 @@ if [ "$BUILD" = "osx" ]; then fi elif [ "$BUILD" = "linux" ]; then pyinstaller_args+="--hidden-import gi.repository.Gtk " - pyinstaller_args+="--add-binary /lib/x86_64-linux-gnu/libcrypt.so.1:. " - pyinstaller_args+="--add-binary /lib/x86_64-linux-gnu/libnsl.so.1:. " + pyinstaller_args+="--add-binary /lib/${ARCH}-linux-gnu/libcrypt.so.1:. " + pyinstaller_args+="--add-binary /lib/${ARCH}-linux-gnu/libnsl.so.1:. " elif [ "$BUILD" = "linux32" ]; then pyinstaller_args+="--hidden-import gi.repository.Gtk " pyinstaller_args+="--add-binary /lib/i386-linux-gnu/libcrypt.so.1:. " @@ -63,4 +64,4 @@ shopt -s dotglob mkdir dist/bin mv dist/inkstitch/* dist/bin mv dist/bin dist/inkstitch -mkdir artifacts \ No newline at end of file +mkdir artifacts diff --git a/bin/generate-version-file b/bin/generate-version-file index df3d8459..023fa7b9 100755 --- a/bin/generate-version-file +++ b/bin/generate-version-file @@ -2,9 +2,14 @@ VERSION="${GITHUB_REF##*/}" OS="${BUILD:-$(uname)}" +ARCH="$(uname -m)" DATE=$(date +"%Y-%m-%d %H:%M") if [[ "$VERSION" == "" ]]; then VERSION="Manual Install" fi -echo "${VERSION} (${OS}) ${DATE}" > VERSION +if [[ "$BUILD" = "linux32" ]]; then + echo "${VERSION} (${OS}-i386) ${DATE}" > VERSION +else + echo "${VERSION} (${OS}-${ARCH}) ${DATE}" > VERSION +fi \ No newline at end of file -- cgit v1.2.3