summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2020-11-22 00:34:36 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2020-11-22 00:34:36 (GMT)
commitcc103187fd9e876ecb4a6fcf4455d18454913768 (patch)
treed68e9a2f48b457a23817e41a31acaa3e9fea8828
parentd06baecec8315a5188467a8258a31d49e7c8b056 (diff)
downloadtk-cc103187fd9e876ecb4a6fcf4455d18454913768.zip
tk-cc103187fd9e876ecb4a6fcf4455d18454913768.tar.gz
tk-cc103187fd9e876ecb4a6fcf4455d18454913768.tar.bz2
My kingdom for a simple working headless Xserver!
The key was: 1. Using Xquartz to get the headers 2. Running Xvfb from that package (we want to be headless) 3. An amazing hack from https://discussions.apple.com/thread/3989835, by "Gratino": > I had the same issue where X11/XQuartz would not start because /tmp/.{X11,ICE,font}-unix were not created properly as an unprivileged user (me). They were removed (along with everything else) from /tmp on startup. > > I resolved the issue by putting this line at the bottom of my /etc/rc.local file (runs as root on bootup): > > /opt/X11/lib/X11/xinit/privileged_startx.d/10-tmpdirs > > thus the needed dirs are created at bootup by root and all is well. It turns out (from much experimentation) that this is an issue when installing Xquartz in a Github Actions workflow, as we don't want to reboot the image yet the installation assumes that that's what we'll do. Not many people have hit this before, but that's because they're not trying to do headless X11-enabled testing with macOS. We're world leaders in awful kluges! 4. Miscellaneous small hacks, of course.
-rw-r--r--.github/workflows/mac-build.yml130
1 files changed, 109 insertions, 21 deletions
diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml
index bd8cee1..2760be9 100644
--- a/.github/workflows/mac-build.yml
+++ b/.github/workflows/mac-build.yml
@@ -1,4 +1,4 @@
-name: macOS Build and Test
+name: macOS
on: [push]
env:
ERROR_ON_FAILURES: 1
@@ -8,17 +8,45 @@ jobs:
defaults:
run:
shell: bash
- working-directory: macosx
+ working-directory: tk/macosx
steps:
- - name: Checkout
+ - name: Check out Tk
uses: actions/checkout@v2
- - name: Prepare
- run: touch tkStubInit.c
- working-directory: generic
+ with:
+ path: tk
+ - name: Check out Tcl
+ uses: actions/checkout@v2
+ with:
+ repository: tcltk/tcl
+ ref: core-8-branch
+ path: tcl
+ - name: Prepare checked out repositories
+ run: |
+ touch tk/generic/tkStubInit.c
+ mkdir build
+ echo "BUILD_DIR=`cd build && pwd`" >> $GITHUB_ENV
+ echo "DESTDIR=`cd build && pwd`" >> $GITHUB_ENV
+ working-directory: .
+ - name: Build Tcl
+ run: |
+ make all
+ working-directory: tcl/macosx
- name: Build
- run: make all
+ run: |
+ make all install || {
+ echo "::error::Failure during Build"
+ exit 1
+ }
- name: Run Tests
- run: make test styles=develop
+ run: |
+ make test styles=develop | tee out-tests.txt || {
+ echo "::error::Failure during Test"
+ exit 1
+ }
+ cat out-tests.txt | grep -q "Failed[[:space:]][[:space:]]*[1-9]" && {
+ echo "::error::Failure during Test"
+ exit 1
+ }
env:
MAC_CI: 1
Unix-like:
@@ -26,24 +54,61 @@ jobs:
strategy:
matrix:
symbols:
- - "no"
- - "mem"
- dtrace:
- - "no"
- - "yes"
+ - 'no'
+ - 'mem'
+ options:
+ - '--enable-aqua'
+ - '--disable-aqua'
defaults:
run:
shell: bash
- working-directory: unix
+ working-directory: tk/unix
steps:
- - name: Checkout
+ - name: Check out Tk
uses: actions/checkout@v2
- - name: Prepare
+ with:
+ path: tk
+ - name: Check out Tcl
+ uses: actions/checkout@v2
+ with:
+ repository: tcltk/tcl
+ ref: core-8-branch
+ path: tcl
+ - name: Prepare checked out repositories
run: |
touch tkStubInit.c
mkdir "$HOME/install dir"
- working-directory: generic
- - name: Configure (symbols=${{ matrix.symbols }} dtrace=${{ matrix.dtrace }})
+ echo "USE_XVFB=$SET_DISPLAY" >> $GITHUB_ENV
+ working-directory: tk/generic
+ env:
+ SET_DISPLAY: ${{ contains(matrix.options, '--disable-aqua') }}
+ - name: Add X11 (if required)
+ if: ${{ env.USE_XVFB }}
+ # This involves black magic
+ run: |
+ brew cask install xquartz
+ sudo /opt/X11/lib/X11/xinit/privileged_startx.d/10-tmpdirs || true
+ working-directory: .
+ - name: Build Tcl
+ # Note that macOS is always a 64 bit platform
+ run: |
+ ./configure --enable-64bit ${CFGOPT} "--prefix=$HOME/install dir" || {
+ cat config.log
+ echo "::error::Failure during Tcl Configure"
+ exit 1
+ }
+ make all || {
+ echo "::error::Failure during Tcl Build"
+ exit 1
+ }
+ make install || {
+ echo "::error::Failure during Tcl Install"
+ exit 1
+ }
+ working-directory: tcl/unix
+ env:
+ CFGOPT: --enable-symbols=${{ matrix.symbols }}
+ - name: Configure (symbols=${{ matrix.symbols }} ${{matrix.options }})
# Note that macOS is always a 64 bit platform
run: |
./configure --enable-64bit ${CFGOPT} "--prefix=$HOME/install dir" || {
@@ -52,7 +117,7 @@ jobs:
exit 1
}
env:
- CFGOPT: --enable-symbols=${{ matrix.symbols }} --enable-dtrace=${{ matrix.dtrace }}
+ CFGOPT: --enable-symbols=${{ matrix.symbols }} ${{matrix.options }}
- name: Build
run: |
make all tktest || {
@@ -61,13 +126,36 @@ jobs:
}
- name: Run Tests
run: |
- make test || {
+ if [ $USE_XVFB == true ]; then
+ function runXvfb {
+ PATH=$PATH:/opt/X11/bin
+ Xvfb $1 &
+ XVFB_PID=$!
+ echo Launched Xvfb $1 as process $XVFB_PID >&2
+ trap "echo killing process $XVFB_PID... >&2; kill $XVFB_PID" 0
+ export DISPLAY=$1
+ sleep 2
+ }
+ else
+ function runXvfb {
+ : do nothing
+ }
+ fi
+ ( runXvfb :0; make test-classic; exit $? ) | tee out-classic.txt || {
+ echo "::error::Failure during Test"
+ exit 1
+ }
+ ( runXvfb :0; make test-ttk; exit $? ) | tee out-ttk.txt || {
+ echo "::error::Failure during Test"
+ exit 1
+ }
+ cat out-classic.txt out-ttk.txt | grep -q "Failed[[:space:]][[:space:]]*[1-9]" && {
echo "::error::Failure during Test"
exit 1
}
env:
MAC_CI: 1
- - name: Trial Installation
+ - name: Carry out trial installation
run: |
make install || {
cat config.log