Updated BuildServices (asciidoc)

This commit is contained in:
Federico Ceratto 2018-10-14 16:36:45 +01:00
parent 4b62921a99
commit d18466d165
1 changed files with 11 additions and 92 deletions

View File

@ -3,113 +3,32 @@
Building your code on Circle CI is useful to check regressions against the master and devel branches of Nim. Building your code on Circle CI is useful to check regressions against the master and devel branches of Nim.
Same for your code documentation. Same for your code documentation.
Configure the build: The Nim docker image contains the latest version.
Under Test Commands >> Dependency Commands >> Pre-dependency commands:
[source,sh]
----
wget http://http.us.debian.org/debian/pool/main/n/nim/nim_0.18.0-2_amd64.deb
wget http://http.us.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.0h-4_amd64.deb
sudo dpkg -i *_amd64.deb
----
Under Test Commands >> Test Commands >> Test Commands:
[source,sh]
----
# This will fetch Nimble dependencies
nimble build -y
nim c -r <mytest.nim>
----
Be aware that the available .deb packages will change over time.
## Building Nim projects on Circle CI v2.0 using choosenim
choosenim allow picking fixed Nim versions or updating to the last stable or devel version
Use this .circleci/config.yml Use this .circleci/config.yml
[source,yaml]
---
version: 2
jobs:
build:
machine: true
steps:
- run: echo 'export PATH=~/.nimble/bin:$PATH' >> $BASH_ENV
- checkout
# Reuse cached Nim compiler
- restore_cache:
key: compiler-0002
- run:
command: |
if [ -f ~/.nimble/bin/choosenim ]; then
echo "Updating Nim using choosenim"
choosenim stable
else
echo "Installing choosenim and Nim"
wget https://raw.githubusercontent.com/dom96/choosenim/master/scripts/choosenim-unix-init.sh
sh choosenim-unix-init.sh -y
fi
- save_cache:
key: compiler-0002
paths:
- ~/.nimble
- ~/.choosenim
- run:
command: |
nimble build -y
# add here your tests
---
## Building Nim projects on Circle CI v2.0 using Nim Devel
Create .circleci/config.yml as:
[source,yaml] [source,yaml]
---- ----
version: 2 version: 2
jobs: jobs:
build: build:
machine: true docker:
- image: nimlang/nim
steps: steps:
- run: echo 'export PATH=./Nim/bin:$PATH' >> $BASH_ENV - run: echo 'export PATH=~/.nimble/bin:$PATH' >> $BASH_ENV
- checkout - checkout
# Reuse cached Nim compiler # Reuse cached directories
- restore_cache: - restore_cache:
key: compiler-0000 key: nim-0000
- run: - run:
command: | command: |
if [ -d Nim ]; then # Example: adding OS libraries
cd Nim apt-get update
git fetch apt-get install -y --no-install-recommends libsodium23
if [ "$(git rev-parse HEAD)" == "$(git rev-parse @{u})" ]; then
echo "Nim is up to date"
build_nim=false
else
echo "pulling new Nim commits"
build_nim=true
git pull
fi
else
echo "cloning Nim for the first time"
build_nim=true
git clone --depth 1 https://github.com/nim-lang/Nim.git
cd Nim
git clone --depth 1 git://github.com/nim-lang/csources.git csources
cd csources
sh build.sh
cd ..
fi
if [ "$build_nim" = true ]; then
./bin/nim c koch
./koch boot -d:release
./koch tools
fi
- save_cache: - save_cache:
key: compiler-0000 key: nim-0000
paths: paths:
- Nim - .nimble
- run: nimble build -y - run: nimble build -y
- run: nim c -r <mytest.nim> - run: nim c -r <mytest.nim>
- store_artifacts: - store_artifacts: