github:add macos homebrew based package github action

This commit is contained in:
Xiao YiFang 2022-08-07 00:33:10 +08:00
parent f47162e280
commit f0e3c38970
7 changed files with 283 additions and 3 deletions

View file

@ -110,7 +110,7 @@ jobs:
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.targetName }}.dmg file: ${{ env.targetName }}.dmg
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_${{steps.vars.outputs.release_date}}.dmg asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_universal_${{steps.vars.outputs.release_date}}.dmg
tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true overwrite: true
release_name: GoldenDict-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }} release_name: GoldenDict-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}

77
.github/workflows/macos-m1-PR-check.yml vendored Normal file
View file

@ -0,0 +1,77 @@
name: macos-m1-PR-check
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
pull_request:
branches:
- dev
- master
- staged
paths-ignore:
- 'docs/**'
- ".github/**"
- "howto/**"
- "*.md"
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12]
qt_ver: [6.3.1]
qt_arch: [clang_64]
env:
targetName: GoldenDict
steps:
# - name: prepare env
# run: |
# cd /opt
# mkdir homebrew
# curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
# export PATH=$PATH:/opt/homebrew/bin
- name: Install Qt
uses: xiaoyifang/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
arch: ${{ matrix.qt_arch }}
cached: 'false'
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set outputs
id: githash
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: build macos
run: |
brew install pcre2 harfbuzz freetype
brew install cmake ninja python
brew install automake
brew install autoconf
brew install libtool
brew install opencc
brew install ffmpeg@5
#brew reinstall $(brew deps ffmpeg) ffmpeg
brew install libao
brew install libiconv
brew install lzo bzip2
brew install libogg
brew install zstd lzip
brew install libtiff
brew install libvorbis --force
brew install hunspell
brew install pkg-config
- name: compile
run: |
qmake CONFIG+=release CONFIG+=no_macos_universal CONFIG+=zim_support CONFIG+=no_extra_tiff_handler #CONFIG+=no_epwing_support # CONFIG+=no_ffmpeg_player #CONFIG+=no_qtmultimedia_player
make

154
.github/workflows/macos-m1.yml vendored Normal file
View file

@ -0,0 +1,154 @@
name: macos-m1
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
# workflow_run:
# workflows: [AutoTag]
# types: [completed]
workflow_dispatch:
push:
branches:
- dev
- master
# - staged
paths-ignore:
- 'docs/**'
- ".github/**"
- "howto/**"
- "*.md"
- ".clang-format"
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12]
qt_ver: [6.3.1]
qt_arch: [clang_64]
env:
targetName: GoldenDict
steps:
# - name: prepare env
# run: |
# cd /opt
# mkdir homebrew
# curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
# export PATH=$PATH:/opt/homebrew/bin
- name: Install Qt
uses: xiaoyifang/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
arch: ${{ matrix.qt_arch }}
cached: 'false'
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set outputs
id: githash
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: build macos
run: |
brew install pcre2 harfbuzz freetype
brew install cmake ninja python
brew install automake
brew install autoconf
brew install libtool
brew install opencc
brew install ffmpeg@5
#brew reinstall $(brew deps ffmpeg) ffmpeg
brew install libao
brew install libiconv
brew install lzo bzip2
brew install libogg
brew install zstd lzip
brew install libtiff
brew install libvorbis --force
brew install hunspell
brew install pkg-config
brew install create-dmg
- name: compile
run: |
qmake CONFIG+=release CONFIG+=no_macos_universal CONFIG+=zim_support CONFIG+=no_extra_tiff_handler #CONFIG+=no_epwing_support # CONFIG+=no_ffmpeg_player #CONFIG+=no_qtmultimedia_player
make
# # 打包
# - name: package
# run: |
# macdeployqt ${targetName}.app -qmldir=. -verbose=1 -dmg
# 打包
- name: package
run: |
macdeployqt ${targetName}.app -qmldir=. -verbose=1
codesign --force --deep -s - GoldenDict.app
# otool -L GoldenDict.app/Contents/MacOS/GoldenDict
# otool -L GoldenDict.app/Contents/Frameworks/lib*
mkdir tmp
mv ${targetName}.app ./tmp
# --background "installer_background.png"
create-dmg --volname "${targetName} Installer" --volicon "icons/macicon.icns" --window-pos 200 120 --window-size 800 400 --icon-size 100 --icon "${targetName}.app" 200 190 --hide-extension "${targetName}.app" --app-drop-link 600 185 --skip-jenkins "${targetName}.dmg" tmp/
- name: Generate changelog
if: ${{!env.prerelease}}
id: changelog1
uses: metcalfc/changelog-generator@v3.0.0
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
- name: Set outputs
id: vars
run: |
echo "::set-output name=sha_short::$(git rev-parse --short=8 HEAD)"
echo "::set-output name=release_date::$(date +'%Y%m%d')"
echo "::set-output name=release_time::$(date +'%H%M%S')"
echo "::set-output name=release_time_clock::$(date +'%H:%M:%S')"
echo "::set-output name=release_hm::$(date +'%y%m%d')"
- name: changelog
if: $${{env.prerelease}}
id: changelog2
run: |
previousTag=$(git tag --sort=-creatordate | sed -n 2p)
echo "previousTag : $previousTag"
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
CHANGELOG="${CHANGELOG//'%'/'%25'}"
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
CHANGELOG="${CHANGELOG//'\"'/'%22'}"
CHANGELOG="${CHANGELOG//"'"/ }"
echo "::set-output name=COMMIT_SUMMARY::$(echo "$CHANGELOG")"
# tag 上传Release
- name: uploadRelease
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.targetName }}.dmg
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_homebrew_${{steps.vars.outputs.release_date}}.dmg
tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: GoldenDict-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: ${{env.prerelease}}
body: |
release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}}
branch: ${{ github.ref_name }}
commit: ${{ steps.vars.outputs.sha_short }}
Qt version: Qt5.15.2, Qt6.X
Windows built with: msvc64, Visual studio 2019
## goldendict.exe can not be used alone
if you have a previous version. replace this maybe ok. if not ,download the whole bundle.
AppImage built with: Ubuntu-20.04 ,latest gcc
macos built with: macos-10.15,macos-11.0,clang_64 x86_64
Qt6.X(Universal Build)
Qt5.15.2(Intel Kind)
auto built by github action. use on your on risk:-)
**recommend version**:Qt6.X (with the latest bug fixes and performance enhancements)
Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]**
CHANGES:
${{ steps.changelog1.outputs.changelog }}
${{ steps.changelog2.outputs.COMMIT_SUMMARY }}

View file

@ -23,7 +23,12 @@
// speed improvements. // speed improvements.
#ifdef __BTREE_USE_LZO #ifdef __BTREE_USE_LZO
#ifndef INCLUDE_LIBRARY_PATH
#include <lzo1x.h>
#else
#include <lzo/lzo1x.h> #include <lzo/lzo1x.h>
#endif
namespace { namespace {
struct __LzoInit struct __LzoInit

View file

@ -64,6 +64,10 @@ DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050F00
DEFINES += MAKE_FFMPEG_PLAYER DEFINES += MAKE_FFMPEG_PLAYER
} }
!CONFIG( no_macos_universal ) {
DEFINES += INCLUDE_LIBRARY_PATH
}
CONFIG += exceptions \ CONFIG += exceptions \
rtti \ rtti \
stl \ stl \
@ -198,6 +202,7 @@ mac {
# You will need to use Xcode 3 and Qt Carbon SDK # You will need to use Xcode 3 and Qt Carbon SDK
# if you want the support for PowerPC and/or Mac OS X 10.4 # if you want the support for PowerPC and/or Mac OS X 10.4
# CONFIG += x86 x86_64 ppc # CONFIG += x86 x86_64 ppc
!CONFIG( no_macos_universal ) {
LIBS = -lz \ LIBS = -lz \
-lbz2 \ -lbz2 \
-lvorbisfile \ -lvorbisfile \
@ -205,6 +210,7 @@ mac {
-logg \ -logg \
-lhunspell \ -lhunspell \
-llzo2 -llzo2
!CONFIG( no_ffmpeg_player ) { !CONFIG( no_ffmpeg_player ) {
LIBS += -lao \ LIBS += -lao \
-lswresample \ -lswresample \
@ -214,19 +220,50 @@ mac {
} }
QT_CONFIG -= no-pkg-config QT_CONFIG -= no-pkg-config
CONFIG += link_pkgconfig CONFIG += link_pkgconfig
INCLUDEPATH = $${PWD}/maclibs/include INCLUDEPATH = $${PWD}/maclibs/include
LIBS += -L$${PWD}/maclibs/lib -framework AppKit -framework Carbon LIBS += -L$${PWD}/maclibs/lib -framework AppKit -framework Carbon
}
else{
QT_CONFIG -= no-pkg-config
CONFIG += link_pkgconfig
PKGCONFIG += vorbisfile \
vorbis \
ogg \
lzo2 hunspell
!CONFIG( no_ffmpeg_player ) {
PKGCONFIG += ao \
libavutil \
libavformat \
libavcodec \
libswresample \
}
INCLUDEPATH = /opt/homebrew/include /usr/local/include
INCLUDEPATH += $${PWD}/maclibs/include/
LIBS += -L/opt/homebrew/lib -L/usr/local/lib -framework AppKit -framework Carbon
LIBS += -L$${PWD}/maclibs/lib/
}
OBJECTIVE_SOURCES += lionsupport.mm \ OBJECTIVE_SOURCES += lionsupport.mm \
machotkeywrapper.mm \ machotkeywrapper.mm \
macmouseover.mm \ macmouseover.mm \
speechclient_mac.mm speechclient_mac.mm
ICON = icons/macicon.icns ICON = icons/macicon.icns
QMAKE_INFO_PLIST = myInfo.plist QMAKE_INFO_PLIST = myInfo.plist
!CONFIG( no_macos_universal ) {
QMAKE_POST_LINK = mkdir -p GoldenDict.app/Contents/Frameworks && \ QMAKE_POST_LINK = mkdir -p GoldenDict.app/Contents/Frameworks && \
cp -nR $${PWD}/maclibs/lib/ GoldenDict.app/Contents/Frameworks/ && \ cp -nR $${PWD}/maclibs/lib/ GoldenDict.app/Contents/Frameworks/ && \
mkdir -p GoldenDict.app/Contents/MacOS/help && \ mkdir -p GoldenDict.app/Contents/MacOS/help && \
cp -R $${PWD}/help/*.qch GoldenDict.app/Contents/MacOS/help/ cp -R $${PWD}/help/*.qch GoldenDict.app/Contents/MacOS/help/
}
else{
QMAKE_POST_LINK = mkdir -p GoldenDict.app/Contents/Frameworks && \
cp -nR $${PWD}/maclibs/lib/libeb.dylib GoldenDict.app/Contents/Frameworks/ && \
mkdir -p GoldenDict.app/Contents/MacOS/help && \
cp -R $${PWD}/help/*.qch GoldenDict.app/Contents/MacOS/help/
}
!CONFIG( no_chinese_conversion_support ) { !CONFIG( no_chinese_conversion_support ) {
CONFIG += chinese_conversion_support CONFIG += chinese_conversion_support
QMAKE_POST_LINK += && mkdir -p GoldenDict.app/Contents/MacOS/opencc && \ QMAKE_POST_LINK += && mkdir -p GoldenDict.app/Contents/MacOS/opencc && \

View file

@ -23,7 +23,11 @@
#include <QFileInfo> #include <QFileInfo>
#include <set> #include <set>
#ifndef INCLUDE_LIBRARY_PATH
#include <hunspell.hxx>
#else
#include <hunspell/hunspell.hxx> #include <hunspell/hunspell.hxx>
#endif
#include "gddebug.hh" #include "gddebug.hh"
#include "fsencoding.hh" #include "fsencoding.hh"
#include "utils.hh" #include "utils.hh"

View file

@ -22,8 +22,11 @@
#include <errno.h> #include <errno.h>
#include <zlib.h> #include <zlib.h>
#ifdef INCLUDE_LIBRARY_PATH
#include <lzo/lzo1x.h> #include <lzo/lzo1x.h>
#else
#include <lzo1x.h>
#endif
#include <QtEndian> #include <QtEndian>
#include <QStringList> #include <QStringList>
#include <QByteArray> #include <QByteArray>