From 4b7bc94e9d26c2e9b4941affbd9ac59247dc8845 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Tue, 17 Nov 2020 16:55:42 -0800 Subject: [PATCH] Implement Github-actions tests on macOS. --- .github/workflows/README.md | 7 + .github/workflows/mac-tests.yaml | 55 ++++ util/ci/macos-ci-deps/README.md | 24 ++ util/ci/macos-ci-deps/macos_bin.manifest | 28 +++ util/ci/macos-ci-deps/macos_include.manifest | 33 +++ util/ci/macos-ci-deps/macos_lib.manifest | 236 ++++++++++++++++++ util/ci/macos-ci-deps/macos_share.manifest | 7 + .../macos-ci-deps/make-macos-deps-tarball.sh | 24 ++ 8 files changed, 414 insertions(+) create mode 100644 .github/workflows/README.md create mode 100644 .github/workflows/mac-tests.yaml create mode 100644 util/ci/macos-ci-deps/README.md create mode 100644 util/ci/macos-ci-deps/macos_bin.manifest create mode 100644 util/ci/macos-ci-deps/macos_include.manifest create mode 100644 util/ci/macos-ci-deps/macos_lib.manifest create mode 100644 util/ci/macos-ci-deps/macos_share.manifest create mode 100755 util/ci/macos-ci-deps/make-macos-deps-tarball.sh diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 0000000000..e127ac0929 --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,7 @@ +Github Actions Continuous Integration Testing Workflows. + +ci-tests.yml runs Ubuntu 18.04 and Ubuntu 20.04 using Github-provided virtual environments. The virtual environments are about twice as fast as Docker ones and getting Docker to run Ubuntu images was problematic. Note that updating Ubuntu 18.04 updates ICU4C from v60 to v65 and that causes conflicts with Boost, so don't. + +ci-docker.yml runs tests in a Docker container running Arch Linux. + +mac-tests.yml runs tests on macOS using a Github-provided virtual machine. Note that this test relies on a prebuilt tarball containing all of the dependencies. Instructions for building that tarball along with some support scripts may be found in utils/ci/macos-ci-deps. diff --git a/.github/workflows/mac-tests.yaml b/.github/workflows/mac-tests.yaml new file mode 100644 index 0000000000..7c903ab3f5 --- /dev/null +++ b/.github/workflows/mac-tests.yaml @@ -0,0 +1,55 @@ +name: mac-tests +on: [push] +jobs: + ci_tests_mac: + runs-on: macos-10.15 + name: macOS Tests + env: + TZ: America/Los_Angeles + steps: + - name: Checkout + uses: actions/checkout@v2 + - run: | + echo "PATH=$PATH:$HOME/gnucash/inst/bin" >> $GITHUB_ENV + echo "PREFIX=$HOME/gnucash/inst" >> $GITHUB_ENV + echo "SRCROOT=$HOME/gnucash/source" >> $GITHUB_ENV + - name: download dependency tarball + uses: carlosperate/download-file-action@v1.0.3 + id: dependencies + with: + file-url: 'https://downloads.sourceforge.net/gnucash/Dependencies/gnucash-4.x-mac-dependencies.tar.xz' + file-name: gnucash-dependencies.tar.xz + - name: download googletest + uses: carlosperate/download-file-action@v1.0.3 + + id: googletest + with: + file-url: 'https://github.com/google/googletest/archive/release-1.10.0.tar.gz' + file-name: googletest.tar.gz + - run: | + cd $HOME + mkdir gnucash + cd gnucash + tar -xf $GITHUB_WORKSPACE/gnucash-dependencies.tar.xz + mkdir source + cd source + tar -xf $GITHUB_WORKSPACE/googletest.tar.gz + mv googletest-* googletest + cd .. + ls source + - name: Configure GnuCash + run: | + mkdir build + cd build + cmake -GNinja -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_PREFIX_PATH=$PREFIX -DWITH_PYTHON=ON -DGTEST_ROOT=$SRCROOT/googletest $GITHUB_WORKSPACE + - name: Build and Test GnuCash + run: | + cd build + ninja + ninja check + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: TestLog + path: ${{ github.workspace }}/build/Testing/Temporary/LastTest.log + if-no-files-found: ignore diff --git a/util/ci/macos-ci-deps/README.md b/util/ci/macos-ci-deps/README.md new file mode 100644 index 0000000000..625b0e2143 --- /dev/null +++ b/util/ci/macos-ci-deps/README.md @@ -0,0 +1,24 @@ +For creating the macOS dependency tarball required by the Github CI tests. + +Reruirements: +* Administrator privs on your Mac. +* Project admin privs for https://sourceforge.net/projects/gnucash. +* You must be running the same or newer version of macOS as the Github runner. +* Xcode or command-line tools (install the latter with `sudo xcode-select -install`). +To build this tarball you must be running the same or newer macOS version as the Github VM. + +Procedure: +* Set up a Gtk-OSX build environment following the [GnuCash Quartz Build instructions](https://wiki.gnucash.org/wiki/MacOS/Quartz). +* Retrieve [jhbuildrc-custom](https://github.com/gnucash/gnucash-on-osx/jhbuildrc-custom) and put it in ~/.config. +* Set `modules = _modules_deps` on the appropriate line of `jhbuildrc-custom`. +* If you are not running the same version of macOS as the Github actions virtual environment change the `setup_SDK()` line at the bottom of `jhbuildrc-custom` to `setup_SDK('10.15')`, substituting the VM's macOS version for '10.15'. +* Create the directory `/Users/runner/` and make yourself the owner: + ``` + sudo mkdir /Users/runner + sudo chown me /Users/runner + mkdir /Users/runner/gnucash + ``` + Substituting your own userid for 'me'. +* Run `util/ci/macos-ci-deps/make-macos-deps-tarball.sh gnucash-4.2-mac-dependencies.tar.xz` from the root of the source directory, changing the tarball's name if appropriate. +* Upload the resulting tarball to the Dependencies folder in the Gnucash files section on SourceForge. +* If necessary modify `.github/workflows/mac-tests.yaml to reflect the tarball's URI. \ No newline at end of file diff --git a/util/ci/macos-ci-deps/macos_bin.manifest b/util/ci/macos-ci-deps/macos_bin.manifest new file mode 100644 index 0000000000..519b6cb902 --- /dev/null +++ b/util/ci/macos-ci-deps/macos_bin.manifest @@ -0,0 +1,28 @@ +cmake +ctest +glib-compile-resources +glib-compile-schemas +guild +guile +msgattrib +msgcat +msgcmp +msgcomm +msgconv +msgen +msgexec +msgfilter +msgfmt +msggrep +msginit +msgmerge +msgunfmt +msguniq +ninja +pkg-config +python3 +python3-config +python3.8 +python3.8-config +swig +xgettext diff --git a/util/ci/macos-ci-deps/macos_include.manifest b/util/ci/macos-ci-deps/macos_include.manifest new file mode 100644 index 0000000000..b02a3703e0 --- /dev/null +++ b/util/ci/macos-ci-deps/macos_include.manifest @@ -0,0 +1,33 @@ +aqbanking6 +atk-1.0 +boost +cairo +dbi +freetype2 +fribidi +gdk-pixbuf-2.0 +gio-unix-2.0 +glib-2.0 +gmp.h +gtk-3.0 +gtkmacintegration +guile +gwenhywfar5 +harfbuzz +libintl.h +libofx +libpng16 +libsoup-2.4 +libxml2 +libxslt +lzma +lzma.h +pango-1.0 +pixman-1 +pygobject-3.0 +python3.8 +unicase.h +unicode +uniconv.h +unictype.h +webkitgtk-4.0 diff --git a/util/ci/macos-ci-deps/macos_lib.manifest b/util/ci/macos-ci-deps/macos_lib.manifest new file mode 100644 index 0000000000..c51a5ed385 --- /dev/null +++ b/util/ci/macos-ci-deps/macos_lib.manifest @@ -0,0 +1,236 @@ +dbd +glib-2.0 +guile +libaqbanking.44.dylib +libaqbanking.dylib +libatk-1.0.0.dylib +libatk-1.0.dylib +libboost_chrono.dylib +libboost_date_time.dylib +libboost_filesystem.dylib +libboost_locale.dylib +libboost_program_options.dylib +libboost_regex.dylib +libboost_system.dylib +libboost_thread.dylib +libcairo-gobject.2.dylib +libcairo-gobject.dylib +libcairo-script-interpreter.2.dylib +libcairo-script-interpreter.dylib +libcairo.2.dylib +libcairo.dylib +libchipcard.6.dylib +libchipcard.dylib +libcord.1.dylib +libcord.dylib +libcroco-0.6.3.dylib +libcroco-0.6.dylib +libcrypto.1.1.dylib +libcrypto.dylib +libdbi.1.dylib +libdbi.dylib +libecpg.6.12.dylib +libecpg.6.dylib +libecpg.dylib +libecpg_compat.3.12.dylib +libecpg_compat.3.dylib +libecpg_compat.dylib +libenchant.1.dylib +libenchant.dylib +libepoxy.0.dylib +libepoxy.dylib +libexslt.0.dylib +libexslt.dylib +libffi.7.dylib +libffi.dylib +libfl.2.dylib +libfl.dylib +libfl_pic.2.dylib +libfl_pic.dylib +libfontconfig.1.dylib +libfontconfig.dylib +libfreetype.6.17.2.dylib +libfreetype.6.dylib +libfreetype.dylib +libfribidi.0.dylib +libfribidi.dylib +libgailutil-3.0.dylib +libgailutil-3.dylib +libgc.1.dylib +libgc.dylib +libgcrypt.20.dylib +libgcrypt.dylib +libgdk-3.0.dylib +libgdk-3.dylib +libgdk_pixbuf-2.0.0.dylib +libgdk_pixbuf-2.0.dylib +libgettextlib-0.20.2.dylib +libgettextlib.dylib +libgettextpo.0.dylib +libgettextpo.dylib +libgettextsrc-0.20.2.dylib +libgettextsrc.dylib +libgio-2.0.0.dylib +libgio-2.0.dylib +libgirepository-1.0.1.dylib +libgirepository-1.0.dylib +libglib-2.0.0.dylib +libglib-2.0.dylib +libgmodule-2.0.0.dylib +libgmodule-2.0.dylib +libgmp.10.dylib +libgmp.dylib +libgnutls.30.dylib +libgnutls.dylib +libgnutlsxx.28.dylib +libgnutlsxx.dylib +libgobject-2.0.0.dylib +libgobject-2.0.dylib +libgpg-error.0.dylib +libgpg-error.dylib +libgthread-2.0.0.dylib +libgthread-2.0.dylib +libgtk-3.0.dylib +libgtk-3.dylib +libgtkmacintegration-gtk3.2.dylib +libgtkmacintegration-gtk3.dylib +libguile-2.2.1.dylib +libguile-2.2.dylib +libgwengui-cpp.79.dylib +libgwengui-cpp.dylib +libgwengui-gtk3.79.dylib +libgwengui-gtk3.dylib +libgwenhywfar.79.dylib +libgwenhywfar.dylib +libharfbuzz-gobject.0.dylib +libharfbuzz-gobject.dylib +libharfbuzz-icu.0.dylib +libharfbuzz-icu.dylib +libharfbuzz-subset.0.dylib +libharfbuzz-subset.dylib +libharfbuzz.0.dylib +libharfbuzz.dylib +libhistory.8.0.dylib +libhistory.8.dylib +libhistory.dylib +libhogweed.5.0.dylib +libhogweed.5.dylib +libhogweed.dylib +libicudata.66.1.dylib +libicudata.66.dylib +libicudata.dylib +libicui18n.66.1.dylib +libicui18n.66.dylib +libicui18n.dylib +libicuio.66.1.dylib +libicuio.66.dylib +libicuio.dylib +libicutest.66.1.dylib +libicutest.66.dylib +libicutest.dylib +libicutu.66.1.dylib +libicutu.66.dylib +libicutu.dylib +libicuuc.66.1.dylib +libicuuc.66.dylib +libicuuc.dylib +libintl.8.dylib +libintl.dylib +libjavascriptcoregtk-4.0.18.17.10.dylib +libjavascriptcoregtk-4.0.18.dylib +libjavascriptcoregtk-4.0.dylib +libjpeg.9.dylib +libjpeg.dylib +libltdl.7.dylib +libltdl.dylib +liblzma.5.dylib +liblzma.dylib +libmysqlclient.18.dylib +libmysqlclient.dylib +libnettle.7.0.dylib +libnettle.7.dylib +libnettle.dylib +libofx.7.dylib +libofx.dylib +libosp.5.dylib +libosp.dylib +libpango-1.0.0.dylib +libpango-1.0.dylib +libpangocairo-1.0.0.dylib +libpangocairo-1.0.dylib +libpangoft2-1.0.0.dylib +libpangoft2-1.0.dylib +libpcre.1.dylib +libpcre.dylib +libpcrecpp.0.dylib +libpcrecpp.dylib +libpcreposix.0.dylib +libpcreposix.dylib +libpgtypes.3.12.dylib +libpgtypes.3.dylib +libpgtypes.dylib +libpixman-1.0.40.0.dylib +libpixman-1.0.dylib +libpixman-1.dylib +libpng.dylib +libpng16.16.dylib +libpng16.dylib +libpq.5.12.dylib +libpq.5.dylib +libpq.dylib +libpsl.5.dylib +libpsl.dylib +libpython3.8.dylib +libreadline.8.0.dylib +libreadline.8.dylib +libreadline.dylib +librsvg-2.2.dylib +librsvg-2.dylib +libsoup-2.4.1.dylib +libsoup-2.4.dylib +libsoup-gnome-2.4.1.dylib +libsoup-gnome-2.4.dylib +libsqlite3.0.dylib +libsqlite3.dylib +libssl.1.1.dylib +libssl.dylib +libtasn1.6.dylib +libtasn1.dylib +libtextstyle.0.dylib +libtextstyle.dylib +libtiff.5.dylib +libtiff.dylib +libtiffxx.5.dylib +libtiffxx.dylib +libunistring.2.dylib +libunistring.dylib +libvala-0.36.0.dylib +libvala-0.36.dylib +libwebkit2gtk-4.0.37.49.6.dylib +libwebkit2gtk-4.0.37.dylib +libwebkit2gtk-4.0.dylib +libwebp.7.dylib +libwebp.dylib +libwebpdecoder.3.dylib +libwebpdecoder.dylib +libwebpdemux.2.dylib +libwebpdemux.dylib +libwebpmux.3.dylib +libwebpmux.dylib +libxml2.2.dylib +libxml2.dylib +libxmlsec1-gcrypt.1.dylib +libxmlsec1-gcrypt.dylib +libxmlsec1-gnutls.1.dylib +libxmlsec1-gnutls.dylib +libxmlsec1-openssl.1.dylib +libxmlsec1-openssl.dylib +libxmlsec1.1.dylib +libxmlsec1.dylib +libxslt.1.dylib +libxslt.dylib +libz.1.2.11.dylib +libz.1.dylib +libz.dylib +pkgconfig +python3.8 diff --git a/util/ci/macos-ci-deps/macos_share.manifest b/util/ci/macos-ci-deps/macos_share.manifest new file mode 100644 index 0000000000..51e4d84c22 --- /dev/null +++ b/util/ci/macos-ci-deps/macos_share.manifest @@ -0,0 +1,7 @@ +cmake +cmake-3.17 +gettext +gettext-0.20.2 +guile +itstool +swig diff --git a/util/ci/macos-ci-deps/make-macos-deps-tarball.sh b/util/ci/macos-ci-deps/make-macos-deps-tarball.sh new file mode 100755 index 0000000000..3416a1fd97 --- /dev/null +++ b/util/ci/macos-ci-deps/make-macos-deps-tarball.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +fn=$1 +if [[ "x$fn" = "x" ]]; then + fn="macos-dependencies.tar.xz" +fi +DIR=$(pwd) + +export PREFIX=/Users/runner/gnucash/inst +jhbuild bootstrap-gtk-osx +jhbuild build + +cd /Users/runner/gnucash +mv inst arch +mkdir inst +for i in 'bin' 'include' 'lib' 'share'; do + j="$DIR/util/ci/macos-ci-deps/macos_$i.manifest" + mkdir inst/$i + for k in `cat $j`; do + mv arch/$i/$k inst/$i + done +done + +tar -cJf $DIR/$fn inst