From 14ab6c6bb8532e3b2c5c248fe77ac61b0b0e5ecd Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 23 Dec 2020 13:11:20 +0000 Subject: [PATCH] ci: Use scripts for GitHub Actions Do not share them with the Travis pipelines. --- .github/scripts/epoxy-ci-linux.sh | 32 +++++++++++++++++++++++++++++++ .github/scripts/epoxy-ci-osx.sh | 27 ++++++++++++++++++++++++++ .github/workflows/ci.yml | 4 ++-- 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100755 .github/scripts/epoxy-ci-linux.sh create mode 100755 .github/scripts/epoxy-ci-osx.sh diff --git a/.github/scripts/epoxy-ci-linux.sh b/.github/scripts/epoxy-ci-linux.sh new file mode 100755 index 0000000..e95584f --- /dev/null +++ b/.github/scripts/epoxy-ci-linux.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +dump_log_and_quit() { + local exitcode=$1 + + cat meson-logs/testlog.txt + + exit $exitcode +} + +# Start Xvfb +XVFB_WHD=${XVFB_WHD:-1280x720x16} + +Xvfb :99 -ac -screen 0 $XVFB_WHD -nolisten tcp & +xvfb=$! + +export DISPLAY=:99 + +srcdir=$( pwd ) +builddir=$( mktemp -d build_XXXXXX ) + +meson --prefix /usr "$@" $builddir $srcdir || exit $? + +cd $builddir + +ninja || exit $? +meson test || dump_log_and_quit $? + +cd .. + +# Stop Xvfb +kill -9 ${xvfb} diff --git a/.github/scripts/epoxy-ci-osx.sh b/.github/scripts/epoxy-ci-osx.sh new file mode 100755 index 0000000..1a062a1 --- /dev/null +++ b/.github/scripts/epoxy-ci-osx.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +dump_log_and_quit() { + local exitcode=$1 + + cat meson-logs/testlog.txt + + exit $exitcode +} + +export SDKROOT=$( xcodebuild -version -sdk macosx Path ) +export CPPFLAGS=-I/usr/local/include +export LDFLAGS=-L/usr/local/lib +export OBJC=$CC +export PATH=$HOME/tools:$PATH + +srcdir=$( pwd ) +builddir=$( mktemp -d build_XXXXXX ) + +meson ${BUILDOPTS} $builddir $srcdir || exit $? + +cd $builddir + +ninja || exit $? +meson test || dump_log_and_quit $? + +cd .. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index edd6c5b..4086757 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,6 @@ jobs: python -m pip install --upgrade pip pip3 install meson - if: runner.os == 'macOS' - run: /bin/sh -c "CC=${{ matrix.compiler }} .travis/epoxy-ci-osx.sh ${{ matrix.build-opts }}" + run: /bin/sh -c "CC=${{ matrix.compiler }} .github/scripts/epoxy-ci-osx.sh ${{ matrix.build-opts }}" - if: runner.os == 'Linux' - run: /bin/sh -c "CC=${{ matrix.compiler }} .travis/epoxy-ci-linux.sh ${{ matrix.build-opts }}" + run: /bin/sh -c "CC=${{ matrix.compiler }} .github/scripts/epoxy-ci-linux.sh ${{ matrix.build-opts }}"