Backport ARM build for MacOS from 2.5 branch

This commit is contained in:
Veronica Berglyd Olsen
2024-04-21 13:14:38 +02:00
parent cb94be5b3c
commit 4d153b8d99
2 changed files with 61 additions and 15 deletions
+40 -7
View File
@@ -9,7 +9,7 @@ jobs:
- name: Python Setup
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
architecture: x64
- name: Install Packages (apt)
@@ -35,7 +35,7 @@ jobs:
novelwriter/assets/manual.pdf
novelwriter/assets/i18n/*.qm
if-no-files-found: error
retention-days: 1
retention-days: 14
buildLinux:
needs: buildAssets
@@ -72,11 +72,16 @@ jobs:
name: AppImage-${{ matrix.python-version }}-${{ matrix.linux-tag }}
path: dist_appimage
if-no-files-found: error
retention-days: 1
retention-days: 14
buildMac:
buildMac-AMD64:
needs: buildAssets
# Stay on macos-12 due to https://github.com/create-dmg/create-dmg/issues/143
runs-on: macos-12
env:
PYTHON_VERSION: "3.12"
PACKAGE_ARCH: x86_64
MINICONDA_ARCH: x86_64
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -88,12 +93,40 @@ jobs:
path: novelwriter/assets
- name: Build App Bundle
run: ./setup/macos/build.sh
run: ./setup/macos/build.sh $PYTHON_VERSION $PACKAGE_ARCH $MINICONDA_ARCH
- name: Upload DMG
uses: actions/upload-artifact@v4
with:
name: MacOS-DMG
name: MacOS-AMD64-DMG
path: dist_macos
if-no-files-found: error
retention-days: 1
retention-days: 14
buildMac-M1:
needs: buildAssets
runs-on: macos-14
env:
PYTHON_VERSION: "3.12"
PACKAGE_ARCH: aarch64
MINICONDA_ARCH: arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: nw-assets
path: novelwriter/assets
- name: Build App Bundle
run: ./setup/macos/build.sh $PYTHON_VERSION $PACKAGE_ARCH $MINICONDA_ARCH
- name: Upload DMG
uses: actions/upload-artifact@v4
with:
name: MacOS-M1-DMG
path: dist_macos
if-no-files-found: error
retention-days: 14
Executable → Regular
+21 -8
View File
@@ -1,5 +1,18 @@
#! /bin/bash
if [[ -z "$1" || -z "$2" || -z "$3" ]]; then
echo "Not enouch input arguments"
exit 1
fi
PYTHON="$1"
ARCH="$2"
CONDA="$3"
echo "Python Version: $PYTHON"
echo "Architecture: $ARCH"
echo "Miniconda Architecture: $CONDA"
# Use RAM disk if possible
if [ -d /dev/shm ]; then
TEMP_BASE=/dev/shm
@@ -76,13 +89,13 @@ pushd "$BUILD_DIR"/ || exit 1
# --- Create Miniconda Env ---------------------------------------------------------------------- #
echo "Downloading Miniconda ..."
curl -LO https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
bash Miniconda3-latest-MacOSX-x86_64.sh -b -p ~/miniconda -f
rm Miniconda3-latest-MacOSX-x86_64.sh
curl -LO https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-$CONDA.sh
bash Miniconda3-latest-MacOSX-$CONDA.sh -b -p ~/miniconda -f
rm Miniconda3-latest-MacOSX-$CONDA.sh
export PATH="$HOME/miniconda/bin:$PATH"
echo "Creating Conda env ..."
conda create -n novelWriter -c conda-forge python=3.11 --yes
conda create -n novelWriter -c conda-forge python=$PYTHON --yes
source activate novelWriter
echo "Installing dictionaries ..."
@@ -125,8 +138,8 @@ cp $SRC_DIR/setup/macos/novelwriter.icns novelWriter.app/Contents/Resources/
echo "Creating entry script ..."
cat > novelWriter.app/Contents/MacOS/novelWriter << EOF
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
$DIR/../Resources/bin/python -sE $DIR/../Resources/novelWriter/novelWriter.py $@
DIR="\$( cd "\$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
\$DIR/../Resources/bin/python -sE \$DIR/../Resources/novelWriter/novelWriter.py \$@
EOF
# Make it executable
@@ -173,8 +186,8 @@ brew install create-dmg
create-dmg --volname "novelWriter $VERSION" --volicon $SRC_DIR/setup/macos/novelwriter.icns \
--window-pos 200 120 --window-size 800 400 --icon-size 100 \
--icon novelWriter.app 200 190 --hide-extension novelWriter.app \
--app-drop-link 600 185 $RLS_DIR/novelWriter-"${VERSION}"-amd64.dmg "$BUILD_DIR"/
--app-drop-link 600 185 $RLS_DIR/novelWriter-"${VERSION}"-$ARCH.dmg "$BUILD_DIR"/
pushd $RLS_DIR || exit 1
shasum -a 256 novelWriter-"${VERSION}"-amd64.dmg | tee novelWriter-"${VERSION}"-amd64.dmg.sha256
shasum -a 256 novelWriter-"${VERSION}"-$ARCH.dmg | tee novelWriter-"${VERSION}"-$ARCH.dmg.sha256
popd || exit 1