diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..2f5698f --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,38 @@ +version: '{build}' + +image: Visual Studio 2015 + +cache: + - NimBinaries + +matrix: + # We always want 32 and 64-bit compilation + fast_finish: false + +platform: + - x86 + - x64 + +# when multiple CI builds are queued, the tested commit needs to be in the last X commits cloned with "--depth X" +clone_depth: 10 + +install: + # use the newest versions documented here: https://www.appveyor.com/docs/windows-images-software/#mingw-msys-cygwin + - IF "%PLATFORM%" == "x86" SET PATH=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin;%PATH% + - IF "%PLATFORM%" == "x64" SET PATH=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH% + + # build nim from our own branch - this to avoid the day-to-day churn and + # regressions of the fast-paced Nim development while maintaining the + # flexibility to apply patches + - curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus/devel/build_nim.sh + - env MAKE="mingw32-make -j2" ARCH_OVERRIDE=%PLATFORM% bash build_nim.sh Nim csources dist/nimble NimBinaries + - SET PATH=%CD%\Nim\bin;%PATH% + +build_script: + - cd C:\projects\%APPVEYOR_PROJECT_SLUG% + - nimble install -y + +test_script: + - nimble test + +deploy: off diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f6f38e4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,26 @@ +language: c + +# https://docs.travis-ci.com/user/caching/ +cache: + directories: + - NimBinaries + +git: + # when multiple CI builds are queued, the tested commit needs to be in the last X commits cloned with "--depth X" + depth: 10 + +os: + - linux + - osx + +install: + # build nim from our own branch - this to avoid the day-to-day churn and + # regressions of the fast-paced Nim development while maintaining the + # flexibility to apply patches + - curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus/devel/build_nim.sh + - env MAKE="make -j2" bash build_nim.sh Nim csources dist/nimble NimBinaries + - export PATH=$PWD/Nim/bin:$PATH + +script: + - nimble install -y + - nimble test diff --git a/README.md b/README.md new file mode 100644 index 0000000..26d7e49 --- /dev/null +++ b/README.md @@ -0,0 +1,77 @@ +# stew - status e-something w-something + +`stew` is collection of utilities, std library extensions and budding libraries +that are frequently used at Status, but are too small to deserve their own +git repository. + +We use `stew` as a staging ground for code that has yet to be battle-tested. + +Some of these libraries may eventually be proposed for inclusion in Nim or +broken out into separate repositories. + +## Layout + +`stew` modules are made to be fairly independent of each other, but generally +follow the following layout - if you've used C++'s `boost`, you'll feel right at +home: + +``` +# Single-module libraries +stew/small.nim # small libraries that fits in one module + +# Multi-module libraries +stew/libname.nim # Main import file +stew/libname/stuff.nim # Detail import file + +# Nim standard library shims that contain forwards-compatibility code to manage +# support for multiple nim versions - code in here typically has been taken +# from nim `devel` branch and `name` will reexport the corresponding std lib +# module +# stew/shims/macros.nim - module that reexports `macros.nim` adding code from newer nim versions + +# Tests are in the tests folder (duh!) +# To execute, run either `all_tests.nim` or specific `test_xxx.nim` files: +nim c -r tests/all_tests +``` + +## Compatibility + +One of the goals of `stew` is to provide backwards and forwards compatibility +for different Nim versions, such that code using `stew` works well with multiple +versions of Nim. If `stew` is not working with the Nim version you're using, we +welcome patches. + +## Notable libraries + +Libraries are documented either in-module or on a separate README in their +respective folders + +- `bitops2` - an updated version of `bitops.nim`, filling in gaps in original code\ +- `shims` - backports of nim `devel` code to the stable version that Status is using + +## Using stew in your project + +We do not recommend using this library as a normal `nimble` dependency - there +are no versioned releases and we will not maintain API/ABI stability. Instead, +make sure you pin your dependency to a specific git hash (for example using a +submodule) or copy the file to your project instead. + +:warning: No API/ABI stability - pick a commit and stick with it :warning: + +## Contributing to stew + +We welcome contributions to stew - in particular: +* if you feel that some part of `stew` should be part of Nim, we welcome your help in taking it through the Nim PR process. +* if you're using `stew` with a particular Nim version, we welcome compatibility patches gated with `when NimMajor .. and NimMinor ..` + +## License + +Licensed and distributed under either of + +* MIT license: [LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT + +or + +* Apache License, Version 2.0, ([LICENSE-APACHEv2](LICENSE-APACHEv2) or http://www.apache.org/licenses/LICENSE-2.0) + +at your option. These files may not be copied, modified, or distributed except according to those terms. diff --git a/stew.nimble b/stew.nimble index a8947ed..22ccd25 100644 --- a/stew.nimble +++ b/stew.nimble @@ -8,3 +8,8 @@ license = "Apache License 2.0" skipDirs = @["tests"] requires "nim >= 0.19.0" + +task test, "Run all tests": + exec "nim c -r --threads:off tests/all_tests" + exec "nim c -r --threads:on tests/all_tests" + diff --git a/tests/all_tests.nim b/tests/all_tests.nim new file mode 100644 index 0000000..3bfbb6d --- /dev/null +++ b/tests/all_tests.nim @@ -0,0 +1,8 @@ +# stew +# Copyright 2018 Status Research & Development GmbH +# Licensed under either of +# +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) +# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) +# +# at your option. This file may not be copied, modified, or distributed except according to those terms.