Skip to content

Commit

Permalink
Continuous Integration tests on GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
gvnnz committed Dec 22, 2020
1 parent e1dad4b commit 86fb93c
Show file tree
Hide file tree
Showing 9 changed files with 359 additions and 1 deletion.
18 changes: 18 additions & 0 deletions .github/scripts/linux/install-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

set -e

# Install dependencies

sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -qq
sudo apt-get install g++-8 xvfb libsndfile1-dev libsamplerate0-dev libasound2-dev libxpm-dev libpulse-dev libjack-dev libxft-dev libxrandr-dev libx11-dev libxinerama-dev libxcursor-dev libfontconfig1-dev libfltk1.3-dev librtmidi-dev

# Symlink gcc in order to use the latest version

sudo ln -f -s /usr/bin/g++-8 /usr/bin/g++

# Download linuxdeploy for building AppImages

wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod a+x linuxdeploy-x86_64.AppImage
42 changes: 42 additions & 0 deletions .github/scripts/linux/make-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash

set -e

echo "Create working dirs"

mkdir dist
mkdir temp

echo "Strip binary and move it to temp/"

strip ./build/giada
mv ./build/giada temp/

echo "Create .desktop file"

cat << EOF > ./temp/giada.desktop
[Desktop Entry]
Name=Giada
Name[es]=Giada
GenericName=Drum machine and loop sequencer
GenericName[es]=Caja de ritmos y secuenciador de loops
Icon=giada
Type=Application
Exec=giada
Terminal=false
Categories=AudioVideo;Audio;X-Digital_Processing;X-Jack;X-MIDI;Midi;
Keywords=Giada;
EOF

echo "Prepare logo"

mv extras/giada-logo.svg temp/giada.svg

# Run linuxdeploy to make the AppImage, then move it to dist/ dir.
# For some reason linuxdeploy uses the commit hash in the filename, so
# rename it first. Note: $RELEASE_VERSION is an environment variable set in the
# packaging.yml script.

./linuxdeploy-x86_64.AppImage -e temp/giada -d temp/giada.desktop -i temp/giada.svg --output appimage --appdir temp/
mv Giada-*-x86_64.AppImage Giada-$RELEASE_VERSION-x86_64.AppImage
cp Giada-$RELEASE_VERSION-x86_64.AppImage dist/
25 changes: 25 additions & 0 deletions .github/scripts/macos/install-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

set -e

brew update > /dev/null
brew install rtmidi
brew install libsamplerate
brew install fltk
brew install libsndfile
brew install upx

# Remove dynamic libraries to force static linking.

rm -rf /usr/local/lib/librtmidi*dylib
rm -rf /usr/local/lib/libsamplerate*dylib
rm -rf /usr/local/lib/libfltk*dylib
rm -rf /usr/local/lib/libfltk_forms*dylib
rm -rf /usr/local/lib/libfltk_gl*dylib
rm -rf /usr/local/lib/libfltk_images*dylib
rm -rf /usr/local/lib/libsndfile*dylib
rm -rf /usr/local/lib/libFLAC*dylib
rm -rf /usr/local/lib/libogg*dylib
rm -rf /usr/local/lib/libopus*dylib
rm -rf /usr/local/lib/libvorbis*dylib
rm -rf /usr/local/lib/libvorbisenc*dylib
69 changes: 69 additions & 0 deletions .github/scripts/macos/make-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env bash

set -e

echo "Create working dirs"

mkdir dist
mkdir temp

echo "UPX binary"

upx --best ./build/Release/giada

echo "Create temporary directory giada.app"

mkdir temp/giada.app
mkdir temp/giada.app/Contents
mkdir temp/giada.app/Contents/Resources
mkdir temp/giada.app/Contents/MacOS
echo APPLnone > temp/giada.app/Contents/PkgInfo

echo "Generate Info.plist file"

cat << EOF > temp/giada.app/Contents/Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>CFBundleDisplayName</key>
<string>giada</string>
<key>CFBundleName</key>
<string>giada</string>
<key>CFBundleExecutable</key>
<string>giada</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleIconFile</key>
<string>giada.icns</string>
<key>CFBundleSignature</key>
<string>none</string>
</dict>
</plist>
EOF

echo "Copy the binary file into the .app bundle"

mv ./build/Release/giada temp/giada.app/Contents/MacOS/

echo "Set executable permissions"

chmod 755 temp/giada.app/Contents/MacOS/giada

echo "Copy icon (.icns)"

cp extras/giada.icns temp/giada.app/Contents/Resources/

echo "Copy final bundle to dist/, zip it and clean it up"

# Note: $RELEASE_VERSION is an environment variable set in the
# packaging.yml script.

cp -r temp/giada.app dist/
cd dist
zip -r giada-$RELEASE_VERSION-x86_64-macos.zip giada.app
rm -rf giada.app
12 changes: 12 additions & 0 deletions .github/scripts/windows/install-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# Install Visual Studio 2019 build tools

choco install -y visualstudio2019buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64"

# Install vcpkg + Giada dependencies

vcpkg install libsndfile:x64-windows
vcpkg install libsamplerate:x64-windows
vcpkg install fltk:x64-windows
vcpkg install rtmidi:x64-windows
19 changes: 19 additions & 0 deletions .github/scripts/windows/make-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -e

echo "Create working dirs"

mkdir dist
mkdir temp

echo "Copy binary and dll files to temp/"

cp build/Release/giada.exe build/Release/*.dll temp/

echo "Make zip archive, save it to to dist/"

# Note: $RELEASE_VERSION is an environment variable set in the
# packaging.yml script.

7z a -tzip dist/giada-$RELEASE_VERSION-x86_64-windows.zip ./temp/*
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Continuous integration

# Runs on push and pull requests, any branch, Linux only (for now).

on: [push, pull_request]

jobs:
linux-ci:
name: Linux CI
runs-on: ubuntu-18.04
timeout-minutes: 60
steps:
- name: Download repository
uses: actions/checkout@v2
with:
submodules: recursive

- name: Install dependencies
run: bash ./.github/scripts/linux/install-deps.sh

- name: Generate Makefile
run: cmake -S . -B build/ -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS=-Wno-class-memaccess -DWITH_SYSTEM_RTMIDI=ON -DWITH_SYSTEM_FLTK=ON -DWITH_SYSTEM_LIBSNDFILE=ON -DWITH_SYSTEM_LIBSAMPLERATE=ON -DWITH_TESTS=ON

- name: Build
run: cmake --build build/ -j 2

- name: Run tests
run: xvfb-run ./build/giada --run-tests
145 changes: 145 additions & 0 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: Packaging

# Runs on new tags.

on:
push:
tags:
- '*'

jobs:
# create-release -------------------------------------------------------------
create-release:
name: Create release
runs-on: ubuntu-18.04
outputs: # Output contains the upload url. Will be reused on upload release
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false

# Linux ----------------------------------------------------------------------
linux:
name: Linux
runs-on: ubuntu-18.04
timeout-minutes: 60
needs: create-release
steps:
- name: Prepare RELEASE_VERSION env variable
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Download repository
uses: actions/checkout@v2
with:
submodules: recursive

- name: Install dependencies
run: bash ./.github/scripts/linux/install-deps.sh

- name: Generate Makefile
run: cmake -S . -B build/ -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-Wno-class-memaccess -DWITH_VST3=ON -DWITH_SYSTEM_RTMIDI=ON -DWITH_SYSTEM_FLTK=ON -DWITH_SYSTEM_LIBSNDFILE=ON -DWITH_SYSTEM_LIBSAMPLERATE=ON

- name: Build
run: cmake --build build/ -j 2

- name: Make package
run: bash ./.github/scripts/linux/make-package.sh

- name: Upload release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: dist/Giada-${{ env.RELEASE_VERSION }}-x86_64.AppImage
asset_name: Giada-${{ env.RELEASE_VERSION }}-x86_64.AppImage
asset_content_type: application/x-executable

# Windows --------------------------------------------------------------------
windows:
name: Windows
runs-on: windows-2019
timeout-minutes: 60
needs: create-release
steps:
- name: Prepare RELEASE_VERSION env variable
shell: bash
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Download repository
uses: actions/checkout@v2
with:
submodules: recursive

- name: Install dependencies
shell: bash
run: bash ./.github/scripts/windows/install-deps.sh

- name: Generate Makefile
shell: bash
run: cmake -S . -B build/ -G "Visual Studio 16 2019" -DCMAKE_TOOLCHAIN_FILE=/c/vcpkg/scripts/buildsystems/vcpkg.cmake -DWITH_VST3=ON

- name: Build
shell: bash
run: cmake --build build/ --config Release -j 2

- name: Make package
run: bash ./.github/scripts/windows/make-package.sh

- name: Upload release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: dist/giada-${{ env.RELEASE_VERSION }}-x86_64-windows.zip
asset_name: giada-${{ env.RELEASE_VERSION }}-x86_64-windows.zip
asset_content_type: application/zip

# macOS ----------------------------------------------------------------------
macos:
name: macOS
runs-on: macos-10.15
timeout-minutes: 60
needs: create-release
steps:
- name: Prepare RELEASE_VERSION env variable
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Download repository
uses: actions/checkout@v2
with:
submodules: recursive

- name: Install dependencies
run: bash ./.github/scripts/macos/install-deps.sh

- name: Generate Makefile
run: cmake -S . -B build/ -G "Xcode" -DCMAKE_CXX_FLAGS="-x objective-c++" -DWITH_VST3=ON -DWITH_SYSTEM_RTMIDI=ON -DWITH_SYSTEM_FLTK=ON -DWITH_SYSTEM_LIBSNDFILE=ON -DWITH_SYSTEM_LIBSAMPLERATE=ON

- name: Build
run: cmake --build build/ --config Release -j 2

- name: Make package
run: bash ./.github/scripts/macos/make-package.sh

- name: Upload release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: dist/giada-${{ env.RELEASE_VERSION }}-x86_64-macos.zip
asset_name: giada-${{ env.RELEASE_VERSION }}-x86_64-macos.zip
asset_content_type: application/zip
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</p>

<p align="center">
<strong>Giada - Your Hardcore Loop Machine</strong> | Official website: <a href="https://www.giadamusic.com">giadamusic.com</a> | Travis CI status: <a href="https://travis-ci.com/monocasual/giada"><img src="https://travis-ci.com/monocasual/giada.svg?branch=master" alt="Build status"></a>
<strong>Giada - Your Hardcore Loop Machine</strong> | Official website: <a href="https://www.giadamusic.com">giadamusic.com</a> | <a href="https://github.com/monocasual/giada/actions?query=workflow%3A%22Continuous+integration%22"><img src="https://github.com/monocasual/giada/workflows/Continuous%20integration/badge.svg" alt="Build status"></a>
</p>

## What is Giada?
Expand Down

0 comments on commit 86fb93c

Please sign in to comment.