Skip to content

Commit

Permalink
Merge pull request #58 from cpyarger/master
Browse files Browse the repository at this point in the history
Conversion from Azure Pipelines to GitHub Actions for CI
  • Loading branch information
cpyarger authored Feb 8, 2021
2 parents 7cee7ba + 2f6ff11 commit 5a94147
Show file tree
Hide file tree
Showing 9 changed files with 749 additions and 267 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# These are supported funding model platforms

github: [alzy, cpyarger]
github: [cpyarger]
507 changes: 507 additions & 0 deletions .github/workflows/CI Build and release.yml

Large diffs are not rendered by default.

30 changes: 19 additions & 11 deletions CI/install-dependencies-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,46 @@
OSTYPE=$(uname)

if [ "${OSTYPE}" != "Darwin" ]; then
echo "[obs-midi - Error] macOS install dependencies script can be run on Darwin-type OS only."
echo "[obs-websocket - Error] macOS install dependencies script can be run on Darwin-type OS only."
exit 1
fi

HAS_BREW=$(type brew 2>/dev/null)

if [ "${HAS_BREW}" = "" ]; then
echo "[obs-midi - Error] Please install Homebrew (https://www.brew.sh/) to build obs-midi on macOS."
echo "[obs-websocket - Error] Please install Homebrew (https://www.brew.sh/) to build obs-websocket on macOS."
exit 1
fi

# OBS Studio deps
echo "[obs-midi] Updating Homebrew.."
echo "[obs-websocket] Updating Homebrew.."
brew update >/dev/null
echo "[obs-midi] Checking installed Homebrew formulas.."
echo "[obs-websocket] Checking installed Homebrew formulas.."
BREW_PACKAGES=$(brew list)
BREW_DEPENDENCIES="speexdsp ccache swig mbedtls"
BREW_DEPENDENCIES="jack speexdsp ccache swig mbedtls"

for DEPENDENCY in ${BREW_DEPENDENCIES}; do
if echo "${BREW_PACKAGES}" | grep -q "^${DEPENDENCY}\$"; then
echo "[obs-midi] Upgrading OBS-Studio dependency '${DEPENDENCY}'.."
echo "[obs-websocket] Upgrading OBS-Studio dependency '${DEPENDENCY}'.."
brew upgrade ${DEPENDENCY} 2>/dev/null
else
echo "[obs-midi] Installing OBS-Studio dependency '${DEPENDENCY}'.."
echo "[obs-websocket] Installing OBS-Studio dependency '${DEPENDENCY}'.."
brew install ${DEPENDENCY} 2>/dev/null
fi
done

# qtmidis deps
echo "[obs-midi] Installing obs-midi dependency 'QT 5.10.1'.."

# qtwebsockets deps
echo "[obs-websocket] Installing obs-websocket dependency 'QT 5.10.1'.."
tap akeru-inc/tap
brew install jack
brew install speexdsp
brew install cmake
brew install freetype
brew install fdk-aac
brew install ./CI/macos/qt.rb
brew install ./CI/macos/swig.rb
brew install akeru-inc/tap/xcnotary


# Pin this version of QT5 to avoid `brew upgrade`
# upgrading it to incompatible version
Expand All @@ -50,7 +58,7 @@ brew pin qt
HAS_PACKAGES=$(type packagesbuild 2>/dev/null)

if [ "${HAS_PACKAGES}" = "" ]; then
echo "[obs-midi] Installing Packaging app (might require password due to 'sudo').."
echo "[obs-websocket] Installing Packaging app (might require password due to 'sudo').."
curl -o './Packages.pkg' --retry-connrefused -s --retry-delay 1 'https://s3-us-west-2.amazonaws.com/obs-nightly/Packages.pkg'
sudo installer -pkg ./Packages.pkg -target /
fi
4 changes: 2 additions & 2 deletions CI/macos/Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ brew "speexdsp"
brew "cmake"
brew "freetype"
brew "fdk-aac"
brew "https://gist.githubusercontent.com/DDRBoxman/9c7a2b08933166f4b61ed9a44b242609/raw/ef4de6c587c6bd7f50210eccd5bd51ff08e6de13/qt.rb"
brew "./qt.rb"
brew "swig", link: false
brew "https://gist.githubusercontent.com/DDRBoxman/4cada55c51803a2f963fa40ce55c9d3e/raw/572c67e908bfbc1bcb8c476ea77ea3935133f5b5/swig.rb"
brew "./swig.rb"
brew "akeru-inc/tap/xcnotary"
75 changes: 16 additions & 59 deletions CI/macos/qt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,25 @@
class Qt < Formula
desc "Cross-platform application and UI framework"
homepage "https://www.qt.io/"
url "https://download.qt.io/official_releases/qt/5.10/5.10.1/single/qt-everywhere-src-5.10.1.tar.xz"
mirror "https://www.mirrorservice.org/sites/download.qt-project.org/official_releases/qt/5.10/5.10.1/single/qt-everywhere-src-5.10.1.tar.xz"
sha256 "05ffba7b811b854ed558abf2be2ddbd3bb6ddd0b60ea4b5da75d277ac15e740a"
head "https://code.qt.io/qt/qt5.git", :branch => "5.10", :shallow => false
url "https://download.qt.io/official_releases/qt/5.14/5.14.1/single/qt-everywhere-src-5.14.1.tar.xz"
mirror "https://mirrors.dotsrc.org/qtproject/archive/qt/5.14/5.14.1/single/qt-everywhere-src-5.14.1.tar.xz"
mirror "https://mirrors.ocf.berkeley.edu/qt/archive/qt/5.14/5.14.1/single/qt-everywhere-src-5.14.1.tar.xz"
sha256 "6f17f488f512b39c2feb57d83a5e0a13dcef32999bea2e2a8f832f54a29badb8"

head "https://code.qt.io/qt/qt5.git", :branch => "dev", :shallow => false

bottle do
sha256 "8b4bad005596a5f8790150fe455db998ac2406f4e0f04140d6656205d844d266" => :high_sierra
sha256 "9c488554935fb573554a4e36d36d3c81e47245b7fefc4b61edef894e67ba1740" => :sierra
sha256 "c0407afba5951df6cc4c6f6c1c315972bd41c99cecb4e029919c4c15ab6f7bdc" => :el_capitan
cellar :any
sha256 "e40589965586f2c1132da117aca2e0cf12f3ea4bb1029d26b4b0819d8aae3bd5" => :catalina
sha256 "149a1c2d2af7afda9910e1d4e3956c27ffa31ea511a8320930abf7a9079d0330" => :mojave
sha256 "69a7f1ad615f78735b6635da1b1fab5e4eea57dd9be560c695f82b796457870a" => :high_sierra
end

keg_only "Qt 5 has CMake issues when linked"

option "with-docs", "Build documentation"
option "with-examples", "Build examples"
option "without-proprietary-codecs", "Don't build with proprietary codecs (e.g. mp3)"

# OS X 10.7 Lion is still supported in Qt 5.5, but is no longer a reference
# configuration and thus untested in practice. Builds on OS X 10.7 have been
# reported to fail: <https://github.com/Homebrew/homebrew/issues/45284>.
# depends_on :macos => :mountain_lion

depends_on "pkg-config" => :build
depends_on :xcode => :build
depends_on "mysql" => :optional
depends_on "postgresql" => :optional

# Restore `.pc` files for framework-based build of Qt 5 on OS X. This
# partially reverts <https://codereview.qt-project.org/#/c/140954/> merged
# between the 5.5.1 and 5.6.0 releases. (Remove this as soon as feasible!)
#
# Core formulae known to fail without this patch (as of 2016-10-15):
# * gnuplot (with `--with-qt` option)
# * mkvtoolnix (with `--with-qt` option, silent build failure)
# * poppler (with `--with-qt` option)
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/e8fe6567/qt5/restore-pc-files.patch"
sha256 "48ff18be2f4050de7288bddbae7f47e949512ac4bcd126c2f504be2ac701158b"
end
depends_on :macos => :sierra

def install
args = %W[
Expand All @@ -54,41 +34,19 @@ def install
-qt-libjpeg
-qt-freetype
-qt-pcre
-nomake examples
-nomake tests
-no-rpath
-pkg-config
-dbus-runtime
-proprietary-codecs
]

args << "-nomake" << "examples" if build.without? "examples"

if build.with? "mysql"
args << "-plugin-sql-mysql"
(buildpath/"brew_shim/mysql_config").write <<~EOS
#!/bin/sh
if [ x"$1" = x"--libs" ]; then
mysql_config --libs | sed "s/-lssl -lcrypto//"
else
exec mysql_config "$@"
fi
EOS
chmod 0755, "brew_shim/mysql_config"
args << "-mysql_config" << buildpath/"brew_shim/mysql_config"
end

args << "-plugin-sql-psql" if build.with? "postgresql"
args << "-proprietary-codecs" if build.with? "proprietary-codecs"

system "./configure", *args
system "make"
ENV.deparallelize
system "make", "install"

if build.with? "docs"
system "make", "docs"
system "make", "install_docs"
end

# Some config scripts will only find Qt in a "Frameworks" folder
frameworks.install_symlink Dir["#{lib}/*.framework"]

Expand All @@ -108,9 +66,9 @@ def install
end

def caveats; <<~EOS
We agreed to the Qt opensource license for you.
We agreed to the Qt open source license for you.
If this is unacceptable you should uninstall.
EOS
EOS
end

test do
Expand All @@ -127,7 +85,6 @@ def caveats; <<~EOS
(testpath/"main.cpp").write <<~EOS
#include <QCoreApplication>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
Expand All @@ -142,4 +99,4 @@ def caveats; <<~EOS
assert_predicate testpath/"main.o", :exist?
system "./hello"
end
end
end
56 changes: 56 additions & 0 deletions CI/macos/swig.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

class Swig < Formula
desc "Generate scripting interfaces to C/C++ code"
homepage "http://www.swig.org/"
url "https://downloads.sourceforge.net/project/swig/swig/swig-3.0.12/swig-3.0.12.tar.gz"
sha256 "7cf9f447ae7ed1c51722efc45e7f14418d15d7a1e143ac9f09a668999f4fc94d"

bottle do
sha256 "7307b4ffe3222715b2206e6477c5e3022881a730eb95a717d41a3df8e6e20455" => :mojave
sha256 "c0e2656fd10d57281280d20ce8bf9a060cf8714f4283dd1dfde383b3688d9ed1" => :high_sierra
sha256 "68cb1b6bc898f2a1bd39ae24dd0235f68ffa56d04ba8cd4424835335202977d1" => :sierra
sha256 "37bf242aad0c18317cdaef66218483c04fa57e091b7c7f9d72089f5002881338" => :el_capitan
sha256 "3443dbf17f78be0cecb5419772c71bb418caa91763590072224c196a57317717" => :yosemite
end

head do
url "https://github.com/swig/swig.git"

depends_on "autoconf" => :build
depends_on "automake" => :build
end

depends_on "pcre"

def install
system "./autogen.sh" if build.head?
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make"
system "make", "install"
end

test do
(testpath/"test.c").write <<~EOS
int add(int x, int y)
{
return x + y;
}
EOS
(testpath/"test.i").write <<~EOS
%module test
%inline %{
extern int add(int x, int y);
%}
EOS
(testpath/"run.rb").write <<~EOS
require "./test"
puts Test.add(1, 1)
EOS
system "#{bin}/swig", "-ruby", "test.i"
system ENV.cc, "-c", "test.c"
system ENV.cc, "-c", "test_wrap.c", "-I#{MacOS.sdk_path}/System/Library/Frameworks/Ruby.framework/Headers/"
system ENV.cc, "-bundle", "-undefined", "dynamic_lookup", "test.o", "test_wrap.o", "-o", "test.bundle"
assert_equal "2", shell_output("/usr/bin/ruby run.rb").strip
end
end
Loading

0 comments on commit 5a94147

Please sign in to comment.