on master help sign in
add travis-ci
commit66d3641d1166945538aef859b67dbfe9543290ba authorHugh JF Chen <hugh.jf.chen@gmail.com> dateTue 21 Apr 2020, 02:38 (7 years ago) parentf6ec189
10 files changed+133−23
.travis.yml+7−17 .travis.yml.orig+68 DevOps/local/test/build/prepare.sh+10−1 DevOps/local/test/build/unprepare.sh+2−2 DevOps/local/test/deploy/prepare.sh+28−1 DevOps/local/test/deploy/unprepare.sh+2−2 DevOps/local/test/finishing.sh+4 DevOps/local/test/prepare.sh+4 DevOps/local/test/unfinishing.sh+4 DevOps/local/test/unprepare.sh+4
.travis.yml+7−17
@@ -1,6 +1,8 @@
11# For more information, see https://github.com/ChrisPenner/haskell-stack-travis-ci
22language: c
3−sudo: false
3+sudo: true
4+
5+dist: bionic
46
57git:
68 submodules: false # whether to recursively clone submodules
@@ -37,28 +39,16 @@ matrix:
3739
3840before_script:
3941 - unset CC
40− - export PATH=$HOME/.local/bin:/opt/ghc/$GHC_VERSION/bin:$PATH
41− - ./.travis/install-ghr.sh
42− - ./.travis/install-stack.sh
42+ - sudo apt-get update
43+ - sudo apt-get -y upgrade
44+ - sudo apt-get -y install git curl
4345
4446# Here starts the actual work to be performed for the package under test;
4547# any command which exits with a non-zero exit code causes the build to fail.
4648script:
4749 - |
4850 # Run tests
49− set -e
50− ./.travis/install-dependencies.sh
51− stack --no-terminal --jobs=2 --system-ghc test
52− - |
53− #Run HLint
54− if [[ "$(uname)" = "Linux" ]]; then
55− curl -sL https://raw.github.com/ndmitchell/hlint/master/misc/travis.sh | sh -s lint src test examples --cpp-define VERSION_project_m36=HLINT
56− fi
57− - |
58− #Run Haddock
59− if [[ "$(uname)" = "Linux" ]]; then
60− stack --no-install-ghc --system-ghc --no-haddock-deps haddock
61− fi
51+ ./ci/DevOps/local/test/cb.sh
6252
6353after_success:
6454 - |
.travis.yml.orignew file+68
@@ -0,0 +1,68 @@
1+# For more information, see https://github.com/ChrisPenner/haskell-stack-travis-ci
2+language: c
3+sudo: false
4+
5+git:
6+ submodules: false # whether to recursively clone submodules
7+
8+cache:
9+ directories:
10+ - $HOME/.ghc
11+ - $HOME/.cabal
12+ - $HOME/.stack
13+ - .stack-work
14+ timeout: 1000
15+
16+matrix:
17+ fast_finish: true
18+ include:
19+ - env: CACHE_NAME=8.2.2 STACK_YAML=stack.ghc8.2.yaml
20+ compiler: ": #stack 8.2.2"
21+
22+ - env: CACHE_NAME=osx-8.2.2 STACK_YAML=stack.ghc8.2.yaml
23+ os: osx
24+ osx_image: xcode7.3
25+ compiler: ": #stack 8.2.2"
26+
27+ - env: CACHE_NAME=8.4.4 STACK_YAML=stack.ghc8.4.yaml
28+ compiler: ": #stack 8.4.4"
29+
30+ - env: CACHE_NAME=8.6.5 STACK_YAML=stack.ghc8.6.yaml
31+ compiler: ": #stack 8.6.5"
32+
33+ - env: CACHE_NAME=osx-8.6.5 STACK_YAML=stack.ghc8.6.yaml
34+ os: osx
35+ osx_image: xcode11
36+ compiler: ": #stack 8.6.5"
37+
38+before_script:
39+ - unset CC
40+ - export PATH=$HOME/.local/bin:/opt/ghc/$GHC_VERSION/bin:$PATH
41+ - ./.travis/install-ghr.sh
42+ - ./.travis/install-stack.sh
43+
44+# Here starts the actual work to be performed for the package under test;
45+# any command which exits with a non-zero exit code causes the build to fail.
46+script:
47+ - |
48+ # Run tests
49+ set -e
50+ ./.travis/install-dependencies.sh
51+ stack --no-terminal --jobs=2 --system-ghc test
52+ - |
53+ #Run HLint
54+ if [[ "$(uname)" = "Linux" ]]; then
55+ curl -sL https://raw.github.com/ndmitchell/hlint/master/misc/travis.sh | sh -s lint src test examples --cpp-define VERSION_project_m36=HLINT
56+ fi
57+ - |
58+ #Run Haddock
59+ if [[ "$(uname)" = "Linux" ]]; then
60+ stack --no-install-ghc --system-ghc --no-haddock-deps haddock
61+ fi
62+
63+after_success:
64+ - |
65+ # Build and ship binary
66+ #./.travis/attach-binary.sh
67+
68+# EOF
DevOps/local/test/build/prepare.sh+10−1
@@ -14,7 +14,7 @@ begin_banner "Top level" "build prepare"
1414get_last_stable_nix_channel () {
1515 local MY_CHANNEL_NAME_REGEX=""
1616 case ${THE_DISTRIBUTION_ID} in
17− debian|rhel|centos) MY_CHANNEL_NAME_REGEX='s/.*\(nixos-[0-9][0-9].[0-9][0-9]\).*/\1/p' ;;
17+ debian|ubuntu|rhel|centos) MY_CHANNEL_NAME_REGEX='s/.*\(nixos-[0-9][0-9].[0-9][0-9]\).*/\1/p' ;;
1818 Darwin) MY_CHANNEL_NAME_REGEX='s/.*\(nixpkgs-[0-9][0-9].[0-9][0-9]-darwin\).*/\1/p' ;;
1919 *) ;;
2020 esac
@@ -39,6 +39,10 @@ if ! type nix-build >/dev/null 2>&1; then
3939 [[ -e /proc/sys/kernel/unprivileged_userns_clone ]] && sudo sysctl kernel.unprivileged_userns_clone=1
4040 curl https://nixos.org/nix/install | sh
4141 ;;
42+ ubuntu)
43+ [[ -e /proc/sys/kernel/unprivileged_userns_clone ]] && sudo sysctl kernel.unprivileged_userns_clone=1
44+ curl https://nixos.org/nix/install | sh
45+ ;;
4246 Darwin)
4347 curl https://nixos.org/nix/install | sh
4448 ;;
@@ -82,6 +86,11 @@ if ! type nodejs >/dev/null 2>&1 && ! type node >/dev/null 2>&1; then
8286 sudo apt-get update
8387 sudo apt-get install -y nodejs
8488 ;;
89+ ubuntu)
90+ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
91+ sudo apt-get update
92+ sudo apt-get install -y nodejs
93+ ;;
8594 Darwin)
8695 if type brew > /dev/null 2>&1; then
8796 brew install node@10
DevOps/local/test/build/unprepare.sh+2−2
@@ -17,7 +17,7 @@ set -u
1717
1818if type nix-build >/dev/null 2>&1; then
1919 info "nix-build found, trying to uninstall it"
20− if [ "${THE_DISTRIBUTION_ID}" == "debian" ]; then
20+ if [ "${THE_DISTRIBUTION_ID}" == "debian" ] || [ "${THE_DISTRIBUTION_ID}" == "ubuntu" ]; then
2121 [[ -e /proc/sys/kernel/unprivileged_userns_clone ]] && sudo sysctl kernel.unprivileged_userns_clone=1
2222 fi
2323 set +e
@@ -34,7 +34,7 @@ fi
3434if type nodejs >/dev/null 2>&1 || type node >/dev/null 2>&1; then
3535 info "nodejs found, trying to uninstall it"
3636 case ${THE_DISTRIBUTION_ID} in
37− debian)
37+ debian|ubuntu)
3838 sudo apt-get purge -y nodejs
3939 ;;
4040 Darwin)
DevOps/local/test/deploy/prepare.sh+28−1
@@ -42,6 +42,33 @@ if ! type docker >/dev/null 2>&1; then
4242 sudo apt-get install -y docker-ce docker-ce-cli containerd.io
4343 sudo /usr/sbin/usermod -a -G docker $(whoami)
4444 ;;
45+ ubuntu) THE_DISTRIBUTION_VERSION_CODENAME=$(grep -w "VERSION_CODENAME" /etc/os-release |awk -F"=" '{print $NF}'|sed 's/"//g')
46+ my_arch=$(uname -m)
47+ if [ ${my_arch} = "aarch64" ]; then
48+ docker_arm="arm64"
49+ else
50+ docker_arm="amd64"
51+ fi
52+ if dpkg-query -l | grep docker.io ; then
53+ sudo apt-get purge -y docker.io
54+ fi
55+ if dpkg-query -l | grep docker-engine ; then
56+ sudo apt-get purge -y docker-engine
57+ fi
58+ if dpkg-query -l | grep docker ; then
59+ sudo apt-get purge -y docker
60+ fi
61+ if dpkg-query -l | grep runc ; then
62+ sudo apt-get purge -y runc
63+ fi
64+ sudo apt-get update
65+ sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
66+ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
67+ sudo add-apt-repository "deb [arch=${docker_arm}] https://download.docker.com/linux/ubuntu ${THE_DISTRIBUTION_VERSION_CODENAME} stable"
68+ sudo apt-get update
69+ sudo apt-get install -y docker-ce docker-ce-cli containerd.io
70+ sudo /usr/sbin/usermod -a -G docker $(whoami)
71+ ;;
4572 centos) sudo yum install -y yum-utils device-mapper-persistent-data lvm2
4673 sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
4774 sudo yum install -y docker-ce docker-ce-cli containerd.io
@@ -68,7 +95,7 @@ if ! type docker-compose >/dev/null 2>&1; then
6895 case ${THE_DISTRIBUTION_ID} in
6996 rhel) my_exit "docker-compose depends on docker, yet don't know how to install docker-ce on RHEL, so abord." 1
7097 ;;
71− debian) sudo apt-get update
98+ debian|ubuntu) sudo apt-get update
7299 sudo apt-get install -y docker-compose
73100 ;;
74101 centos) sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
DevOps/local/test/deploy/unprepare.sh+2−2
@@ -16,7 +16,7 @@ if type docker >/dev/null 2>&1; then
1616 case ${THE_DISTRIBUTION_ID} in
1717 rhel) info "This script not know how to install docker-ce on RHEL, so that docker cna't be installed by this script. Ignore."
1818 ;;
19− debian) my_arch=$(uname -m)
19+ debian|ubuntu) my_arch=$(uname -m)
2020 if [ ${my_arch} = "aarch64" ]; then
2121 docker_arm="arm64"
2222 else
@@ -44,7 +44,7 @@ if type docker-compose >/dev/null 2>&1; then
4444 case ${THE_DISTRIBUTION_ID} in
4545 rhel) info "This script not know how to install docker-compose on RHEL, so that docker-compose cna't be installed by this script. Ignore."
4646 ;;
47− debian) sudo apt-get purge -y docker-compose
47+ debian|ubuntu) sudo apt-get purge -y docker-compose
4848 ;;
4949 centos) [[ -e /usr/local/bin/docker-compose ]] && sudo rm /usr/local/bin/docker-compose
5050 [[ -L /usr/bin/docker-compose ]] && sudo rm /usr/bin/docker-compose
DevOps/local/test/finishing.sh+4
@@ -19,6 +19,10 @@ case ${THE_DISTRIBUTION_ID} in
1919 my_exit "This CI/CD script only supports debian 9.x and 10.x, will abort" 1
2020 fi
2121 ;;
22+ ubuntu) if [ "${THE_DISTRIBUTION_VERSION}" != "16.04" ] && [ "${THE_DISTRIBUTION_VERSION}" != "18.04" ]; then
23+ my_exit "This CI/CD script only supports ubuntu 16.04 and 18.04, will abort" 1
24+ fi
25+ ;;
2226 centos) if [ "${THE_DISTRIBUTION_VERSION}" != "7" ]; then
2327 my_exit "This CI/CD script only support Centos 7.x, will abort" 1
2428 fi
DevOps/local/test/prepare.sh+4
@@ -20,6 +20,10 @@ case ${THE_DISTRIBUTION_ID} in
2020 my_exit "This CI/CD script only supports debian 9.x and 10.x, will abort" 1
2121 fi
2222 ;;
23+ ubuntu) if [ "${THE_DISTRIBUTION_VERSION}" != "16.04" ] && [ "${THE_DISTRIBUTION_VERSION}" != "18.04" ]; then
24+ my_exit "This CI/CD script only supports ubuntu 16.04 and 18.04, will abort" 1
25+ fi
26+ ;;
2327 centos) if [ "${THE_DISTRIBUTION_VERSION}" != "7" ]; then
2428 my_exit "This CI/CD script only support Centos 7.x, will abort" 1
2529 fi
DevOps/local/test/unfinishing.sh+4
@@ -20,6 +20,10 @@ case ${THE_DISTRIBUTION_ID} in
2020 my_exit "This CI/CD script only supports debian 9.x and 10.x, will abort" 1
2121 fi
2222 ;;
23+ ubuntu) if [ "${THE_DISTRIBUTION_VERSION}" != "16.04" ] && [ "${THE_DISTRIBUTION_VERSION}" != "18.04" ]; then
24+ my_exit "This CI/CD script only supports ubuntu 16.04 and 18.04, will abort" 1
25+ fi
26+ ;;
2327 centos) if [ "${THE_DISTRIBUTION_VERSION}" != "7" ]; then
2428 my_exit "This CI/CD script only support Centos 7.x, will abort" 1
2529 fi
DevOps/local/test/unprepare.sh+4
@@ -19,6 +19,10 @@ case ${THE_DISTRIBUTION_ID} in
1919 my_exit "This CI/CD script only supports debian 9.x and 10.x, will abort" 1
2020 fi
2121 ;;
22+ ubuntu) if [ "${THE_DISTRIBUTION_VERSION}" != "16.04" ] && [ "${THE_DISTRIBUTION_VERSION}" != "18.04" ]; then
23+ my_exit "This CI/CD script only supports ubuntu 16.04 and 18.04, will abort" 1
24+ fi
25+ ;;
2226 centos) if [ "${THE_DISTRIBUTION_VERSION}" != "7" ]; then
2327 my_exit "This CI/CD script only support Centos 7.x, will abort" 1
2428 fi