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.
Same for your code documentation.
Configure the build:
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
The Nim docker image contains the latest version.
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]
----
version: 2
jobs:
build:
machine: true
docker:
- image: nimlang/nim
steps:
- run: echo 'export PATH=./Nim/bin:$PATH' >> $BASH_ENV
- run: echo 'export PATH=~/.nimble/bin:$PATH' >> $BASH_ENV
- checkout
# Reuse cached Nim compiler
# Reuse cached directories
- restore_cache:
key: compiler-0000
key: nim-0000
- run:
command: |
if [ -d Nim ]; then
cd Nim
git fetch
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
# Example: adding OS libraries
apt-get update
apt-get install -y --no-install-recommends libsodium23
- save_cache:
key: compiler-0000
key: nim-0000
paths:
- Nim
- .nimble
- run: nimble build -y
- run: nim c -r <mytest.nim>
- store_artifacts: