circleci: Fix documentation building
authorBen Gamari <ben@smart-cactus.org>
Fri, 3 Aug 2018 20:48:18 +0000 (16:48 -0400)
committerBen Gamari <ben@smart-cactus.org>
Thu, 9 Aug 2018 03:16:02 +0000 (23:16 -0400)
.circleci/config.yml
.circleci/images/i386-linux/Dockerfile
.circleci/images/update-image [new file with mode: 0755]
.circleci/images/x86_64-linux-fedora/Dockerfile
.circleci/images/x86_64-linux/Dockerfile
.circleci/prepare-system.sh

index a046b3d..8035114 100644 (file)
@@ -95,7 +95,7 @@ jobs:
   "validate-x86_64-linux":
     resource_class: xlarge
     docker:
-      - image: ghcci/x86_64-linux:0.0.2
+      - image: ghcci/x86_64-linux:0.0.4
     environment:
       <<: *buildenv
       GHC_COLLECTOR_FLAVOR: x86_64-linux
@@ -135,12 +135,13 @@ jobs:
     macos:
       xcode: "9.0"
     environment:
+      # Disable sphinx PDF output as MacTeX apparently doesn't provide xelatex
+      BUILD_SPHINX_PDF: "NO"
       MACOSX_DEPLOYMENT_TARGET: "10.7"
       # Only Sierra and onwards supports clock_gettime. See #12858
       ac_cv_func_clock_gettime: "no"
-    environment:
-      <<: *buildenv
       GHC_COLLECTOR_FLAVOR: x86_64-darwin
+      <<: *buildenv
     steps:
       - checkout
       - *prepare
@@ -156,7 +157,7 @@ jobs:
   "validate-hadrian-x86_64-linux":
     resource_class: xlarge
     docker:
-      - image: ghcci/x86_64-linux:0.0.2
+      - image: ghcci/x86_64-linux:0.0.4
     environment:
       <<: *buildenv
     steps:
@@ -170,7 +171,7 @@ jobs:
   "validate-x86_64-linux-unreg":
     resource_class: xlarge
     docker:
-      - image: ghcci/x86_64-linux:0.0.2
+      - image: ghcci/x86_64-linux:0.0.4
     environment:
       <<: *buildenv
     steps:
@@ -186,7 +187,7 @@ jobs:
   "validate-x86_64-linux-llvm":
     resource_class: xlarge
     docker:
-      - image: ghcci/x86_64-linux:0.0.2
+      - image: ghcci/x86_64-linux:0.0.4
     environment:
       <<: *buildenv
       BUILD_FLAVOUR: perf-llvm
@@ -211,7 +212,7 @@ jobs:
   "validate-x86_64-linux-debug":
     resource_class: xlarge
     docker:
-      - image: ghcci/x86_64-linux:0.0.2
+      - image: ghcci/x86_64-linux:0.0.4
     environment:
       BUILD_FLAVOUR: devel2
       <<: *buildenv
@@ -228,7 +229,7 @@ jobs:
   "validate-i386-linux":
     resource_class: xlarge
     docker:
-      - image: ghcci/i386-linux:0.0.2
+      - image: ghcci/i386-linux:0.0.5
     environment:
       <<: *buildenv
       GHC_COLLECTOR_FLAVOR: i386-linux
@@ -247,7 +248,7 @@ jobs:
   "validate-x86_64-fedora":
     resource_class: xlarge
     docker:
-      - image: ghcci/x86_64-linux-fedora:0.0.4
+      - image: ghcci/x86_64-linux-fedora:0.0.15
     environment:
       <<: *buildenv
       GHC_COLLECTOR_FLAVOR: x86_64-fedora
@@ -266,7 +267,7 @@ jobs:
   "slow-validate-x86_64-linux":
     resource_class: xlarge
     docker:
-      - image: ghcci/x86_64-linux:0.0.2
+      - image: ghcci/x86_64-linux:0.0.4
     environment:
       <<: *buildenv
       GHC_COLLECTOR_FLAVOR: x86_64-linux
index 33fe0e1..13a5721 100644 (file)
@@ -5,7 +5,13 @@ ENV LANG C.UTF-8
 RUN echo 'deb http://ppa.launchpad.net/hvr/ghc/ubuntu trusty main' > /etc/apt/sources.list.d/ghc.list
 RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F6F88286
 RUN apt-get update -qq
+
+# Core build utilities
 RUN apt-get install -qy git make automake autoconf gcc perl python3 texinfo xz-utils lbzip2 bzip2 patch openssh-client sudo curl zlib1g-dev libtinfo-dev libsqlite3-0 libsqlite3-dev ca-certificates g++ cabal-install-2.2 ghc-8.4.2 happy alex
+
+# Documentation tools
+RUN apt-get install -qy python3-sphinx texlive-xetex texlive-latex-extra
+
 ENV PATH /home/ghc/.cabal/bin:/home/ghc/.local/bin:/opt/cabal/2.2/bin:/opt/ghc/8.4.2/bin:$PATH
 
 # Get i386 GHC bindist for 32 bit CI builds.
diff --git a/.circleci/images/update-image b/.circleci/images/update-image
new file mode 100755 (executable)
index 0000000..5a3cae5
--- /dev/null
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+
+set -e
+
+repo=ghcci
+
+if [[ $# != 2 ]]; then
+    echo "Usage: $0 DIR VERSION"
+    echo
+    echo "Update Docker image in DIR, pushing it to the $repo repository as"
+    echo "version VERSION"
+    echo
+    echo "Example: $0 x86_64-linux-fedora 0.0.3"
+    exit 1
+fi
+
+name=$1
+version=$2
+
+versions="$(curl -s https://registry.hub.docker.com/v1/repositories/$repo/$name/tags | jq -r .[].name)"
+if echo "$versions" | grep $version > /dev/null; then
+    echo "Version $version of $name already exists"
+    echo "Previous versions are:"
+    echo "$versions"
+    exit 1
+fi
+
+docker build $name -t $repo/$name:$version
+docker push $repo/$name:$version
+
+repo_name="$repo/$name"
+sed -i -E -e "s%$repo_name"':[0-9]+(\.[0-9]+)*%'"$repo_name:$version%" ../config.yml
+echo "Built, pushed, and bumped $name:$version"
index d976950..f60398d 100644 (file)
@@ -2,7 +2,25 @@ FROM fedora:27
 
 ENV LANG C.UTF-8
 
-RUN dnf -y install coreutils binutils which git make automake autoconf gcc perl python3 texinfo xz lbzip2 patch openssh-clients sudo curl zlib-devel sqlite ncurses-compat-libs gmp-devel ncurses-devel gcc-c++ findutils
+# Core build utilities
+RUN dnf -y install coreutils binutils which git make \
+    automake autoconf gcc perl python3 texinfo xz lbzip2 \
+    patch openssh-clients sudo curl zlib-devel sqlite \
+    ncurses-compat-libs gmp-devel ncurses-devel gcc-c++ findutils
+
+# Documentation tools
+RUN dnf -y install python3-sphinx \
+    texlive texlive-latex texlive-xetex \
+    texlive-collection-latex texlive-collection-latexrecommended \
+    texlive-xetex-def texlive-collection-xetex \
+    python-sphinx-latex dejavu-sans-fonts dejavu-serif-fonts \
+    dejavu-sans-mono-fonts
+
+# This is in the PATH when I ssh into the CircleCI machine but somehow
+# sphinx-build isn't found during configure unless we explicitly 
+# add it here as well; perhaps PATH is being overridden by CircleCI's
+# infrastructure?
+ENV PATH /usr/libexec/python3-sphinx:$PATH
 
 # systemd isn't running so remove it from nsswitch.conf
 # Failing to do this will result in testsuite failures due to
index 512338b..f68c7e6 100644 (file)
@@ -5,7 +5,15 @@ ENV LANG C.UTF-8
 RUN echo 'deb http://ppa.launchpad.net/hvr/ghc/ubuntu trusty main' > /etc/apt/sources.list.d/ghc.list
 RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F6F88286
 RUN apt-get update -qq
-RUN apt-get install -qy cabal-install-2.2 ghc-8.4.2 happy alex zlib1g-dev libtinfo-dev libsqlite3-0 libsqlite3-dev ca-certificates g++ git curl git make automake autoconf gcc perl python3 texinfo xz-utils lbzip2 patch openssh-client sudo
+
+# Core build utilities
+RUN apt-get install -qy cabal-install-2.2 ghc-8.4.2 happy alex zlib1g-dev \
+    libtinfo-dev libsqlite3-0 libsqlite3-dev ca-certificates g++ git curl \
+    git make automake autoconf gcc perl python3 texinfo xz-utils lbzip2 \
+    patch openssh-client sudo
+
+# Documentation tools
+RUN apt-get install -qy python3-sphinx texlive-xetex texlive-latex-extra
 
 # Stack intallation
 RUN curl -fSL https://github.com/commercialhaskell/stack/releases/download/v1.6.5/stack-1.6.5-linux-x86_64-static.tar.gz -o stack.tar.gz
index df0da01..dbb1011 100755 (executable)
@@ -7,16 +7,18 @@ fail() {
   exit 1
 }
 
-echo 'BUILD_SPHINX_HTML = NO' > mk/validate.mk
-echo 'BUILD_SPHINX_PDF = NO' >> mk/validate.mk
 hackage_index_state="@1522046735"
 
+if [[ -z ${BUILD_SPHINX_HTML:-} ]]; then BUILD_SPHINX_HTML=YES; fi
+if [[ -z ${BUILD_SPHINX_PDF:-} ]]; then BUILD_SPHINX_PDF=YES; fi
+
 cat > mk/build.mk <<EOF
 V=1
 HADDOCK_DOCS=YES
 LATEX_DOCS=YES
 HSCOLOUR_SRCS=YES
-BUILD_DOCBOOK_HTML=YES
+BUILD_SPHINX_HTML=$BUILD_SPHINX_HTML
+BUILD_SPHINX_PDF=$BUILD_SPHINX_PDF
 BeConservative=YES
 EOF
 
@@ -47,6 +49,7 @@ case "$(uname)" in
       sudo ln -s /home/ghc/.cabal/bin/HsColour /usr/local/bin/HsColour || true
     fi
     ;;
+
   Darwin)
     if [[ -n ${TARGET:-} ]]; then
       fail "uname=$(uname) not supported for cross-compilation"
@@ -55,6 +58,11 @@ case "$(uname)" in
     # does not work.
     brew upgrade python
     brew install ghc cabal-install ncurses gmp
+
+    pip3 install sphinx
+    # PDF documentation disabled as MacTeX apparently doesn't include xelatex.
+    #brew cask install mactex
+
     cabal update
     cabal install --reinstall alex happy haddock hscolour --index-state=$hackage_index_state
     # put them on the $PATH, don't fail if already installed
@@ -65,3 +73,9 @@ case "$(uname)" in
   *)
     fail "uname=$(uname) not supported"
 esac
+
+echo "================================================="
+echo "Build.mk:"
+echo ""
+cat mk/build.mk
+echo "================================================="