Update build.yml #959
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: [push, pull_request] | |
jobs: | |
build-macos: | |
name: Build macOS | |
runs-on: macos-11 | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [ 'x86_64' ] | |
buildtype: [ 'release' ] | |
steps: | |
- name: Set buildtype | |
shell: bash | |
run: echo "buildtype=$(echo ${{matrix.buildtype}} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Set cmake buildtype | |
shell: bash | |
run: echo "cmake_buildtype=$(echo ${{env.buildtype}} | awk '{print toupper(substr($0,0,1))tolower(substr($0,2))}')" >> $GITHUB_ENV | |
- name: pwd | |
run: pwd | |
- name: Remove packages | |
run: brew uninstall $(brew list) | |
- name: Update packages | |
run: brew update | |
- name: Upgrade packages | |
run: brew upgrade || true | |
- name: Install packages | |
run: brew install cmake gnu-tar gettext create-dmg | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Download macOS dependencies | |
shell: bash | |
run: | | |
version=$(curl -s -f 'https://github.com/strawberrymusicplayer/strawberry-macos-dependencies/releases' | sed -n 's,.*releases/tag/\([^"&;]*\)".*,\1,p' | head -1) | |
echo "version ${version}" | |
curl -f -O -L https://github.com/strawberrymusicplayer/strawberry-macos-dependencies/releases/download/${version}/strawberry-macos-${{matrix.arch}}-${{env.buildtype}}.tar.xz | |
- name: Extract macOS dependencies | |
shell: bash | |
run: tar -xf strawberry-macos-${{matrix.arch}}-${{env.buildtype}}.tar.xz | |
- name: Link directory | |
shell: bash | |
run: | | |
sudo mkdir -p /Users/runner/work/strawberry-macos-dependencies/strawberry-macos-dependencies | |
sudo ln -s $(pwd)/strawberry_macos_${{matrix.arch}}_${{env.buildtype}} /Users/runner/work/strawberry-macos-dependencies/strawberry-macos-dependencies/strawberry_macos_${{matrix.arch}}_${{env.buildtype}} | |
- name: Update PATH | |
shell: bash | |
run: echo "$(pwd)/strawberry_macos_${{matrix.arch}}_${{env.buildtype}}/bin" >> $GITHUB_PATH | |
- name: Find icu | |
shell: bash | |
run: | | |
find $(pwd)/strawberry_macos_${{matrix.arch}}_${{env.buildtype}} -name 'libicu*.dylib' | |
otool -L $(pwd)/strawberry_macos_${{matrix.arch}}_${{env.buildtype}}/lib/libicu*.dylib | |
- name: Create Build Environment | |
run: cmake -E make_directory build | |
- name: Configure CMake | |
env: | |
MACOSX_DEPLOYMENT_TARGET: 11.0 | |
PKG_CONFIG_PATH: ${{env.prefix_path}}/lib/pkgconfig | |
GIO_EXTRA_MODULES: ${{env.prefix_path}}/lib/gio/modules | |
GST_PLUGIN_SCANNER: ${{env.prefix_path}}/libexec/gstreamer-1.0/gst-plugin-scanner | |
GST_PLUGIN_PATH: ${{env.prefix_path}}/lib/gstreamer-1.0 | |
run: cmake -S . -B build -DCMAKE_BUILD_TYPE="${{env.cmake_buildtype}}" -DBUILD_WITH_QT6=ON -DBUILD_WERROR=OFF -DUSE_BUNDLE=ON -DCMAKE_PREFIX_PATH="${{env.prefix_path}}/lib/cmake" -DENABLE_DBUS=OFF -DPROTOBUF_INCLUDE_DIRS="${{env.prefix_path}}/include" || true | |
#-DICU_ROOT="${{env.prefix_path}}" | |
- name: Build | |
working-directory: nuild | |
run: cat CMakeCache.txt | |
- name: Build | |
run: cmake --build build --config Release --parallel 4 | |
- name: Install | |
working-directory: build | |
run: make install | |
- name: Manually copy files not handled by macdeployqt | |
working-directory: build | |
run: | | |
mkdir -p strawberry.app/Contents/Frameworks/ | |
cp ${{env.prefix_path}}/lib/{libsoup-3.0.0.dylib} strawberry.app/Contents/Frameworks/ | |
- name: Deploy | |
working-directory: build | |
run: make deploy | |
- name: Deploy check | |
working-directory: build | |
run: make deploycheck | |
- name: Create DMG | |
working-directory: build | |
run: make dmg | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: macos | |
path: build/*.dmg | |
- name: SSH key setup | |
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci' || github.ref == 'refs/heads/macos' | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}} | |
key: ${{ secrets.SSH_KEY }} | |
- name: Create server path | |
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci' || github.ref == 'refs/heads/macos' | |
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{secrets.BUILDS_PATH}}/macos | |
- name: rsync | |
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci' || github.ref == 'refs/heads/macos' | |
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var build/*.dmg ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/macos/ |