macOS CI: build for arm64 (#7132)

* macOS CI: add build for arm64

Additionally builds an arm64 macOS app as well as x86_64 for testing purposes.

* macOS: add architecture to continuous package name

* macOS CI: remove an incorrect processor type directive

* macOS CI: remove a downgraded dependency

* macOS CI: add automake dependency to arm64 config

* macOS CI: try system libraw = ON

* macOS CI: have brew install libra

* macOS: try brew cleanup for libraw uninstall

* macOS CI: don't uninstall libraw first

* macOS CI: test-launch the app

* macOS CI: fix indentation

* macOS CI: list running apps after launch test

* macOS CI: copy app to /Applications for launch test

* macOS CI: add libtool

* macos CI: tst arm64 cli
This commit is contained in:
Richard E Barber 2024-07-28 07:18:05 +07:00 committed by GitHub
parent 1f8d0a6790
commit cee888386f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 115 additions and 9 deletions

View File

@ -25,7 +25,7 @@ jobs:
mkdir build
date +%s > build/stamp
brew uninstall --ignore-dependencies libtiff
brew install libtiff gtk+3 gtkmm3 gtk-mac-integration adwaita-icon-theme libsigc++@2 little-cms2 libiptcdata fftw lensfun expat pkgconfig llvm shared-mime-info exiv2 jpeg-xl libomp automake | tee -a depslog
brew install libtiff gtk+3 gtkmm3 gtk-mac-integration adwaita-icon-theme libsigc++@2 little-cms2 libiptcdata fftw lensfun expat pkgconfig llvm shared-mime-info exiv2 jpeg-xl libomp automake libtool | tee -a depslog
date -u
echo "----====Pourage====----"
cat depslog | grep Pouring
@ -34,23 +34,21 @@ jobs:
env:
CMAKE_CXX_STANDARD: 11
PKG_CONFIG_PATH: /usr/local/opt/libtiff/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/expat/lib/pkgconfig
RAW_THERAPEE_MAJOR: '5'
RAW_THERAPEE_MINOR: '10'
C_FLAGS: >
-arch x86_64 -mtune=generic -Xpreprocessor -fopenmp /usr/local/opt/libomp/lib/libomp.dylib -I/usr/local/opt/libomp/include -I/usr/local/include -I/usr/local/opt/gdk-pixbuf/include -I/usr/local/opt/libiconv/include -I/usr/local/opt/libxml2/include -I/usr/local/opt/expat/include -I/usr/local/opt/libtiff/include
run: |
# GITHUB_REF is the ref that triggered the build, like
# refs/heads/new-feature - the next line parses that to REF: the branch
# name only (new-feature)
export RAW_THERAPEE_VERSION=$(git describe --tags | cut -f1,2 -d'.')
export REF=${GITHUB_REF##*/}
export C_FLAGS=$(echo -e $C_FLAGS | tr -d '\n')
cd build && date -u && date +%s > configstamp
curl -L https://github.com/Homebrew/homebrew-core/raw/679923b4eb48a8dc7ecc1f05d06063cd79b3fc00/Formula/libomp.rb -o libomp.rb && brew install --formula libomp.rb
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_EXE_LINKER_FLAGS="-L. -L/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib -L/usr/local/opt/gdk-pixbuf/lib -L/usr/local/opt/libiconv/lib -L/usr/local/opt/libomp/lib -L/usr/local/opt/libffi/lib -L/usr/local/opt/libffi/lib -L/usr/local/opt/libxml2/lib -L/usr/local/opt/expat/lib" \
-DCACHE_NAME_SUFFIX="${RAW_THERAPEE_MAJOR}.${RAW_THERAPEE_MINOR}-${REF}" \
-DCACHE_NAME_SUFFIX="${RAW_THERAPEE_VERSION}-${REF}" \
-DPROC_TARGET_NUMBER="1" \
-DPROC_LABEL="generic processor" \
-DCMAKE_OSX_ARCHITECTURES=$(uname -m) \
@ -67,8 +65,9 @@ jobs:
-DOpenMP_libomp_LIBRARY=/usr/local/opt/libomp/lib/libomp.dylib \
-DCMAKE_AR=/usr/bin/ar \
-DCMAKE_RANLIB=/usr/bin/ranlib \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-DOSX_CONTINUOUS=ON \
-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 \
-DCONTINUOUS=ON \
-DCODESIGNID:STRING="-" \
..
zsh -c 'echo "Configured in $(printf "%0.2f" $(($[$(date +%s)-$(cat configstamp)]/$((60.))))) minutes"'
- name: Compile RawTherapee
@ -105,7 +104,114 @@ jobs:
run: |
date -u
zsh -c 'echo "Build completed in $(printf "%0.2f" $(($[$(date +%s)-$(cat build/stamp)]/$((60.))))) minutes"'
- name: Test-launch the app
run: |
cd build
sudo cp -R RawTherapee.app /Applications
open -a RawTherapee
sleep 5
osascript -e 'tell application "Finder"' -e 'get the name of every process whose visible is true' -e 'end tell'
osascript -e 'tell application "RawTherapee" to if it is running then quit'
- name: Publish artifacts
uses: softprops/action-gh-release@v2
if: ${{github.ref_type == 'tag' || github.ref_name == 'dev'}}
with:
tag_name: nightly-github-actions
files: |
${{env.ARTIFACT_PATH}}
armbuild:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
date -u
mkdir build
date +%s > build/stamp
brew uninstall --ignore-dependencies libtiff
brew install libtiff gtk+3 gtkmm3 gtk-mac-integration adwaita-icon-theme libsigc++@2 little-cms2 libiptcdata fftw lensfun expat pkgconfig llvm shared-mime-info exiv2 jpeg-xl libomp automake libtool | tee -a depslog
date -u
echo "----====Pourage====----"
cat depslog | grep Pouring
zsh -c 'echo "Completed installation of dependencies in $(printf "%0.2f" $(($[$(date +%s)-$(cat build/stamp)]/$((60.))))) minutes"'
- name: Configure build system
env:
CMAKE_CXX_STANDARD: 11
PKG_CONFIG_PATH: /opt/homebrew/opt/libtiff/lib/pkgconfig:opt/homebrew/opt/libffi/lib/pkgconfig:/ope/homebrew/opt/expat/lib/pkgconfig
C_FLAGS: >
-arch arm64 -Xpreprocessor -fopenmp /opt/homebrew/opt/libomp/lib/libomp.dylib -I/opt/homebrew/opt/libomp/include -I/opt/homebrew/include -I/opt/homebrew/opt/gdk-pixbuf/include -I/opt/homebrew/opt/libiconv/include -I/opt/homebrew/opt/libxml2/include -I/opt/homebrew/opt/expat/include -I/opt/homebrew/opt/libtiff/include
run: |
# GITHUB_REF is the ref that triggered the build, like
# refs/heads/new-feature - the next line parses that to REF: the branch
# name only (new-feature)
export RAW_THERAPEE_VERSION=$(git describe --tags | cut -f1,2 -d'.')
export REF=${GITHUB_REF##*/}
export C_FLAGS=$(echo -e $C_FLAGS | tr -d '\n')
cd build && date -u && date +%s > configstamp
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_EXE_LINKER_FLAGS="-L. -L/opt/homebrew/lib -Wl,-rpath -Wl,/opt/homebrew/lib -L/opt/homebrew/opt/gdk-pixbuf/lib -L/opt/homebrew/opt/libiconv/lib -L/opt/homebrew/opt/libomp/lib -L/opt/homebrew/opt/libffi/lib -L/opt/homebrew/opt/libffi/lib -L/opt/homebrew/opt/libxml2/lib -L/opt/homebrew/opt/expat/lib" \
-DCACHE_NAME_SUFFIX="${RAW_THERAPEE_VERSION}-${REF}" \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DWITH_LTO="ON" \
-DLENSFUNDBDIR="/Applications/RawTherapee.app/Contents/Resources/share/lensfun" \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_FLAGS="-arch arm64 -Wno-pass-failed -Wno-deprecated-register -Wno-unused-command-line-argument" \
-DCMAKE_CXX_FLAGS="-arch arm64 -Wno-pass-failed -Wno-deprecated-register -Wno-unused-command-line-argument" \
-DOpenMP_C_FLAGS="${C_FLAGS}" \
-DOpenMP_CXX_FLAGS="${C_FLAGS}" \
-DOpenMP_C_LIB_NAMES=libomp \
-DOpenMP_CXX_LIB_NAMES=libomp \
-DOpenMP_libomp_LIBRARY=/opt/homebrew/opt/libomp/lib/libomp.dylib \
-DCMAKE_AR=/usr/bin/ar \
-DCMAKE_RANLIB=/usr/bin/ranlib \
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
-DCONTINUOUS=ON \
-DCODESIGNID:STRING="-" \
..
zsh -c 'echo "Configured in $(printf "%0.2f" $(($[$(date +%s)-$(cat configstamp)]/$((60.))))) minutes"'
- name: Compile RawTherapee
run: |
date -u && date +%s > build/compilestamp
cd build
export REF=${GITHUB_REF##*/}
make -j$(sysctl -a | grep machdep.cpu.thread_count | tail -c 2) install
zsh -c 'echo "Compiled in $(printf "%0.2f" $(($[$(date +%s)-$(cat compilestamp)]/$((60.))))) minutes"'
- name: Create application bundle
run: |
zsh
date +%s > build/bundlestamp && date -u && cd build
export REF=${GITHUB_REF##*/} && export LOCAL_PREFIX=/usr && sudo make macosx_bundle
export ARTIFACT=(RawTherapee*${CMAKE_BUILD_TYPE}.zip)
echo "=== artifact: ${ARTIFACT}"
# defining environment variables for next step as per
# https://github.com/actions/starter-workflows/issues/68
echo "ARTIFACT_PATH=${GITHUB_WORKSPACE}/build/${ARTIFACT}" >> $GITHUB_ENV
echo "ARTIFACT_FILE=${ARTIFACT}" >> $GITHUB_ENV
zsh -c 'echo "Bundled in $(printf "%0.2f" $(($[$(date +%s)-$(cat bundlestamp)]/$((60.))))) minutes"'
printf '%s\n' \
"REF: ${REF}" \
"ARTIFACT: ${ARTIFACT}" \
"ARTIFACT_PATH: ${ARTIFACT_PATH}" \
"ARTIFACT_FILE: ${ARTIFACT_FILE}" \
"PUBLISH_NAME: ${PUBLISH_NAME}"
exit
- uses: actions/upload-artifact@v4
with:
name: ${{env.ARTIFACT_FILE}}
path: ${{env.ARTIFACT_PATH}}
- name: Finish build
run: |
date -u
zsh -c 'echo "Build completed in $(printf "%0.2f" $(($[$(date +%s)-$(cat build/stamp)]/$((60.))))) minutes"'
- name: Test-launch the app
run: |
cd build
sudo cp -R RawTherapee.app /Applications
time RawTherapee_*/rawtherapee-cli
- name: Publish artifacts
uses: softprops/action-gh-release@v2
if: ${{github.ref_type == 'tag' || github.ref_name == 'dev'}}

View File

@ -484,7 +484,7 @@ function CreateDmg {
if test -z "${BRANCH}"; then
BRANCH=$(git rev-parse --short HEAD)
fi
mv "${PROJECT_NAME}_macOS_${arch}_latest.zip" "${PROJECT_NAME}_${BRANCH}_macOS_${CMAKE_BUILD_TYPE}.zip"
mv "${PROJECT_NAME}_macOS_${arch}_latest.zip" "${PROJECT_NAME}_${BRANCH}_macOS_${arch}_${CMAKE_BUILD_TYPE}.zip"
fi
}