Rewrite macOS build workflow and make some changes to build script

This commit is contained in:
Veronica Berglyd Olsen
2023-02-04 19:33:12 +01:00
parent 74ead29433
commit 0e529fd72f
3 changed files with 110 additions and 101 deletions
-98
View File
@@ -1,98 +0,0 @@
name: Build
on:
push:
tags:
- '*'
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: macos-12
name: macos
qt_ver: 5
qt_host: mac
qt_version: '5.15.2'
qt_modules: ''
qt_tools: ''
runs-on: ${{ matrix.os }}
steps:
##
# PREPARE
##
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Set short version
shell: bash
run: |
ver_short=`git rev-parse --short HEAD`
ver_novelwriter=`awk '/^__version__/{print substr($NF,2,length($NF)-2)}' novelwriter/__init__.py`
echo "VERSION=$ver_novelwriter" >> $GITHUB_ENV
echo "VERSION_SHORT=$ver_short" >> $GITHUB_ENV
- name: Install Qt (Linux)
if: runner.os == 'Linux' && matrix.qt_ver != 6
run: |
sudo apt-get -y install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5core5a libqt5network5 libqt5gui5
- name: Install Qt (macOS, AppImage & Windows MSVC)
if: runner.os == 'Linux' && matrix.qt_ver == 6 || runner.os == 'macOS' || (runner.os == 'Windows' && matrix.msystem == '')
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_version }}
host: ${{ matrix.qt_host }}
target: 'desktop'
arch: ${{ matrix.qt_arch }}
modules: ${{ matrix.qt_modules }}
tools: ${{ matrix.qt_tools }}
cache: true
- name: Setup TeX Live
uses: teatimeguest/setup-texlive-action@v2
with:
packages: >-
scheme-basic
collection-latexextra
latexmk
tex-gyre
- name: Install Dependencies (macOS)
if: runner.os == 'macOS'
run: |
pip3 install sphinx
##
# BUILD
##
- name: Build (macOS)
if: runner.os == 'macOS'
run: |
./setup/macos/build.sh
##
# UPLOAD BUILDS
##
- name: Upload binary zip (macOS)
if: runner.os == 'macOS'
uses: actions/upload-artifact@v3
with:
name: novelWriter-${{ env.VERSION }}-${{ matrix.name }}.app.zip
path: dist_macos/novelWriter-${{ env.VERSION }}.app.zip
- name: Upload dmg (macOS)
if: runner.os == 'macOS'
uses: actions/upload-artifact@v3
with:
name: novelWriter-${{ env.VERSION }}-${{ matrix.name }}.dmg
path: dist_macos/novelWriter-${{ env.VERSION }}.dmg
+81
View File
@@ -0,0 +1,81 @@
name: Packaging
on:
push:
tags:
- "*"
pull_request:
branches:
- patch
jobs:
buildAssets:
runs-on: ubuntu-latest
steps:
- name: Python Setup
uses: actions/setup-python@v4
with:
python-version: 3
architecture: x64
- name: Install Packages (apt)
run: |
sudo apt update
sudo apt install qttools5-dev-tools python3-sphinx latexmk texlive texlive-latex-extra
- name: Checkout Source
uses: actions/checkout@v3
- name: Run Build Commands
run: python setup.py qtlrelease sample manual
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: nw-assets-${{ github.sha }}
path: |
novelwriter/assets/sample.zip
novelwriter/assets/manual.pdf
novelwriter/assets/i18n/*.qm
if-no-files-found: error
retention-days: 1
buildMac:
needs: buildAssets
strategy:
fail-fast: false
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get Version
shell: bash
run: |
NW_VERSION=`awk '/^__version__/{print substr($NF,2,length($NF)-2)}' novelwriter/__init__.py`
echo "novelWriter Version: $NW_VERSION"
echo "VERSION=$NW_VERSION" >> $GITHUB_ENV
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: nw-assets-${{ github.sha }}
path: novelwriter/assets
- name: Build
run: |
./setup/macos/build.sh
- name: Upload ZIP
uses: actions/upload-artifact@v3
with:
name: novelWriter-${{ env.VERSION }}-macos.app.zip
path: dist_macos/novelWriter-${{ env.VERSION }}.app.zip
retention-days: 1
- name: Upload DMG
uses: actions/upload-artifact@v3
with:
name: novelWriter-${{ env.VERSION }}-macos.dmg
path: dist_macos/novelWriter-${{ env.VERSION }}.dmg
retention-days: 1
+29 -3
View File
@@ -33,7 +33,33 @@ VERSION="$(awk '/^__version__/{print substr($NF,2,length($NF)-2)}' $SRC_DIR/nove
pushd "$SRC_DIR" || exit 1
python3 setup.py manual qtlrelease sample gen-plist
python3 setup.py gen-plist
if [ -f $SRC_DIR/setup/macos/Info.plist ]; then
echo "Found: setup/macos/Info.plist"
else
echo "Missing: setup/macos/Info.plist"
exit 1
fi
# Check that other assets are present
if [ -f $SRC_DIR/novelwriter/assets/sample.zip ]; then
echo "Found: novelwriter/assets/sample.zip"
else
echo "Missing: novelwriter/assets/sample.zip"
exit 1
fi
if [ -f $SRC_DIR/novelwriter/assets/manual.pdf ]; then
echo "Found: novelwriter/assets/manual.pdf"
else
echo "Missing: novelwriter/assets/manual.pdf"
exit 1
fi
if [ -f $SRC_DIR/novelwriter/assets/i18n/nw_en_US.qm ]; then
echo "Found: novelwriter/assets/i18n/nw_en_US.qm"
else
echo "Missing: novelwriter/assets/i18n/nw_en_US.qm"
exit 1
fi
ls -lah .
@@ -78,7 +104,7 @@ echo "Copying novelWriter to bundle ..."
FILES_COPY=(
"CHANGELOG.md" "MANIFEST.in" "CREDITS.md" "LICENSE.md"
"CONTRIBUTING.md" "CODE_OF_CONDUCT.md" "i18n" "novelwriter"
"CONTRIBUTING.md" "CODE_OF_CONDUCT.md" "novelwriter"
"novelWriter.py"
)
@@ -114,7 +140,7 @@ rm -rf pkgs
rm -rf cmake
rm -rf share/{gtk-,}doc
#remove web engine
# remove web engine
rm lib/python3.*/site-packages/PyQt5/QtWebEngine* || true
rm -r lib/python3.*/site-packages/PyQt5/Qt/translations/qtwebengine* || true
rm lib/python3.*/site-packages/PyQt5/Qt/resources/qtwebengine* || true