Skip to content

Commit

Permalink
ci changes
Browse files Browse the repository at this point in the history
* use cabal build
* use choco on appveyor
  • Loading branch information
coot committed Jan 31, 2020
1 parent 73dad89 commit 2d5bd5c
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 77 deletions.
55 changes: 26 additions & 29 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,44 @@ node_js:
matrix:
include:
- os: linux
dist: trusty
dist: bionic
sudo: false
- os: osx
cache:
directories:
- $HOME/.local/bin
- $HOME/.stack
timeout: 1000
- $HOME/.cabal/packages
- $HOME/.cabal/store
before_cache:
- rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
# remove files that are regenerated by 'cabal update'
- rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.*
- rm -fv $CABALHOME/packages/hackage.haskell.org/*.json
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
- rm -rfv $CABALHOME/packages/head.hackage
addons:
apt:
update: true
packages:
- libgmp-dev
install:
- libffi-dev
- libncurses-dev
- libtinfo5
before-install:
- export CABALHOME=$HOME/.cabal
- export BOOTSTRAP_HASKELL_NONINTERACTIVE="true"
- export PATH="${CABALHOME}/bin:${HOME}/.ghcup/bin:${HOME}/.local/bin:${PATH}"
- mkdir -p $HOME/.local/bin
- export PATH=$HOME/.local/bin:$PATH
- | # install `stack`
if test ! -f "${HOME}/.local/bin/stack"
then
URL="https://www.stackage.org/stack/$TRAVIS_OS_NAME-x86_64"
curl --location "$URL" > stack.tar.gz
gunzip stack.tar.gz
tar -x -f stack.tar --strip-components 1
mv stack "$HOME/.local/bin/"
fi
- | # install `timeout`
if [ "$TRAVIS_OS_NAME" == "osx" ]
then
if ! which gtimeout >/dev/null
then
brew update
brew install coreutils
fi
export TIMEOUT=gtimeout
else
export TIMEOUT=timeout
fi
install:
- curl --proto '=https' -o ghcup.sh --tlsv1.2 -sSf https://get-ghcup.haskell.org
- sh ghcup.sh
- ghcup install 8.6.5
- cabal install purescript-0.13.6
- npm install -g bower
- stack --no-nix --no-terminal --jobs 2 build --pedantic
script:
- stack --no-nix --no-terminal --jobs 2 build --pedantic --test --ta="-m generators -m dceExpr -m dceEval -m TestLib"
- cabal build exe:zephyr
- cabal run -f test-with-cabal zephyr-test -- -m generators -m dceEval -m dceExpr -m TestLib
before_deploy:
- bundle/build.sh $TRAVIS_OS_NAME
deploy:
Expand Down
53 changes: 22 additions & 31 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,38 @@
# Disabled cache in hope of improving reliability of AppVeyor builds
#cache:
#- "c:\\sr" # stack root, short paths == fewer problems

environment:
global:
STACK_ROOT: "c:\\sr"
STACK_VER: 2.1.3
nodejs_version: "8"
clone_folder: "c:\\zephyr"

cache:
- c:\zephyr\dist-newstyle
install:
# http://help.appveyor.com/discussions/problems/6312-curl-command-not-found
- set PATH=C:\Program Files\Git\mingw64\bin;%PATH%
- ps: Install-Product node 8
- npm install -g bower
- set PATH=%AppData%\npm;%PATH%
- ps: | # install stack
New-Item -ItemType Directory -Force -Path C:\tools
$env:Path += ";C:\tools"
$stackRelease = "stack-$env:STACK_VER-windows-x86_64"
$downloadUrl = "https://github.com/commercialhaskell/stack/releases/download/v$env:STACK_VER/$stackRelease.zip"
(New-Object Net.WebClient).DownloadFile($downloadUrl, 'c:\tools\stack.zip')
pushd c:\tools
7z x c:\tools\stack.zip stack.exe
popd
- choco install ghc --version 8.6.5
- choco install cabal
- choco install purescript --version 0.13.6
- choco install nodejs
- choco install bower
- refreshenv
- ghc --version
- cabal --version
- cabal update -v
build_script:
- stack setup > nul
# The ugly echo "" hack is to avoid complaints about 0 being an invalid file
# descriptor.
- echo "" | stack --no-nix --no-terminal --jobs 2 build --pedantic --haddock --no-haddock-deps
- ps: |
# TODO: enable -Werror
cabal build exe:zephyr
cabal build -f test-with-cabal zephyr-test
- ps: bash bundle/build.sh win64
test_script:
- echo "" | stack --no-nix --no-terminal --jobs 2 test --pedantic --haddock --no-haddock-deps --ta="-m dceExpr -m dceEval"
# TODO: not testing `-m TestLib`
- cabal run -f test-with-cabal zephyr-test -- -m generators -m dceEval -m dceExpr
artifacts:
- path: bundle\win64.tar.gz
name: win64.tar.gz
- path: bundle\win64.sha
name: win64.sha
- path: bundle\x86_64-windows.tar.gz
name: x86_64-windows.tar.gz
- path: bundle\x86_64-windows.sha
name: x86_64-windows.sha
deploy:
- provider: GitHub
auth_token:
secure: gHIxz3scq98LOgduo20IiKNFcLOmcKHHKH0qI4/z4TawrmbR+MV/rb1mG9GCXf7M
artifact: win64.tar.gz,win64.sha
artifact: x86-64-windows.tar.gz,x86-64-windows.sha
draft: true
force_update: true
on:
Expand Down
31 changes: 14 additions & 17 deletions bundle/build.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#!/bin/bash

## Bundle zephyr
## Usage bundle.sh os
set -e

nix="";
if [[ ${1} == "--nix" ]]; then
nix="--nix";
shift;
fi

if [[ -z ${1} ]]; then
echo "Usage build.sh os_name";
exit 1;
Expand All @@ -17,38 +13,39 @@ fi
# Build OS_NAME
case $1 in
"linux")
OS_NAME="linux64";;
OS_NAME="x86_64-linux";;
"osx")
OS_NAME="macos";;
OS_NAME="x86_64-darwin";;
"win64")
OS_NAME="x86_64-windows";;
*)
OS_NAME=${1};;
esac

pushd $(stack path --project-root);

if [[ "$OS" = "win64" ]]
then
BIN_EXT=".exe"
else
BIN_EXT=""
fi
LOCAL_INSTALL_ROOT=$(stack path ${nix} --local-install-root)

LOCAL_INSTALL_ROOT="dist-newstyle/build/${OS_NAME}/ghc-8.6.5/zephyr-0.2.2/x/zephyr/build/zephyr"
ZEPHYR="${LOCAL_INSTALL_ROOT}/zephyr${BIN_EXT}"

BUNDLE_DIR="bundle/zephyr"
mkdir -p ${BUNDLE_DIR}

ZEPHYR_BIN="${LOCAL_INSTALL_ROOT}/bin/zephyr${BIN_EXT}"
# strip the executable
if [[ ${OS_NAME} != "win64" ]]; then
strip ${ZEPHYR_BIN};
if [[ ${OS_NAME} != "x86_64-windows" ]]; then
strip ${ZEPHYR};
fi
cp ${ZEPHYR_BIN} README.md LICENSE ${BUNDLE_DIR};
cp ${ZEPHYR} README.md LICENSE ${BUNDLE_DIR};

# dependencies
stack ${nix} ls dependencies > "${BUNDLE_DIR}/dependencies"
cabal info . > "${BUNDLE_DIR}/info"

# Calculate the SHA hash
if [[ ${OS_NAME} = "win64" ]]; then
if [[ ${OS_NAME} = "x86_64-windows" ]]; then
SHASUM="openssl dgst -sha1";
else
SHASUM="shasum";
Expand Down

0 comments on commit 2d5bd5c

Please sign in to comment.