Permalink
Fetching contributors…
Cannot retrieve contributors at this time
238 lines (215 sloc) 7.41 KB
dist: trusty
sudo: false
language: c
matrix:
include:
- os: osx
osx_image: xcode8.3
- addons:
apt:
sources: [hvr-ghc, deadsnakes]
packages:
- ghc-8.0.2
- python2.7
- python3.4
- python3.5
- python3.6
- libgmp10
- upx-ucl
- shellcheck
- netbase
- ca-certificates
- libgnutls28
env:
- PIP_MINVER=9.0.1 SETUPTOOLS_MINVER=36.6.0
cache:
directories:
- "$HOME/.cabal"
- "$HOME/.stack"
- "$HOME/.ghc"
- "$HOME/Library/Caches/Homebrew"
before_install:
- grep 2016–`date +%Y` package.yaml # Check copyright year
# Check version
- |
if [[ "$TRAVIS_TAG" != "" ]]; then
[[ "$(stack query locals nirum version)" == "'$TRAVIS_TAG'" ]]
grep "$TRAVIS_TAG" README.md # Check output example of -h/--help
fi
# Check changelog
- |
if git show --format=%B --quiet "${TRAVIS_PULL_REQUEST_SHA:-${TRAVIS_TAG:-${TRAVIS_COMMIT}}}" \
| grep '\[changelog skip\]' > /dev/null; then
echo "Skip changelog checker..."
elif [[ "$TRAVIS_TAG" != "" ]]; then
! grep -i "to be released" CHANGES.md
else
[[ "$TRAVIS_COMMIT_RANGE" = "" ]] || \
[[ "$(git diff --name-only "$TRAVIS_COMMIT_RANGE" | grep CHANGES\.md)" != "" ]]
fi
# Install things
- mkdir -p "$HOME/.local/bin"
- export PATH="$HOME/.local/bin:$PATH"
- |
if [[ "$TRAVIS_OS_NAME" = "linux" ]]
then
curl -o "$HOME/.local/bin/checkmate" \
-L https://github.com/spoqa/checkmate/releases/download/0.3.3/checkmate-linux-x86_64
chmod +x "$HOME/.local/bin/checkmate"
checkmate --help
token_encoded='gJvdss03HpHm1tCqhziBezjVi8Y='
token="$(echo $token_encoded | python -m base64 -d | xxd -pu)"
checkmate github-travis --token "$token" || true
fi
- |
if [[ "$TRAVIS_OS_NAME" = "osx" ]]
then
travis_retry curl -L https://www.stackage.org/stack/$TRAVIS_OS_NAME-x86_64 | tar xz --strip-components=1 --include '*/stack' -C "$HOME/.local/bin"
else
travis_retry curl -L https://www.stackage.org/stack/$TRAVIS_OS_NAME-x86_64 | tar xz --wildcards --strip-components=1 -C "$HOME/.local/bin" '*/stack'
fi
- |
if [[ "$TRAVIS_OS_NAME" = "osx" ]]
then
brew update || true
brew upgrade || true
brew update || true
brew install --with-default-names gnu-sed
brew tap dahlia/homebrew-deadsnakes
brew install python34 python35 python3 || \
brew upgrade python34 python35 python3 || \
true
pip3 install --upgrade pip setuptools
fi
- curl -o "$HOME/.local/bin/travis_long" -L https://raw.githubusercontent.com/futurice/fum2github/master/travis_long
- chmod +x "$HOME/.local/bin/travis_long"
install:
- |
if python3 -c "import pip"; then
python3 -m pip install --user -U setuptools
python3 -m pip install --user -U "pip>=$PIP_MINVER"
else
if ! python3 -c "import setuptools"; then
pushd /tmp
curl -L "https://github.com/pypa/setuptools/archive/v$SETUPTOOLS_MINVER.tar.gz" | tar xvfz -
cd setuptools-*/
python3 bootstrap.py
python3 setup.py install --user
popd
fi
python3 -m easy_install --user -U "setuptools>=$SETUPTOOLS_MINVER"
python3 -m easy_install --user -U "pip>=$PIP_MINVER"
fi
- python3 -m pip install --user --upgrade tox
- travis_long stack --no-terminal setup
- travis_long stack --no-terminal install scan -j4
- travis_long stack --no-terminal install -j4 --only-dependencies
- |
if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then
curl -L -o "$HOME/.local/bin/hadolint" \
https://github.com/hadolint/hadolint/releases/download/v1.4.0/hadolint-Linux-x86_64
chmod +x "$HOME/.local/bin/hadolint"
fi
script:
- ls -al "$(python3 -m site --user-base)/bin/tox"
- 'TOX="$(python3 -m site --user-base)/bin/tox" stack --no-terminal test -j4 --coverage'
- ./lint.sh
after_script:
- |
# Since codecov-haskell doesn't work on Windows,
# it should be added to extra-deps during only Travis CI build.
sed -i 's|^## *INSERT CODECOV HERE.*$|- {"git": "https://github.com/spoqa/codecov-haskell.git", "commit": "8448801f8d01624e4cd60420beb3fdc85c099576"}|' stack.yaml
- stack build --install-ghc --no-terminal --copy-bins codecov-haskell
- find . -name '*.tix'
- find . -name '*.mix'
- |
token_encoded='NTBjYmQ4ZTgtN2Y4Ni00Mzg4LWIyN2EtMzMzMzhiNjUwZjc3'
stack exec -- codecov-haskell \
--tix-dir ./.stack-work/install/x86_64-*/lts-*/*/hpc/nirum/ \
--mix-dir ./.stack-work/dist/x86_64-*/Cabal-*/hpc/ \
--token="$(echo $token_encoded | python -m base64 -d)" \
spec
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/29cc2477daa438db4e9d
- 'http://travis-auto-rebuilder.herokuapp.com/76caecf7-abe1-4122-9fcc-aa5226dc10f8/?jobs=1&subject-to=2&retries=5'
on_success: change
on_failure: always
on_start: never
before_deploy:
- mkdir -p /tmp/nirum-build
- export NIGHTLY_BINARY_PATH="/tmp/nirum-build/nirum-$(uname -s | tr '[A-Z]' '[a-z]')-$(uname -m)"
- echo "$NIGHTLY_BINARY_PATH"
- stack clean --no-terminal
- stack build --no-terminal --copy-bins --flag nirum:static
- ls -al "$(stack path --local-bin)/nirum"
- cp "$(stack path --local-bin)/nirum" "$NIGHTLY_BINARY_PATH"
- ls -al "$(dirname "$NIGHTLY_BINARY_PATH")"
- ls -al "$NIGHTLY_BINARY_PATH"
- chmod +x "$NIGHTLY_BINARY_PATH"
- |
if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then
upx-ucl -9 "$NIGHTLY_BINARY_PATH"
fi
- ls -al "$NIGHTLY_BINARY_PATH"
deploy:
# Nightly builds
- provider: s3
on: { branch: master }
skip_cleanup: yes
local_dir: /tmp/nirum-build
upload-dir: travis-builds
acl: public_read
bucket: nightly-builds.nirum.org
access_key_id: "$AWS_ACCESS_KEY_ID"
secret_access_key: "$AWS_SECRET_ACCESS_KEY"
region: us-east-1
# GitHub Releases
- provider: releases
on: { tags: yes }
skip_cleanup: yes
api_key: "$GITHUB_TOKEN"
file_glob: yes
file: /tmp/nirum-build/*
name: "$TRAVIS_TAG"
prerelease: yes
after_deploy: |
[[ "$TRAVIS_TAG" != "" && "$TRAVIS_OS_NAME" = "linux" ]] || exit 0
# Give the GitHub release a proper description
export GITHUB_USER="${TRAVIS_REPO_SLUG%%/[^/]*}" \
GITHUB_REPO="${TRAVIS_REPO_SLUG#[^/]*/}"
curl -L -o "$HOME/.local/bin/submark" \
https://github.com/dahlia/submark/releases/download/0.2.0/submark-linux-x86_64
chmod +x "$HOME/.local/bin/submark"
submark -o /tmp/release-note -i --h2 "Version $TRAVIS_TAG" -O CHANGES.md
pushd /tmp
curl -LO \
https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2
tar xvfj linux-amd64-github-release.tar.bz2
mv bin/linux/amd64/github-release "$HOME/.local/bin"
if [[ "$TRAVIS_TAG" = 0.* ]]; then
pre_release="--pre-release"
fi
github-release edit \
--tag "$TRAVIS_TAG" \
--name "Nirum $TRAVIS_TAG" \
--description "$(cat /tmp/release-note)" \
$pre_release
popd
# sdist
sed -i 's/^- -Werror$//g' package.yaml # Hackage disallows -Werror
stack --no-terminal sdist --ignore-check
# Upload sdist as well to GitHub Releases
for sdist_file in "$(stack path --dist-dir)"/*.tar.gz; do
github-release upload \
--tag "$TRAVIS_TAG" \
--name "$(basename $sdist_file)" \
--file "$sdist_file"
done
# Upload sdist to Hackage
if [[ "$HACKAGE_USERNAME" != "" && "$HACKAGE_PASSWORD" != "" ]]; then
mkdir -p "$HOME/.stack/upload"
python -c 'import json, os; print(json.dumps({"username": os.environ["HACKAGE_USERNAME"], "password": os.environ["HACKAGE_PASSWORD"]}))' > ~/.stack/upload/credentials.json
stack --no-terminal upload --ignore-check --no-signature .
fi