diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000..e814b2af5e527 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,83 @@ +# use the official gcc image, based on debian +# can use versions as well, like gcc:5.2 +# see https://hub.docker.com/_/gcc/ +image: gcc + +stages: + - pre-build + - build + - test + +.linux_set_path: &linux_set_path_def + before_script: + - export PATH=$(pwd)/bin:$PATH + tags: + - linux + +.windows_set_path: &win_set_path_def + before_script: + - set PATH=%CD%\bin;%PATH% + tags: + - windows + +build-linux: + stage: build + script: + - sh ci/build.sh + artifacts: + paths: + - bin/nim + - bin/nimd + - compiler/nim + - koch + expire_in: 1 week + tags: + - linux + +build-windows: + stage: build + script: + - ci\build.bat + artifacts: + paths: + - bin\nim.exe + - bin\nimd.exe + - compiler\nim.exe + - koch.exe + expire_in: 1 week + tags: + - windows + +test-linux: + stage: test + <<: *linux_set_path_def + script: + - sh ci/deps.sh + - nim c --taintMode:on tests/testament/tester + - tests/testament/tester --pedantic all + tags: + - linux + +test-windows: + stage: test + <<: *win_set_path_def + script: + - call ci\deps.bat + - nim c --taintMode:on tests\testament\tester + - tests\testament\tester.exe --pedantic all + tags: + - windows + +.csources: &csources_definition + stage: test + script: + - nim -v + - ./koch csources + - ./koch xz + artifacts: + paths: + - csources + +csources-linux: + <<: *csources_definition + <<: *linux_set_path_def diff --git a/ci/build.bat b/ci/build.bat new file mode 100644 index 0000000000000..cdce8d3d2927a --- /dev/null +++ b/ci/build.bat @@ -0,0 +1,14 @@ +REM Some debug info +echo "Running on %CI_RUNNER_ID% (%CI_RUNNER_DESCRIPTION%) with tags %CI_RUNNER_TAGS%." +gcc -v + +git clone --depth 1 https://github.com/nim-lang/csources.git +cd csources +call build64.bat +cd .. +set PATH=%CD%\bin;%PATH% +nim -v +nim c koch +koch.exe boot +copy bin/nim bin/nimd +koch.exe boot -d:release diff --git a/ci/build.sh b/ci/build.sh new file mode 100644 index 0000000000000..a0fee149775d5 --- /dev/null +++ b/ci/build.sh @@ -0,0 +1,15 @@ +sh ci/deps.sh + +# Build from C sources. +git clone --depth 1 https://github.com/nim-lang/csources.git +cd csources +sh build.sh +cd .. +# Add Nim to the PATH +export PATH=$(pwd)/bin:$PATH +# Bootstrap. +nim -v +nim c koch +./koch boot +cp bin/nim bin/nimd +./koch boot -d:release diff --git a/ci/deps.bat b/ci/deps.bat new file mode 100644 index 0000000000000..d73a7b5af5f34 --- /dev/null +++ b/ci/deps.bat @@ -0,0 +1,5 @@ +# Nimble deps +nim e install_nimble.nims +nim e tests/test_nimscript.nims +nimble update +nimble install -y zip opengl sdl1 jester niminst diff --git a/ci/deps.sh b/ci/deps.sh new file mode 100644 index 0000000000000..9ca70b6d2a6b6 --- /dev/null +++ b/ci/deps.sh @@ -0,0 +1,19 @@ +# Some debug info +echo "Running on $CI_RUNNER_ID ($CI_RUNNER_DESCRIPTION) with tags $CI_RUNNER_TAGS." +gcc -v +# Packages +apt-get update -qq +apt-get install -y -qq libcurl4-openssl-dev libsdl1.2-dev libgc-dev nodejs +# FASM +wget http://nim-lang.org/download/fasm-1.71.39.tgz +tar xvf fasm-1.71.39.tgz +# PATH handling +export PATH=$(pwd)/fasm:$PATH +which fasm +export PATH=$(pwd)/bin:$PATH + +# Nimble deps +nim e install_nimble.nims +nim e tests/test_nimscript.nims +nimble update +nimble install zip opengl sdl1 jester niminst