changeset 29581:def7cbcf85ed

Add rule for continuous integration tests on GitHub. * .github/workflow/make.yaml: Add file that defines which actions to run on GitHub-hosted runners on each push.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 30 Apr 2021 19:46:23 +0200
parents 62408c80d92d
children 8f142a26a343
files .github/workflows/make.yaml
diffstat 1 files changed, 221 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.github/workflows/make.yaml	Fri Apr 30 19:46:23 2021 +0200
@@ -0,0 +1,221 @@
+name: make
+on: [push]
+jobs:
+
+  ubuntu:
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        # For available GitHub-hosted runners, see:
+        # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
+        os: [ubuntu-20.04, ubuntu-18.04]
+        compiler: [gcc, clang]
+        include:
+          - compiler: gcc
+            compiler-pkgs: "g++ gcc"
+            cc: "gcc"
+            cxx: "g++"
+          - compiler: clang
+            compiler-pkgs: "clang"
+            cc: "clang"
+            cxx: "clang++"
+    steps:
+      - uses: actions/checkout@v2
+      - name: install dependencies
+        env:
+          COMPILER_PKGS: ${{ matrix.compiler-pkgs }}
+        run: |
+          sudo apt -qq update
+          sudo apt install -y $COMPILER_PKGS autoconf automake bison ccache \
+            dvipng epstool fig2dev flex gfortran gnuplot-x11 gperf gzip \
+            icoutils libarpack2-dev libblas-dev libcurl4-gnutls-dev \
+            libfftw3-dev libfltk1.3-dev libfontconfig1-dev libfreetype6-dev \
+            libgl1-mesa-dev libgl2ps-dev libglpk-dev libgraphicsmagick++1-dev \
+            libhdf5-dev liblapack-dev libosmesa6-dev libpcre3-dev \
+            libqhull-dev libqscintilla2-qt5-dev libqrupdate-dev \
+            libreadline-dev librsvg2-bin libsndfile1-dev libsuitesparse-dev \
+            libsundials-dev libtool libxft-dev llvm-dev make openjdk-8-jdk \
+            perl portaudio19-dev pstoedit qtbase5-dev qttools5-dev \
+            qttools5-dev-tools rsync tar texinfo texlive-latex-extra xvfb \
+            zlib1g-dev
+      - name: prepare ccache
+        # create human readable timestamp
+        id: ccache_cache_timestamp
+        run: |
+          echo "::set-output name=TIMESTAMP::$(date +"%Y-%m-%d_%H-%M-%S")"
+      - name: setup ccache
+        # setup the github cache used to maintain the ccache from one job to the next
+        uses: actions/cache@v2
+        with:
+          path: /home/runner/.ccache
+          key: ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ github.ref }}:${{ steps.ccache_cache_timestamp.outputs.timestamp }}:${{ github.sha }}
+          restore-keys: |
+            ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ github.ref }}
+            ccache:${{ matrix.os }}:${{ matrix.compiler }}
+      - name: configure ccache
+        run: |
+          test -d /home/runner/.ccache || mkdir /home/runner/.ccache
+          echo "max_size = 3G" >> /home/runner/.ccache/ccache.conf
+          ccache -s
+      - name: bootstrap
+        run: ./bootstrap
+      - name: configure
+        env:
+          MY_CC: ${{ matrix.cc }}
+          MY_CXX: ${{ matrix.cxx }}
+        run: |
+          echo $MY_CC --version
+          $MY_CC --version
+          echo $MY_CXX --version
+          $MY_CXX --version
+          mkdir .build
+          cd .build && ../configure \
+            CC="ccache $MY_CC" \
+            CXX="ccache $MY_CXX" \
+            F77="ccache gfortran" \
+            CPPFLAGS="-I/usr/include/hdf5/serial -I/usr/include/suitesparse" \
+            LDFLAGS="-L/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/hdf5/serial"
+      - name: build
+        env:
+          XDG_RUNTIME_DIR: "/home/runner/tmp"
+        # Parallel make seems to fail intermittently when creating the figures
+        # for the manual. The error message says it fails to connect to a
+        # display. Maybe an xvfb issue?
+        # Use single job make for now which seems to work more reliably.
+        run: |
+          test -d $XDG_RUNTIME_DIR || mkdir $XDG_RUNTIME_DIR
+          xvfb-run -a make -C ./.build all V=1
+      - name: ccache status
+        run: ccache -s
+      - name: check
+        # Continuing on error in this step means that jobs will be "green" even
+        # if the test suite crashes.  But if we don't continue, we'll loose the
+        # ccache and other jobs will be cancelled.
+        # It would be nice if we could mark the job as "yellow" (and continue)
+        # in that case.
+        # It would also be nice if we could analyze the test suite results
+        # automatically.
+        continue-on-error: true
+        env:
+          XDG_RUNTIME_DIR: "/home/runner/tmp"
+        run: xvfb-run -a make -C ./.build check V=1
+
+  macos:
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        # For available GitHub-hosted runners, see: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
+        os: [macos-10.15]
+        # Most (or all) homebrew packages are compiled with clang and link
+        # against libc++.  So we also use clang to avoid issues with symbols
+        # that don't match.
+        # compiler: [real-gcc, clang]
+        compiler: [clang]
+        include:
+          # - compiler: real-gcc
+          #   cc: "/usr/local/bin/gcc-10"
+          #   cxx: "/usr/local/bin/g++-10"
+          #   cppflags: "-I/usr/local/opt/hdf5/include -I/usr/local/opt/gl2ps/include -I/usr/local/opt/glpk/include -I/usr/local/opt/pcre/include -I/usr/local/opt/qscintilla2/include -I/usr/local/opt/suite-sparse/include -I/usr/local/opt/sundials/include"
+          #   ldflags: "-L/usr/local/opt/hdf5/lib -L/usr/local/opt/gl2ps/lib -L/usr/local/opt/glpk/lib -L/usr/local/opt/pcre/lib -L/usr/local/opt/qscintilla2/lib -L/usr/local/opt/suite-sparse/lib -L/usr/local/opt/sundials/lib"
+          - compiler: clang
+            cc: "clang"
+            cxx: "clang++"
+    env:
+      MY_PATH: "/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/bison/bin:/usr/local/opt/texinfo/bin:/usr/local/opt/qt@5/bin:/Library/TeX/texbin"
+    steps:
+      - uses: actions/checkout@v2
+      - name: install dependencies
+        # It looks like "gfortran" isn't working correctly unless it is
+        # re-installed as part of "gcc".
+
+        # See also: https://formulae.brew.sh/formula/octave#default
+        # The packages are listed in (alphabetically sorted) blocks:
+        # The first block is for "direct" dependencies.
+        # The second block is for additional dependencies needed when building from a release tarball.
+        # The third block is for additional dependencies needed when building from a repository checkout.
+        run: |
+          brew update
+          brew uninstall gfortran
+          brew install arpack epstool fftw fig2dev fltk fontconfig freetype \
+            gcc ghostscript gl2ps glpk gnuplot graphicsmagick hdf5 libsndfile \
+            libtool openblas pcre portaudio pstoedit qhull qrupdate \
+            qscintilla2 qt@5 readline suite-sparse sundials texinfo \
+            ccache gnu-sed openjdk pkg-config \
+            automake autoconf bison gettext icoutils librsvg mactex-no-gui
+            eval "$(/usr/libexec/path_helper)"
+      - name: prepare ccache
+        # create human readable timestamp
+        id: ccache_cache_timestamp
+        run: |
+          echo "::set-output name=TIMESTAMP::$(date +"%Y-%m-%d_%H-%M-%S")"
+      - name: setup ccache
+        # setup the github cache used to maintain the ccache from one job to the next
+        uses: actions/cache@v2
+        with:
+          path: /Users/runner/Library/Caches/ccache
+          key: ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ github.ref }}:${{ steps.ccache_cache_timestamp.outputs.timestamp }}:${{ github.sha }}
+          restore-keys: |
+            ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ github.ref }}
+            ccache:${{ matrix.os }}:${{ matrix.compiler }}
+      - name: configure ccache
+        # The cache doesn't seem to compress well on macOS. Is it already compressed?
+        # Limit the maximum size to avoid exceeding the total cache limits.
+        run: |
+          test -d /Users/runner/Library/Preferences/ccache || mkdir /Users/runner/Library/Preferences/ccache
+          echo "max_size = 1.5G" >> /Users/runner/Library/Preferences/ccache/ccache.conf
+          ccache -s
+      - name: bootstrap
+        run: |
+          export PATH="$MY_PATH:$PATH"
+          ./bootstrap
+      - name: configure
+        env:
+          MY_CC: ${{ matrix.cc }}
+          MY_CXX: ${{ matrix.cxx }}
+          MY_CPPFLAGS: ${{ matrix.cppflags }}
+          MY_LDFLAGS: ${{ matrix.ldflags }}
+        # This is a hodgepodge of configure flags put together from the
+        # buildbot rules:
+        # https://hg.octave.org/octave-buildbot/file/tip/master.cfg#l543
+        # And the homebrew formula:
+        # https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/octave.rb
+        # Amended with additional flags that seem to be needed.
+        # Not all of those might be needed needed or be correct.
+        run: |
+          export PATH="$MY_PATH:$PATH"
+          echo $PATH
+          echo $MY_CC --version
+          $MY_CC --version
+          echo $MY_CXX --version
+          $MY_CXX --version
+          mkdir .build
+          cd .build && ../configure \
+            CC="ccache $MY_CC" \
+            CXX="ccache $MY_CXX" \
+            F77="ccache gfortran" \
+            CPPFLAGS="-I/usr/local/opt/gettext/include -I/usr/local/opt/icu4c/include -I/usr/local/opt/qt@5/include -I/usr/local/opt/readline/include -I/usr/local/opt/sqlite/include $MY_CPPFLAGS" \
+            CXXFLAGS="-O2 -g -std=c++11" \
+            LDFLAGS="-L/usr/local/lib -L/usr/local/opt/bison/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/icu4c/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/sqlite/lib $MY_LDFLAGS" \
+            PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig:/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/qt@5/lib/pkgconfig" \
+            QCOLLECTIONGENERATOR="qhelpgenerator" \
+            --enable-link-all-dependencies \
+            --disable-lib-visibility-flags \
+            --with-x=no \
+            --with-blas="-L/usr/local/opt/openblas/lib -lopenblas" \
+            --with-java-homedir="/usr/local/opt/openjdk"
+      - name: build
+        run: |
+          export PATH="$MY_PATH:$PATH"
+          make -C ./.build all -j3 V=1
+      - name: ccache status
+        run: ccache -s
+      - name: check
+        # Continuing on error in this step means that jobs will be "green" even
+        # if the test suite crashes.  But if we don't continue, we'll loose the
+        # ccache and other jobs will be cancelled, too.
+        # It would be nice if we could mark the job as "yellow" (and continue)
+        # in that case.
+        # It would also be nice if we could analyze the test suite results
+        # automatically.
+        continue-on-error: true
+        run: make -C ./.build check V=1