Build and Package CmusicAI for macOS (mac runner) #7
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 and Package CmusicAI for macOS (mac runner) | |
on: | |
workflow_dispatch: | |
jobs: | |
build_and_package: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up dependencies | |
run: | | |
brew update | |
brew install automake libtool boost miniupnpc [email protected] pkg-config protobuf qt librsvg imagemagick | |
- name: Install SDKs and Toolchain | |
run: | | |
mkdir -p depends/SDKs | |
cd depends/SDKs | |
curl -O https://bitcoincore.org/depends-sources/sdks/Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz | |
tar -zxf Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz | |
- name: Extract and Patch Berkeley DB | |
run: | | |
mkdir -p db4 | |
curl -L -o db-4.8.30.NC.tar.gz http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz | |
tar -xzf db-4.8.30.NC.tar.gz | |
cd db-4.8.30.NC | |
sed -i '' 's/^#define HAVE_MUTEX_UNIX_FCNTL 1$/#undef HAVE_MUTEX_UNIX_FCNTL/' dist/configure | |
cd .. | |
- name: Install Berkeley DB | |
run: | | |
chmod +x contrib/install_db4.sh | |
./contrib/install_db4.sh $(pwd) --with-mutex=POSIX/pthreads | |
- name: Generate background.tiff files | |
run: | | |
sed 's/PACKAGE_NAME/CmusicAI Core/' < "contrib/macdeploy/background.svg" > background.temp.svg | |
rsvg-convert -f png -d 36 -p 36 background.temp.svg -o dpi36.background.png | |
convert dpi36.background.png dpi36.background.tiff | |
rsvg-convert -f png -d 72 -p 72 background.temp.svg -o dpi72.background.png | |
convert dpi72.background.png dpi72.background.tiff | |
- name: Prepare Build Environment | |
run: | | |
cd ${GITHUB_WORKSPACE} | |
if [ ! -f ./configure ]; then | |
./autogen.sh | |
fi | |
- name: Ensure Configure Script | |
run: | | |
if [ ! -f ./configure ]; then | |
echo "Error: configure script not found." | |
exit 1 | |
fi | |
- name: Configure Build | |
run: | | |
set -x | |
cd ${GITHUB_WORKSPACE} | |
export BDB_PREFIX=${GITHUB_WORKSPACE}/db4 | |
export BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" | |
export BDB_CFLAGS="-I${BDB_PREFIX}/include" | |
export BOOST_ROOT=$(brew --prefix boost) | |
export BOOST_LIB_PATH=$(brew --prefix boost)/lib | |
export CPPFLAGS="-I/usr/local/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include" | |
export LDFLAGS="-L/usr/local/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib" | |
export CXXFLAGS="-std=c++17" | |
export CFLAGS="-std=c11" | |
CONFIG_SITE=${GITHUB_WORKSPACE}/depends/x86_64-apple-darwin14/share/config.site \ | |
./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking --enable-reduce-exports --disable-bench --with-gui=qt5 --with-boost=${BOOST_ROOT} --with-boost-libdir=${BOOST_LIB_PATH} --enable-debug | |
- name: Build CmusicAI | |
run: | | |
make -j$(sysctl -n hw.ncpu) | |
- name: Ensure Permissions | |
run: | | |
chmod -R 755 ${GITHUB_WORKSPACE} | |
- name: Install and Package | |
run: | | |
make deploy | |
cd unsigned-app-cmusicai | |
find . | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${GITHUB_WORKSPACE}/release/cmusicai-${{ github.sha }}-osx-unsigned.tar.gz | |
cd ${GITHUB_WORKSPACE}/release | |
for i in cmusicai-${{ github.sha }}-macos.tar.gz cmusicai-${{ github.sha }}-osx-unsigned.tar.gz cmusicai-${{ github.sha }}-osx-unsigned.dmg; do | |
if [ -e ${i} ]; then | |
md5sum ${i} >> ${i}.md5sum | |
sha256sum ${i} >> ${i}.sha256sum | |
fi | |
done | |
- name: Upload Package Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: cmusicai-package | |
path: | | |
release/cmusicai-${{ github.sha }}-macos.tar.gz | |
release/cmusicai-${{ github.sha }}-macos.tar.gz.md5sum | |
release/cmusicai-${{ github.sha }}-macos.tar.gz.sha256sum | |
release/cmusicai-${{ github.sha }}-osx-unsigned.tar.gz | |
release/cmusicai-${{ github.sha }}-osx-unsigned.tar.gz.md5sum | |
release/cmusicai-${{ github.sha }}-osx-unsigned.tar.gz.sha256sum | |
release/cmusicai-${{ github.sha }}-osx-unsigned.dmg | |
release/cmusicai-${{ github.sha }}-osx-unsigned.dmg.md5sum | |
release/cmusicai-${{ github.sha }}-osx-unsigned.dmg.sha256sum | |
- name: Create macOS app bundle | |
run: | | |
mkdir -p CmusicAI-Qt.app/Contents/MacOS | |
cp src/qt/cmusicai-qt CmusicAI-Qt.app/Contents/MacOS/CmusicAI-Qt | |
- name: Upload config.log | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: config-log | |
path: ${GITHUB_WORKSPACE}/depends/work/build/x86_64-apple-darwin14/native_cctools/*/cctools/config.log |