From 1b220415067f15e20adc8c86e6c96965aadd24a3 Mon Sep 17 00:00:00 2001 From: Artyom Kazak Date: Wed, 26 Jun 2019 11:35:52 +0300 Subject: [PATCH] Migrate to LTS 13 and Ubuntu Xenial (#302) --- .travis.yml | 11 +++++------ Makefile | 8 +++++--- back/tests/Selenium.hs | 12 ++++++++++++ docker/back/Dockerfile | 2 +- stack.yaml | 27 +++++++++++++++++++-------- 5 files changed, 42 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 07f0b27..62e3bef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,14 @@ sudo: true -dist: trusty +dist: xenial language: generic addons: chrome: stable +services: + - xvfb + before_install: - # start your web application and listen on `localhost` - google-chrome-stable --headless --disable-gpu --remote-debugging-port=5000 http://localhost & @@ -77,7 +80,7 @@ jobs: - stage: "Test the backend" before_script: - - sudo apt-get install -y libgmp-dev xvfb fluxbox + - sudo apt-get install -y libgmp-dev fluxbox - curl -sSL https://get.haskellstack.org/ | sh - stack setup # Install chromedriver @@ -88,8 +91,6 @@ jobs: - sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver - sudo ln -s /usr/local/share/chromedriver /usr/bin/chromedriver # Run selenium-server - - "export DISPLAY=:99.0" - - "sh -e /etc/init.d/xvfb start" - travis_retry wget https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar -O selenium.jar - java -jar selenium.jar 2> /dev/null & - sleep 15 @@ -100,8 +101,6 @@ jobs: - rm -rf $HOME/.stack/programs # GHC is faster to install than to cache # - stage: "Test the frontend" - # - "export DISPLAY=:99.0" - # - "sh -e /etc/init.d/xvfb start" # - sleep 10 # - fluxbox >/dev/null 2>&1 & # script: diff --git a/Makefile b/Makefile index 3729615..21b9f63 100644 --- a/Makefile +++ b/Makefile @@ -36,8 +36,10 @@ back/run: stack exec --cwd back -- guide # Create a Docker image for the backend; will only work on Travis because -# the binary has to have been compiled on Ubuntu Trusty (the OS used in the -# Docker file) +# the binary has to have been compiled on Ubuntu Xenial (the OS used in the +# Docker file). +# +# Assumes Guide has been built with Stack. .PHONY: back/travis-docker back/travis-docker: rm -rf docker/back/files && mkdir docker/back/files @@ -45,7 +47,7 @@ back/travis-docker: docker/back/files/state (cd docker/back/files/state && gzip -d *.gz) rm -rf docker/back/files/state/.git - cp .stack-work/install/*/*/*/bin/guide docker/back/files/ + cp "$$(stack path --local-install-root)/bin/guide" docker/back/files/ cp -R back/{static,templates} docker/back/files/ docker build docker/back -t quay.io/aelve/guide:$(tag) rm -rf docker/back/files diff --git a/back/tests/Selenium.hs b/back/tests/Selenium.hs index 7cb49c7..0d94346 100644 --- a/back/tests/Selenium.hs +++ b/back/tests/Selenium.hs @@ -5,6 +5,8 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE StandaloneDeriving #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} -- for "instance MonadFail WD" + module Selenium ( module Test.Hspec.WebDriver, @@ -58,6 +60,7 @@ where import Imports hiding ((:|), catch) -- Monads import Control.Monad.Loops +import qualified Control.Monad.Fail as Fail -- Containers import qualified Data.Set as Set -- Text @@ -448,3 +451,12 @@ shouldBeHidden s = do wait_delay :: Double wait_delay = 10 + +---------------------------------------------------------------------------- +-- Orphan instances +---------------------------------------------------------------------------- + +instance Fail.MonadFail WD where + -- Don't get confused! + -- This line means "MonadFail.fail = Monad.fail" + fail = fail diff --git a/docker/back/Dockerfile b/docker/back/Dockerfile index a08264c..8a4c834 100644 --- a/docker/back/Dockerfile +++ b/docker/back/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:trusty +FROM ubuntu:xenial ENV LANG=C.UTF-8 ENV LC_ALL=C.UTF-8 diff --git a/stack.yaml b/stack.yaml index f1628d6..956c8a9 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-12.4 +resolver: lts-13.26 packages: - back/ @@ -17,13 +17,22 @@ extra-deps: - fmt-0.6 - cmark-sections-0.3.0.1 - acid-state-0.14.3 -- servant-swagger-ui-0.3.0.3.13.2 -- servant-0.14.1 -- servant-swagger-ui-core-0.3.1 -- swagger2-2.3 +- stm-containers-0.2.16 - lzma-clib-5.2.2 - regex-1.0.1.5 +# Old versions from LTS 12+ (can and should be upgraded) +- megaparsec-6.5.0 +- wai-middleware-metrics-0.2.4 +- servant-0.15 +- servant-server-0.15 + +# Older version due to megaparsec +- neat-interpolation-0.3.2.2 + +# Older version due to stm-containers +- focus-0.1.5.2 + # We pin the precise versions of 'highlighting-kate' and 'cmark-highlight' # because the frontend has copied a stylesheet from 'highlighting-kate'. If # the version changes, we also have to update the stylesheet on the @@ -36,17 +45,19 @@ extra-deps: - di-1.2 - di-monad-1.3 - di-core-1.0.3 -- df1-0.3 +- df1-0.3.1 +- di-df1-1.0.2 +- di-handle-1.0.1 - git: https://github.com/aelve/stache-plus - commit: c8097fb33df6ba738fc7b7c8d09aaebdb02a9782 + commit: 4c40c1297873cd5bb24a4aeb7c59b7a7f67ca671 - git: https://github.com/aelve/safecopy-migrate commit: 3971922c75ce2ca751b3da1653fefa109b746e21 # Fork of 'servant-swagger' with some changes (see its README) - git: https://github.com/aelve/servant-swagger - commit: 09e124d03606ec54d50e3029ea86d096575d545c + commit: ea54349ffbe474c70601b6d1f7f71535b77c73ae # Fork of 'hspec-webdriver' that builds - git: https://github.com/neongreen/webdriver-utils