From 0dd4a79822e0992a32a8d1d8bb076e7f12b45db2 Mon Sep 17 00:00:00 2001 From: Will Winder Date: Tue, 6 Oct 2020 01:33:49 -0400 Subject: [PATCH] Add build automation. --- .github/workflows/build.yml | 138 ++++++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 10 +++ 2 files changed, 148 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7590e83 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,138 @@ +name: Build + +on: [push, pull_request] + +jobs: + linux-build: + runs-on: ubuntu-18.04 + steps: + - name: Checkout + uses: actions/checkout@v2.0.0 + - name: Install dependencies + run: sudo apt-get install build-essential cmake pkg-config libftgl-dev qtbase5-dev qttools5-dev librtmidi-dev fluid-soundfont-gm libfluidsynth-dev + - name: Install linuxdeploy + run: | + wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage + wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage + chmod +x linuxdeploy*.AppImage + - name: Build + run: | + mkdir build + cd build + cmake .. -DCMAKE_INSTALL_PREFIX=/usr + make -j$(nproc) + make install DESTDIR=AppDir + # Package + export QT_SELECT=5 + export QML_SOURCES_PATHS="${GITHUB_WORKSPACE}"/src + # initialize AppDir, bundle shared libraries for PianoBooster, use Qt plugin to bundle additional resources, and build AppImage, all in one single command + ../linuxdeploy-x86_64.AppImage --appdir AppDir --plugin qt --output appimage + find . + echo "Done!" + mv *AppImage ../PianoBooster-x86_64.AppImage + ls -lh ../PianoBooster-x86_64.AppImage + - name: Upload Linux Build + uses: actions/upload-artifact@v2 + with: + name: linux-build + path: PianoBooster-x86_64.AppImage + + macos-build: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v2.0.0 + - name: Install dependencies + run: | + brew update || brew update + brew upgrade + brew install cmake qt5 ftgl jack pkg-config fluid-synth + - name: Build + run: | + mkdir build + cd build + cmake .. -DCMAKE_PREFIX_PATH="$(brew --prefix qt)" + make + make install-translations + $(brew --prefix qt)/bin/macdeployqt build/pianobooster.app -dmg + find . + echo "Done!" + mv build/*dmg ../PianoBooster.dmg + ls -lh ../PianoBooster.dmg + - name: Upload Mac Build + uses: actions/upload-artifact@v2 + with: + name: mac-build + path: PianoBooster.dmg + +# windows-build: +# runs-on: windows-latest +# steps: +# - name: Checkout +# uses: actions/checkout@v2.0.0 +# - name: Install dependencies +# uses: lukka/run-vcpkg@v4 +# with: +# vcpkgDirectory: ${{ github.workspace }}/vcpkg +# vcpkgArguments: fluidsynth qt5-base qt5-tools freetype ftgl +# vcpkgGitUrl: 'https://github.com/microsoft/vcpkg.git' +# vcpkgGitCommitId: '56fffbe49dfb4dd8fae0940f272c5fd2b86be991' +# vcpkgTriplet: x64-windows +# - name: +# run: | +# mkdir build +# cd build +# cmake .. -DWITH_INTERNAL_FLUIDSYNTH=OFF -DCMAKE_TOOLCHAIN_FILE="${GITHUB_WORKSPACE}"/vcpkg/scripts/buildsystems/vcpkg.cmake +# cmake --build . +# find . +# shell: bash +# + + deploy: + runs-on: ubuntu-latest + needs: [macos-build, linux-build] + steps: + - name: Download linux build + uses: actions/download-artifact@v2 + with: + name: linux-build + - name: Download mac build + uses: actions/download-artifact@v2 + with: + name: mac-build + - name: Publish snapshot build + #if: contains(github.ref, 'develop') + run: | + find . + ls -la + - name: Linux Snapshot Release + uses: WebFreak001/deploy-nightly@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions + with: + # find out this value by opening https://api.github.com/repos///releases in your browser and copy the full "upload_url" value including the {?name,label} part + upload_url: https://uploads.github.com/repos/winder/PianoBooster/releases/32197618/assets{?name,label} + release_id: 32197618 # same as above (id can just be taken out the upload_url, it's used to find old releases) + asset_path: PianoBooster-x86_64.AppImage # path to archive to upload + asset_name: PianoBooster-x86_64-$$.AppImage # name to upload the release as, use $$ to insert date (YYYYMMDD) and 6 letter commit hash + asset_content_type: application/dmg # required by GitHub API + max_releases: 30 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted + - name: Mac Snapshot Release + uses: WebFreak001/deploy-nightly@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions + with: + # find out this value by opening https://api.github.com/repos///releases in your browser and copy the full "upload_url" value including the {?name,label} part + upload_url: https://uploads.github.com/repos/winder/PianoBooster/releases/32197618/assets{?name,label} + release_id: 32197618 # same as above (id can just be taken out the upload_url, it's used to find old releases) + asset_path: PianoBooster.dmg # path to archive to upload + asset_name: PianoBooster_$$.dmg # name to upload the release as, use $$ to insert date (YYYYMMDD) and 6 letter commit hash + asset_content_type: application/dmg # required by GitHub API + max_releases: 30 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted +# - name: Create release +# if: contains(github.ref, 'master') +# run: | +# find . +# ls -la + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e510d60..233498b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -47,6 +47,7 @@ MESSAGE("CMAKE_INSTALL_BINDIR: " ${CMAKE_INSTALL_BINDIR}) FIND_PACKAGE( OpenGL REQUIRED ) if(NOT WIN32) + # the `pkg_check_modules` function is created with this call include(FindPkgConfig) FIND_PACKAGE( PkgConfig REQUIRED ) endif() @@ -97,6 +98,7 @@ endif(${CMAKE_SYSTEM} MATCHES "Darwin") if(WITH_INTERNAL_FLUIDSYNTH) if(NOT WIN32) pkg_check_modules(FLUIDSYNTH fluidsynth) + if(NOT FLUIDSYNTH_FOUND) MESSAGE(FATAL_ERROR "FLUIDSYNTH was not found") endif(NOT FLUIDSYNTH_FOUND) @@ -245,7 +247,11 @@ if(UNIX AND NOT APPLE) ADD_EXECUTABLE( pianobooster ${PIANOBOOSTER_SRCS} ${PIANOBOOSTER_MOC_SRCS} ${PIANOBOOSTER_RC_SRCS} ${PIANOBOOSTER_UI_HDRS} ${PIANOBOOSTER_RCS} ) +<<<<<<< HEAD endif(UNIX AND NOT APPLE) +======= + endif(UNIX AND NOT APPLE) +>>>>>>> Add build automation. if(WIN32) ADD_EXECUTABLE( pianobooster ${PIANOBOOSTER_SRCS} @@ -263,6 +269,10 @@ else() endif() target_link_libraries (pianobooster Qt5::Widgets Qt5::Xml Qt5::OpenGL ${OPENGL_LIBRARIES} ${FTGL_LIBRARY} ${RTMIDI_LIBRARIES} ${JACK_LIBRARY} ${FLUIDSYNTH_LIBRARY} ${RTMIDI_LIBRARY}) +<<<<<<< HEAD +======= +# Apple didn't like this. +>>>>>>> Add build automation. if(NOT APPLE) INSTALL( FILES ../pianobooster.desktop DESTINATION share/applications ) INSTALL(TARGETS pianobooster RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})