Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/v0.25dev' into stdevAlDen_t34_…
Browse files Browse the repository at this point in the history
…hardware-wallet_tests

Conflicts:
	lib/cgo/tests/check_cipher.hash.c
	lib/cgo/tests/test_main.c
	lib/cgo/tests/testutils/libsky_assert.c
ref #34
  • Loading branch information
Alvaro Denis committed May 14, 2019
2 parents ed4c63a + 875877d commit 810c8e5
Show file tree
Hide file tree
Showing 69 changed files with 3,207 additions and 2,964 deletions.
55 changes: 55 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: false
AlignEscapedNewlinesLeft: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: false
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackParameters: false
BreakBeforeBinaryOperators: false
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: true
AfterFunction: true
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
CommentPragmas: '^lint'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
IndentCaseLabels: false
IndentFunctionDeclarationAfterType: false
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
133 changes: 122 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,127 @@
sudo: required
services:
- docker
language: go
go:
- "1.11.x"

matrix:
include:
- os: linux
dist: xenial
env: VERSION_UPGRADE_TEST_WAIT_TIMEOUT=45s
- os: linux
env:
- QEMU_PLATFORM=orangepi-plus2
- QEMU_OS=ubuntu
- os: linux
env:
- QEMU_PLATFORM=orangepi-plus2
- QEMU_OS=debian
- os: linux
env:
- QEMU_PLATFORM=orangepi-plus2
- QEMU_OS=fedora
# - os: linux
# env:
# - QEMU_PLATFORM=raspberry-pi2
# - QEMU_OS=ubuntu
# - os: linux
# env:
# - QEMU_PLATFORM=raspberry-pi2
# - QEMU_OS=debian
# - os: linux
# env:
# - QEMU_PLATFORM=raspberry-pi2
# - QEMU_OS=fedora
- os: linux
env:
- QEMU_PLATFORM=raspberrypi3
- QEMU_OS=ubuntu
- os: linux
env:
- QEMU_PLATFORM=raspberrypi3
- QEMU_OS=debian
- os: linux
env:
- QEMU_PLATFORM=raspberrypi3
- QEMU_OS=fedora
# - os: linux
# env:
# - QEMU_PLATFORM=beaglebone-black
# - QEMU_OS=ubuntu
# - os: linux
# env:
# - QEMU_PLATFORM=beaglebone-black
# - QEMU_OS=debian
# - os: linux
# env:
# - QEMU_PLATFORM=beaglebone-black
# - QEMU_OS=fedora
# - os: linux
# env:
# - QEMU_PLATFORM=asus-tinker-board
# - QEMU_OS=ubuntu
# - os: linux
# env:
# - QEMU_PLATFORM=asus-tinker-board
# - QEMU_OS=debian
# - os: linux
# env:
# - QEMU_PLATFORM=asus-tinker-board
# - QEMU_OS=fedora
# - os: linux
# env:
# - QEMU_PLATFORM=bananapi-m1-plus
# - QEMU_OS=ubuntu
# - os: linux
# env:
# - QEMU_PLATFORM=bananapi-m1-plus
# - QEMU_OS=debian
# - os: linux
# env:
# - QEMU_PLATFORM=bananapi-m1-plus
# - QEMU_OS=fedora
# - os: linux
# env:
# - QEMU_PLATFORM=odroid-xu4
# - QEMU_OS=ubuntu
# - os: linux
# env:
# - QEMU_PLATFORM=odroid-xu4
# - QEMU_OS=debian
# - os: linux
# env:
# - QEMU_PLATFORM=odroid-xu4
# - QEMU_OS=fedora
# - os: linux
# env:
# - QEMU_PLATFORM=odroid-c1
# - QEMU_OS=ubuntu
# - os: linux
# env:
# - QEMU_PLATFORM=odroid-c1
# - QEMU_OS=debian
# - os: linux
# env:
# - QEMU_PLATFORM=odroid-c1
# - QEMU_OS=fedora
# - os: linux
# env:
# - QEMU_PLATFORM=odroid-xu4
# - QEMU_OS=ubuntu
# - os: linux
# env:
# - QEMU_PLATFORM=odroid-xu4
# - QEMU_OS=debian
# - os: linux
# env:
# - QEMU_PLATFORM=odroid-xu4
# - QEMU_OS=fedora
- os: osx
osx_image: xcode8.3
env: VERSION_UPGRADE_TEST_WAIT_TIMEOUT=60s

before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && sudo apt-get update -qq; fi
- VERSION=1.10.2 ./ci-scripts/install-golangci-lint.sh
- ./ci-scripts/install-travis-gcc.sh
- eval "CC=gcc-6 && CXX=g++-6"

Expand All @@ -24,18 +131,22 @@ env:
- BUILDLIB_DIR: $BUILD_DIR/libskycoin
- LIB_DIR: lib
- CGO_ENABLED: 1
- VERSION_UPGRADE_TEST_WAIT_TIMEOUT: 60s
- PATH_DIR: $GOPATH/src/github.com/skycoin/libskycoin/


install:
# Install gox
- go get github.com/gz-c/gox
- go get -t ./...
- make install-linters
- VERSION=1.10.2 ./ci-scripts/install-golangci-lint.sh
# Install pinned golangci-lint, overriding the latest version install by make install-linters
- make install-deps-libc
- if [[ -z "$QEMU_PLATFORM" ]]; then go get github.com/gz-c/gox; fi
- if [[ -z "$QEMU_PLATFORM" ]]; then go get -t ./... ; fi
- if [[ -z "$QEMU_PLATFORM" ]]; then make install-linters ; fi
- if [[ -z "$QEMU_PLATFORM" ]]; then VERSION=1.10.2 ./ci-scripts/install-golangci-lint.sh ; fi
- if [[ -z "$QEMU_PLATFORM" ]]; then make install-deps-libc ; fi

script:
- make check
- echo $PWD
- if [[ -z "$QEMU_PLATFORM" ]]; then make check ; fi
- if [[ "$QEMU_PLATFORM" ]]; then docker build --build-arg QEMU_PLATFORM --build-arg QEMU_OS --file docker/images/test-arm/Dockerfile . -t skydev-test ; fi

notifications:
email: false
Expand Down
10 changes: 3 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Added
- Add CLI `addressTransactions` command
- Add `/api/v2/wallet/seed/verify` to verify if seed is a valid bip39 mnemonic seed

### Fixed

- `/api/v1/health` will return correct build info when running Docker containers based on `skycoin/skycoin` mainnet image.

### Changed
- Switch `skycoin-cli` from `urfave/cli` to `spf13/cobra`.
Now all options of a cli command must only use `--` prefix instead of a mix of `--` and `-` prefixes.
`-` prefix is only allowed when using shorthand notation.

- Switch `skycoin-cli` from `urfave/cli` to `spf13/cobra`.

### Removed

- Delete function `SKY_base58_String2Hex`

## [0.25.0] - 2018-12-19

### Upcoming deprecated method removal notice
Expand Down
56 changes: 42 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.DEFAULT_GOAL := help
.PHONY: test-libc test-lint build-libc check
.PHONY: install-linters format clean-libc
.PHONY: install-linters format clean-libc format-libc lint-libc

COIN ?= skycoin

Expand Down Expand Up @@ -40,21 +40,22 @@ STDC_FLAG = $(python -c "if tuple(map(int, '$(CC_VERSION)'.split('.'))) < (6,):
LIBC_LIBS = `pkg-config --cflags --libs check`
LIBC_FLAGS = -I$(LIBSRC_DIR) -I$(INCLUDE_DIR) -I$(BUILD_DIR)/usr/include -L $(BUILDLIB_DIR) -L$(BUILD_DIR)/usr/lib
# Platform specific checks
OSNAME = $(TRAVIS_OS_NAME)
OSNAME = $(TRAVIS_OS_NAME)
UNAME_S = $(shell uname -s)
CGO_ENABLED=1

ifeq ($(shell uname -s),Linux)
PKG_CLANG_FORMAT = clang-format
PKG_CLANG_LINTER = clang-tidy
PKG_LIB_TEST = check

ifeq ($(UNAME_S),Linux)
LDLIBS=$(LIBC_LIBS) -lpthread
LDPATH=$(shell printenv LD_LIBRARY_PATH)
LDPATHVAR=LD_LIBRARY_PATH
LDFLAGS=$(LIBC_FLAGS) $(STDC_FLAG)
ifndef OSNAME
OSNAME = linux
endif
else ifeq ($(shell uname -s),Darwin)
ifndef OSNAME
OSNAME = osx
endif
OSNAME ?= linux
else ifeq ($(UNAME_S),Darwin)
OSNAME ?= osx
LDLIBS = $(LIBC_LIBS)
LDPATH=$(shell printenv DYLD_LIBRARY_PATH)
LDPATHVAR=DYLD_LIBRARY_PATH
Expand Down Expand Up @@ -128,13 +129,35 @@ lint: ## Run linters. Use make install-linters first.
# The govet version in golangci-lint is out of date and has spurious warnings, run it separately
go vet -all ./...

check: lint test-libc ## Run tests and linters
lint-libc: format-libc
# Linter LIBC
clang-tidy lib/cgo/tests/*.c -- $(LIBC_FLAGS) -Wincompatible-pointer-types


check: lint test-libc lint-libc ## Run tests and linters

install-linters: ## Install linters
install-linters-Linux: ## Install linters on GNU/Linux
sudo apt-get install $(PKG_CLANG_FORMAT)
sudo apt-get install $(PKG_CLANG_LINTER)

install-linters-Darwin: ## Install linters on Mac OSX
# brew install $(PKG_CLANG_FORMAT)
brew install llvm
ln -s "/usr/local/opt/llvm/bin/clang-format" "/usr/local/bin/clang-format"
ln -s "/usr/local/opt/llvm/bin/clang-tidy" "/usr/local/bin/clang-tidy"

install-deps-Linux: ## Install deps on GNU/Linux
sudo apt-get install $(PKG_LIB_TEST)

install-deps-Darwin: ## Install deps on Mac OSX
brew install $(PKG_LIB_TEST)

install-linters: install-linters-$(UNAME_S) ## Install linters
go get -u github.com/FiloSottile/vendorcheck
# For some reason this install method is not recommended, see https://github.com/golangci/golangci-lint#install
# However, they suggest `curl ... | bash` which we should not do
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
VERSION=1.10.2 ./ci-scripts/install-golangci-lint.sh

install-deps-libc: install-deps-libc-$(OSNAME)

Expand All @@ -150,9 +173,14 @@ format: ## Formats the code. Must have goimports installed (use make install-lin
goimports -w -local github.com/skycoin/skycoin ./lib

clean-libc: ## Clean files generate by library
rm -rfv $(BUILDLIB_DIR)/libskycoin.so
rm -rfv $(BUILDLIB_DIR)/libskycoin.a
rm -rfv $(BUILDLIB_DIR)
rm -rfv bin
rm -rfv qemu_test_libskycoin*
rm -rfv include/libskycoin.h

format-libc:
$(PKG_CLANG_FORMAT) -sort-includes -verbose -i -assume-filename=.clang-format lib/cgo/tests/*.c
$(PKG_CLANG_FORMAT) -sort-includes -verbose -i -assume-filename=.clang-format include/*.h

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,34 @@ The Skycoin C library is made of the following components

Consult respective `README` files for further details.

## Development

We have two branches: `master` and `develop`.

- `develop` is the default branch and will always have the latest code.
The submodule at `gopath/src/github.com/skycoin/skycoin` has to be
in sync with `skycoin/skycoin` `develop` branch.
- `master` will always be equal to the current stable release on the website, and should correspond with the latest release tag.
The submodule at `gopath/src/github.com/skycoin/skycoin` has to be
in sync with `skycoin/skycoin` `master` branch.

Separate stable development branches will be created to work on releases for supporting the
most recent stable version of Skycoin. The name of these branches should be the Skycoin
major and minor version numbers followed by `dev` suffix e.g. `0.25dev`.
These branches may be forked out of either `master` or `develop` branches, and
the submodule at `gopath/src/github.com/skycoin/skycoin` has to be
in sync with the corresponding tag of `skycoin/skycoin` official repository.

Stable development branches are created most of the time for the following reasons:

- A Skycoin release increasing [patch version number](https://semver.org/).
- Enhanced support and bug fixes for a version of PySkycoin compiled against an
stable version of Skycoin
- Backporting useful features added in `develop`.

### General development guidelines

The following rules are enforced

- Contributions must comply to the development guidelines documented in the [Skycoin wiki](https://github.com/skycoin/skycoin/wiki).
- C / C++ code must comply to the [Bitcoin C coding style](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#coding-style-c) (enforced by `clang-format`).
4 changes: 4 additions & 0 deletions ci-scripts/docker_install_alpine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

apk update
apk add --upgrade fts-dev build-base gcc git curl wget check-dev alpine-sdk make g++ zlib-dev
8 changes: 8 additions & 0 deletions ci-scripts/docker_install_debian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

apt-get update
apt-get install gcc-6 g++-6 curl wget -y

wget -c https://github.com/libcheck/check/releases/download/0.12.0/check-0.12.0.tar.gz
tar -xzf check-0.12.0.tar.gz
cd check-0.12.0 && ./configure --prefix=/usr --disable-static && make && sudo make install
4 changes: 4 additions & 0 deletions ci-scripts/docker_install_fedora.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
dnf update
dnf install check-devel -y
yum groupinstall "Development Tools" "Development Libraries" -y
Loading

0 comments on commit 810c8e5

Please sign in to comment.