Update Travis installation of Nim, as the master branch is defunct

This commit is contained in:
Oleh Prypin 2019-08-09 21:01:33 +02:00
parent 456a981971
commit 33aaa0642e
1 changed files with 30 additions and 24 deletions

View File

@ -173,55 +173,61 @@ Same for your code documentation.
Detailed guide, which the following example originates from: + Detailed guide, which the following example originates from: +
http://blaxpirit.com/blog/22/advanced-uses-of-travis-ci-with-nim.html[Advanced uses of Travis CI with Nim] http://blaxpirit.com/blog/22/advanced-uses-of-travis-ci-with-nim.html[Advanced uses of Travis CI with Nim]
https://github.com/oprypin/nim-random/blob/ed21c4a1289d9314901f253e6edce826a794b17e/.travis.yml[Real example]
[source,yaml] [source,yaml]
---- ----
# Copied from https://github.com/nim-lang/Nim/wiki/TravisCI
language: c language: c
env: compiler: gcc
# Build and test against the master and devel branches of Nim
- BRANCH=master
- BRANCH=devel
compiler:
# Build and test using both gcc and clang
- gcc
- clang
matrix: matrix:
include:
- {}
- compiler: clang
- env: nim_channel=devel
allow_failures: allow_failures:
# Ignore failures when building against the devel Nim branch - env: nim_channel=devel
- env: BRANCH=devel
fast_finish: true fast_finish: true
before_install:
- nim_channel="${nim_channel-stable}"
- |
if [ "$nim_channel" = stable ]; then
nim_branch="v$(curl https://nim-lang.org/channels/stable)"
else
nim_branch="$nim_channel"
fi
install: install:
- | - |
if [ ! -x nim-$BRANCH/bin/nim ]; then if [ ! -x "nim-$nim_channel/bin/nim" ]; then
git clone -b $BRANCH --depth 1 git://github.com/nim-lang/nim nim-$BRANCH/ git clone -b "$nim_branch" https://github.com/nim-lang/nim "nim-$nim_channel/"
cd nim-$BRANCH pushd "nim-$nim_channel"
git clone --depth 1 git://github.com/nim-lang/csources csources/ git clone --depth 1 https://github.com/nim-lang/csources csources/
cd csources pushd csources
sh build.sh sh build.sh
cd .. popd
rm -rf csources rm -rf csources
bin/nim c koch bin/nim c koch
./koch boot -d:release ./koch boot -d:release
else else
cd nim-$BRANCH pushd "nim-$nim_channel"
git fetch origin git fetch origin "$nim_branch"
if ! git merge FETCH_HEAD | grep "Already up-to-date"; then if ! git merge FETCH_HEAD | grep "Already up.to.date"; then
bin/nim c koch bin/nim c koch
./koch boot -d:release ./koch boot -d:release
fi fi
fi fi
cd .. popd
before_script: before_script:
- export PATH="nim-$BRANCH/bin${PATH:+:$PATH}" - export PATH="nim-$nim_channel/bin${PATH:+:$PATH}"
script: script:
# Replace uppercase strings! # Replace uppercase strings!
- nim c --cc:$CC --verbosity:0 -r MYFILE.nim - nim compile --cc:$CC --verbosity:0 --run MYFILE.nim
# Optional: build docs. # Optional: build docs.
- nim doc --docSeeSrcUrl:https://github.com/AUTHOR/MYPROJECT/blob/master --project MYFILE.nim - nim doc --docSeeSrcUrl:https://github.com/AUTHOR/MYPROJECT/blob/master --project MYFILE.nim
cache: cache:
directories: directories:
- nim-master - nim-master
- nim-devel - nim-stable
branches: branches:
except: except:
- gh-pages - gh-pages