macos-14 github runner:如何启动我的应用程序

问题描述 投票:0回答:1

我正在使用 github actions macos-14 arm64 runner 来测试应用程序的构建,然后进行测试启动以进行验证。 (这是为了启用回归测试。)

在 x86_64 运行器上,这可以正常工作:

   - 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

并给出了正确的结果:

Finder, rawtherapee

arm64 上的相同代码只是挂起并在打开命令时超时操作。现在,我已经临时签署了该应用程序,并想象在默认安全状态下,系统要求进行交互以关闭安全对话框。 我不知道如何克服这一点。 我尝试使用

osascript
open -a
启动,并在
Contents/MacOS
中打开主要的二进制可执行文件。 所有方法都会导致挂起:

34:42: execution error: RawTherapee got an error: AppleEvent timed out. (-1712)
Error: Process completed with exit code 1.

问题也已向 GH 团队提出:https://github.com/actions/runner-images/issues/10329

此处失败的工作流程示例:https://github.com/Benitoite/RawTherapee/actions/runs/10027384234/job/27712986177#step:9:14

注意:该应用程序已沙箱化并经过强化。删除沙箱和运行时权限没有任何效果。

macos github-actions apple-silicon runner macos-sonoma
1个回答
0
投票

临时签名和测试确实按预期工作如果在同一个 CI 运行器实例上一起执行。 这是现在正在运行的 ad-hoc 脚本(构建两个架构和测试):

name: macOS Build
on:
  push:
    branches:
      - dev
      - releases
      - fulltest
      - 'release-[0-9]+.*'
    tags:
      - '[0-9]+.*'
  pull_request:
    branches:
      - dev
      - releases
      - 'release-[0-9]+.*'
  workflow_dispatch:

jobs:
  build:
    runs-on: macos-12
    steps:
      - name: Checkout Repository
        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:
          IDENT: '-'
          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
          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
          export NOTARIZATION=$(echo --apple-id [email protected] --team-id 5SJ86G6Q2R --password $NOTARY)
          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/libomp/lib -L/usr/local/opt/expat/lib" \
            -DCACHE_NAME_SUFFIX="${RAW_THERAPEE_VERSION}-${REF}" \
            -DPROC_TARGET_NUMBER="1" \
            -DPROC_LABEL="generic processor" \
            -DCMAKE_OSX_ARCHITECTURES=$(uname -m) \
            -DWITH_LTO="ON" \
            -DLENSFUNDBDIR="/Applications/RawTherapee.app/Contents/Resources/share/lensfun" \
            -DCMAKE_C_COMPILER=clang \
            -DCMAKE_CXX_COMPILER=clang++ \
            -DCMAKE_C_FLAGS="-arch x86_64 -Wno-pass-failed -Wno-deprecated-register -Wno-unused-command-line-argument" \
            -DCMAKE_CXX_FLAGS="-arch x86_64 -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=/usr/local/opt/libomp/lib/libomp.dylib \
            -DCMAKE_AR=/usr/bin/ar \
            -DCMAKE_RANLIB=/usr/bin/ranlib \
            -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 \
            -DCONTINUOUS=ON \
            -DCODESIGNID:STRING="$IDENT" \
            ..
            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##*/} && 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

      - name: Finish build
        run: |
          date -u
          zsh -c 'echo "Build completed in $(printf "%0.2f" $(($[$(date +%s)-$(cat build/stamp)]/$((60.))))) minutes"'

      - name: test app
        run: |
          sudo cp -R /Users/runner/work/RawTherapee/RawTherapee/build/RawTherapee.app /Applications
          open -a /Applications/RawTherapee.app
          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'


  armbuild:
    runs-on: macos-14
    steps:
      - name: Checkout repository
        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:
          IDENT: '-'
          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
          export NOTARIZATION=$(echo --apple-id [email protected] --team-id 5SJ86G6Q2R --password $NOTARY)
          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/libomp/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="$IDENT" \
            -DLOCAL_PREFIX=/opt/homebrew \
            ..
            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##*/} && 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

      - name: Finish build
        run: |
          date -u
          zsh -c 'echo "Build completed in $(printf "%0.2f" $(($[$(date +%s)-$(cat build/stamp)]/$((60.))))) minutes"'

      - name: test app
        run: |
          sudo cp -R /Users/runner/work/RawTherapee/RawTherapee/build/RawTherapee.app /Applications
          ls /Applications
          open -a /Applications/RawTherapee.app
          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'

在 macOS 14 Sonoma 中,Apple 实现了容器数据保护。

“这里的解决方案是使用稳定的签名身份对代码进行签名。”

per Quinn:更新到 Sonoma 后无法测试 macOS 应用程序

因此,我现在根据以下说明使用 GitHub 存储库秘密使用我的 Apple 开发证书进行签名和公证:https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an -apple-certificate-on-macos-runners-for-xcode-development

这里是 Apple 开发者证书签名和公证的当前工作代码(构建两个架构和测试):

name: macOS Build
on:
  push:
    branches:
      - dev
      - releases
      - 'release-[0-9]+.*'
    tags:
      - '[0-9]+.*'
  pull_request:
    branches:
      - dev
      - releases
      - 'release-[0-9]+.*'
  workflow_dispatch:

jobs:
  build:
    runs-on: macos-12
    steps:
      - uses: actions/checkout@v4
      - name: Install the Apple certificate and provisioning profile
        env:
          BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
          P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
          BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
          KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
        run: |
          # create variables
          CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
          PP_PATH=$RUNNER_TEMP/build_pp.provisionprofile
          KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db

          # import certificate and provisioning profile from secrets
          echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
          echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH

          # create temporary keychain
          security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
          security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
          security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH

          # import certificate to keychain
          security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
          security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
          security list-keychain -d user -s $KEYCHAIN_PATH

          # apply provisioning profile
          mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
          cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
          
      - 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:
          IDENT: 'Developer ID Application: Doctor Who (12345ABCDE)'
          NOTARY: '${{ secrets.NOTARY }}'
          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
          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
          export NOTARIZATION=$(echo --apple-id [email protected] --team-id 12345ABCDE --password $NOTARY)
          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/libomp/lib -L/usr/local/opt/expat/lib" \
            -DCACHE_NAME_SUFFIX="${RAW_THERAPEE_VERSION}-${REF}" \
            -DPROC_TARGET_NUMBER="1" \
            -DPROC_LABEL="generic processor" \
            -DCMAKE_OSX_ARCHITECTURES=$(uname -m) \
            -DWITH_LTO="ON" \
            -DLENSFUNDBDIR="/Applications/RawTherapee.app/Contents/Resources/share/lensfun" \
            -DCMAKE_C_COMPILER=clang \
            -DCMAKE_CXX_COMPILER=clang++ \
            -DCMAKE_C_FLAGS="-arch x86_64 -Wno-pass-failed -Wno-deprecated-register -Wno-unused-command-line-argument" \
            -DCMAKE_CXX_FLAGS="-arch x86_64 -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=/usr/local/opt/libomp/lib/libomp.dylib \
            -DCMAKE_AR=/usr/bin/ar \
            -DCMAKE_RANLIB=/usr/bin/ranlib \
            -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 \
            -DCONTINUOUS=ON \
            -DCODESIGNID:STRING="$IDENT" \
            -DNOTARY:STRING="$NOTARIZATION" \
            ..
            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: 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}}

      - name: test app
        run: |
          sudo cp -R /Users/runner/work/RawTherapee/RawTherapee/build/RawTherapee.app /Applications
          open -a /Applications/RawTherapee.app
          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'


  armbuild:
    runs-on: macos-14
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Install the Apple certificate and provisioning profile
        env:
          BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
          P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
          BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
          KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
        run: |
          # create variables
          CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
          PP_PATH=$RUNNER_TEMP/build_pp.provisionprofile
          KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db

          # import certificate and provisioning profile from secrets
          echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
          echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH

          # create temporary keychain
          security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
          security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
          security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH

          # import certificate to keychain
          security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
          security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
          security list-keychain -d user -s $KEYCHAIN_PATH

          # apply provisioning profile
          mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
          cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
          
      - 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: 
          IDENT: 'Developer ID Application: Doctor Who (12345ABCDE)'
          NOTARY: '${{ secrets.NOTARY }}'
          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
          export NOTARIZATION=$(echo --apple-id [email protected] --team-id 12345ABCDE --password $NOTARY)
          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/libomp/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="$IDENT" \
            -DNOTARY:STRING="$NOTARIZATION" \
            -DLOCAL_PREFIX=/opt/homebrew \
            ..
            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: 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}}
          
      - name: test app
        run: |
          sudo cp -R /Users/runner/work/RawTherapee/RawTherapee/build/RawTherapee.app /Applications
          ls /Applications
          XDG_CONFIG_DIRS=/Applications/RawTherapee.app/Contents/Resources/share/gtk-3.0 XDG_CONFIG_HOME=/Applications/RawTherapee.app/Contents/Resources/share XDG_DATA_DIRS=/Applications/RawTherapee.app/Contents/Resources/share/gtk-3.0 GTK_PATH=/Applications/RawTherapee.app/Contents/Resources/share/gtk-3.0 GTK_IM_MODULE_FILE=/Applications/RawTherapee.app/Contents/Resources/etc/gtk-3.0/gtk.immodules XDG_DATA_HOME=/Applications/RawTherapee.app/Contents/Resources/share GSETTINGS_SCHEMA_DIR=/Applications/RawTherapee.app/Contents/Resources/share/glib-2.0/schemas GDK_PIXBUF_MODULE_FILE=/Applications/RawTherapee.app/Contents/Resources/etc/gtk-3.0/gdk-pixbuf.loaders GDK_PIXBUF_MODULEDIR=/Applications/RawTherapee.app/Contents/Frameworks LIBDIR=/Applications/RawTherapee.app/Contents/Frameworks DATADIR=/Applications/RawTherapee.app/Contents/Resources GDK_RENDERING=similar GTK_OVERLAY_SCROLLING=0 /Applications/RawTherapee.app/Contents/MacOS/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'
© www.soinside.com 2019 - 2024. All rights reserved.