From 74926b4c07ced04e0064f4e4a20d56cfd15f1923 Mon Sep 17 00:00:00 2001 From: Maykel Arias Torres Date: Mon, 22 Apr 2019 00:15:50 -0400 Subject: [PATCH 01/14] [README] refs #18 Update README.md --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/README.md b/README.md index cf60e5f6e..b69ae2264 100644 --- a/README.md +++ b/README.md @@ -26,3 +26,56 @@ The Skycoin C library is made of the following components Consult respective `README` files for further details. + +- [Make rules](#make-rules) +- [Development setup](#development-setup) + - [Running tests](#running-tests) + - [Releases](#releases) + - [Update the version](#update-the-version) + - [Pre-release testing](#pre-release-testing) + - [Creating release builds](#creating-release-builds) + + +## Make Rules + +All these make rules require skycoin to be a git submodule of pyskycoin + +- `build-libc` + * Compiles skycoin C language library. +- `test-libc` + * Compiles skycoin C language library and executes the tests. +- `build-libc-static` + * Build libskycoin C static library +- `build-libc-shared` + * Build libskycoin C shared library + + +## Development setup + + ### Running tests + + ```sh + $ make test-libc + ``` + + ### Releases + + #### Update the version + + 0. If the `master` branch has commits that are not in `develop` (e.g. due to a hotfix applied to `master`), merge `master` into `develop` (and fix any build or test failures) + 0. Switch to a new release branch named `release-X.Y.Z` for preparing the release. + 0. Ensure that the submodule at `gopath/src/github.com/skycoin/skycoin` is in sync with respect to the corresponding tag in https://github.com/skycoin/skycoin repository. + 0. Update `CHANGELOG.md`: move the "unreleased" changes to the version and add the date. + 0. Follow the steps in [pre-release testing](#pre-release-testing) + 0. Make a PR merging the release branch into `master` + 0. Review the PR and merge it + 0. Tag the `master` branch with the version number. Version tags start with `v`, e.g. `v0.20.0`. Sign the tag. If you have your GPG key in github, creating a release on the Github website will automatically tag the release. It can be tagged from the command line with `git tag -as v0.20.0 $COMMIT_ID`, but Github will not recognize it as a "release". + 0. Release builds are created and uploaded by travis. To do it manually, checkout the master branch and follow the [create release builds instructions](#creating-release-builds). + + #### Pre-release testing + + Perform these actions before releasing: + + ```sh + make check + ``` From bb3f105365aac7eafb329a80e6b86368f9c18b05 Mon Sep 17 00:00:00 2001 From: Olemis Lang Date: Wed, 8 May 2019 17:47:55 -0400 Subject: [PATCH 02/14] [ci] refs #18 - Install golangci-lint from official instructions at https://github.com/golangci/golangci-lint#ci-installation --- Makefile | 5 +- ci-scripts/install-golangci-lint.sh | 392 +++++++++++++++++++++++++++- 2 files changed, 381 insertions(+), 16 deletions(-) mode change 100755 => 100644 ci-scripts/install-golangci-lint.sh diff --git a/Makefile b/Makefile index b6905f15b..89cd4ee17 100644 --- a/Makefile +++ b/Makefile @@ -150,10 +150,7 @@ install-deps-Darwin: ## Install deps on Mac OSX 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 + cat ./ci-scripts/install-golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.10.2 install-deps-libc: install-deps-libc-$(OSNAME) diff --git a/ci-scripts/install-golangci-lint.sh b/ci-scripts/install-golangci-lint.sh old mode 100755 new mode 100644 index 6c796c7dc..fdec86064 --- a/ci-scripts/install-golangci-lint.sh +++ b/ci-scripts/install-golangci-lint.sh @@ -1,17 +1,385 @@ -#!/usr/bin/env bash +#!/bin/sh +set -e +# Code generated by godownloader on 2019-05-02T19:05:24Z. DO NOT EDIT. +# -if [ -z "$VERSION" ]; then - echo "VERSION must be set" - exit 1 -fi +usage() { + this=$1 + cat </dev/null +} +echoerr() { + echo "$@" 1>&2 +} +log_prefix() { + echo "$0" +} +_logp=6 +log_set_priority() { + _logp="$1" +} +log_priority() { + if test -z "$1"; then + echo "$_logp" + return + fi + [ "$1" -le "$_logp" ] +} +log_tag() { + case $1 in + 0) echo "emerg" ;; + 1) echo "alert" ;; + 2) echo "crit" ;; + 3) echo "err" ;; + 4) echo "warning" ;; + 5) echo "notice" ;; + 6) echo "info" ;; + 7) echo "debug" ;; + *) echo "$1" ;; + esac +} +log_debug() { + log_priority 7 || return 0 + echoerr "$(log_prefix)" "$(log_tag 7)" "$@" +} +log_info() { + log_priority 6 || return 0 + echoerr "$(log_prefix)" "$(log_tag 6)" "$@" +} +log_err() { + log_priority 3 || return 0 + echoerr "$(log_prefix)" "$(log_tag 3)" "$@" +} +log_crit() { + log_priority 2 || return 0 + echoerr "$(log_prefix)" "$(log_tag 2)" "$@" +} +uname_os() { + os=$(uname -s | tr '[:upper:]' '[:lower:]') + case "$os" in + msys_nt) os="windows" ;; + esac + echo "$os" +} +uname_arch() { + arch=$(uname -m) + case $arch in + x86_64) arch="amd64" ;; + x86) arch="386" ;; + i686) arch="386" ;; + i386) arch="386" ;; + aarch64) arch="arm64" ;; + armv5*) arch="armv5" ;; + armv6*) arch="armv6" ;; + armv7*) arch="armv7" ;; + esac + echo ${arch} +} +uname_os_check() { + os=$(uname_os) + case "$os" in + darwin) return 0 ;; + dragonfly) return 0 ;; + freebsd) return 0 ;; + linux) return 0 ;; + android) return 0 ;; + nacl) return 0 ;; + netbsd) return 0 ;; + openbsd) return 0 ;; + plan9) return 0 ;; + solaris) return 0 ;; + windows) return 0 ;; + esac + log_crit "uname_os_check '$(uname -s)' got converted to '$os' which is not a GOOS value. Please file bug at https://github.com/client9/shlib" + return 1 +} +uname_arch_check() { + arch=$(uname_arch) + case "$arch" in + 386) return 0 ;; + amd64) return 0 ;; + arm64) return 0 ;; + armv5) return 0 ;; + armv6) return 0 ;; + armv7) return 0 ;; + ppc64) return 0 ;; + ppc64le) return 0 ;; + mips) return 0 ;; + mipsle) return 0 ;; + mips64) return 0 ;; + mips64le) return 0 ;; + s390x) return 0 ;; + amd64p32) return 0 ;; + esac + log_crit "uname_arch_check '$(uname -m)' got converted to '$arch' which is not a GOARCH value. Please file bug report at https://github.com/client9/shlib" + return 1 +} +untar() { + tarball=$1 + case "${tarball}" in + *.tar.gz | *.tgz) tar -xzf "${tarball}" ;; + *.tar) tar -xf "${tarball}" ;; + *.zip) unzip "${tarball}" ;; + *) + log_err "untar unknown archive format for ${tarball}" + return 1 + ;; + esac +} +http_download_curl() { + local_file=$1 + source_url=$2 + header=$3 + if [ -z "$header" ]; then + code=$(curl -w '%{http_code}' -sL -o "$local_file" "$source_url") + else + code=$(curl -w '%{http_code}' -sL -H "$header" -o "$local_file" "$source_url") + fi + if [ "$code" != "200" ]; then + log_debug "http_download_curl received HTTP status $code" + return 1 + fi + return 0 +} +http_download_wget() { + local_file=$1 + source_url=$2 + header=$3 + if [ -z "$header" ]; then + wget -q -O "$local_file" "$source_url" + else + wget -q --header "$header" -O "$local_file" "$source_url" + fi +} +http_download() { + log_debug "http_download $2" + if is_command curl; then + http_download_curl "$@" + return + elif is_command wget; then + http_download_wget "$@" + return + fi + log_crit "http_download unable to find wget or curl" + return 1 +} +http_copy() { + tmp=$(mktemp) + http_download "${tmp}" "$1" "$2" || return 1 + body=$(cat "$tmp") + rm -f "${tmp}" + echo "$body" +} +github_release() { + owner_repo=$1 + version=$2 + test -z "$version" && version="latest" + giturl="https://github.com/${owner_repo}/releases/${version}" + json=$(http_copy "$giturl" "Accept:application/json") + test -z "$json" && return 1 + version=$(echo "$json" | tr -s '\n' ' ' | sed 's/.*"tag_name":"//' | sed 's/".*//') + test -z "$version" && return 1 + echo "$version" +} +hash_sha256() { + TARGET=${1:-/dev/stdin} + if is_command gsha256sum; then + hash=$(gsha256sum "$TARGET") || return 1 + echo "$hash" | cut -d ' ' -f 1 + elif is_command sha256sum; then + hash=$(sha256sum "$TARGET") || return 1 + echo "$hash" | cut -d ' ' -f 1 + elif is_command shasum; then + hash=$(shasum -a 256 "$TARGET" 2>/dev/null) || return 1 + echo "$hash" | cut -d ' ' -f 1 + elif is_command openssl; then + hash=$(openssl -dst openssl dgst -sha256 "$TARGET") || return 1 + echo "$hash" | cut -d ' ' -f a + else + log_crit "hash_sha256 unable to find command to compute sha-256 hash" + return 1 + fi +} +hash_sha256_verify() { + TARGET=$1 + checksums=$2 + if [ -z "$checksums" ]; then + log_err "hash_sha256_verify checksum file not specified in arg2" + return 1 + fi + BASENAME=${TARGET##*/} + want=$(grep "${BASENAME}" "${checksums}" 2>/dev/null | tr '\t' ' ' | cut -d ' ' -f 1) + if [ -z "$want" ]; then + log_err "hash_sha256_verify unable to find checksum for '${TARGET}' in '${checksums}'" + return 1 + fi + got=$(hash_sha256 "$TARGET") + if [ "$want" != "$got" ]; then + log_err "hash_sha256_verify checksum for '$TARGET' did not verify ${want} vs $got" + return 1 + fi +} +cat /dev/null < Date: Fri, 10 May 2019 17:38:40 -0400 Subject: [PATCH 03/14] [skyapi] refs #18 Added Documentation for lib/curl library --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 8d87b9c07..649f10599 100644 --- a/README.md +++ b/README.md @@ -110,3 +110,9 @@ 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`). + +### Lib Curl, a Wrapper for Skycoin Api + +This wrapper is Auto generated by openapi-generator directly from `Skycoin Api` code for version v0.25.1. + +For further details of usage of `Lib Curl wrapper for Skycoin Api` see [Autogenerated documentation](./lib/curl/README.md) From d3dfd197558b802d1ad8677888e8a6ac93f6d8db Mon Sep 17 00:00:00 2001 From: Olemis Lang Date: Mon, 13 May 2019 23:16:12 -0400 Subject: [PATCH 04/14] [ci] refs #18 - Fix empty output of go env GOPAH while running make install-linters --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 89cd4ee17..75a469cea 100644 --- a/Makefile +++ b/Makefile @@ -150,7 +150,7 @@ install-deps-Darwin: ## Install deps on Mac OSX install-linters: install-linters-$(UNAME_S) ## Install linters go get -u github.com/FiloSottile/vendorcheck - cat ./ci-scripts/install-golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.10.2 + cat ./ci-scripts/install-golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.10.2 install-deps-libc: install-deps-libc-$(OSNAME) From 2c947810e87094a0d803820a5a12298640c7709a Mon Sep 17 00:00:00 2001 From: Olemis Lang Date: Tue, 14 May 2019 00:58:23 -0400 Subject: [PATCH 05/14] [ci] refs #18 - Deploy to Github releases --- .travis.yml | 45 +++++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6fa08526f..0595bc485 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,7 @@ services: - docker language: go go: - - "1.11.x" - + - 1.11.x matrix: include: - os: linux @@ -119,35 +118,53 @@ matrix: # - QEMU_OS=fedora - os: osx osx_image: xcode8.3 - before_install: - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && sudo apt-get update -qq; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && sudo apt-get update -qq; + fi - ./ci-scripts/install-travis-gcc.sh - eval "CC=gcc-6 && CXX=g++-6" - env: global: - BUILD_DIR: build - - BUILDLIB_DIR: $BUILD_DIR/libskycoin + - 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/ - - + - PATH_DIR: "$GOPATH/src/github.com/skycoin/libskycoin/" install: - # Install gox - 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 + VERSION=1.10.2 ./ci-scripts/install-golangci-lint.sh ; + fi - if [[ -z "$QEMU_PLATFORM" ]]; then make install-deps-libc ; fi - script: - 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 - + - if [[ "$QEMU_PLATFORM" ]]; then + docker build --build-arg QEMU_PLATFORM --build-arg QEMU_OS --file docker/images/test-arm/Dockerfile . -t skydev-test ; + fi +before_deploy: + - export VERSION="$(git describe --tags --exact-match HEAD 2> /dev/null)" + - export ARCH="$(uname -m)" + - export OS="$(uname -s)" + - make build-libc + - tar -c -z -f libskycoin-${VERSION}-${OS}-${ARCH}.tar.gz -C build ./* +deploy: + - provider: releases + api_key: + secure: ZqagrrwPFXs4bgHV9lJkZaex6dxAEUJprSdhsqJLYTkF4uBN5VYNM4KCy+azBabV8pVLxiCCZ8G/ocRw+omQgzJ/1lymNtYez8C/SLAuKzOFxdTxkvyQ9pW5Xr+fjptTEpe/E/lRYvS6LFtQEEpbrtjW/km9HWc7EdMNxUaGhBCRun0YhK3a7JSpQE7JbsyR691Zco8hLb2b5PO8qYx5NoVWHKPMLMYUZhbSZbWs0Viu8s8t9VLVhrSIudAKnQiNs5viWp0YZy6U6mRMuBeZ7wazebx0d/BAj78f+atGOZIiJbHgOxupnhhgR10X7b5B89JggxVe3IFr5t96qz3VV4aTl1yuLZ3i8eYanMIvdirnpPU36bbfAVMJuG7L4hFmZ+pD22ZmiOI4COqHDxSd0gF8DUri+Cf9S+5RF5Kk3YBArQzdue6DjNPBtKyQja1xINfj3Go2LQnaKH+/ffzBJIlw9TICcqf241FS3bNtx0QvUDV/+ezqy0dcD7xKOoUQmLDhyWt5NltNKu/JjoCwj99B9P45GQHJCrSvMu71hwNYlTJxtTJuLIVRXqI5BUEGpnBK99MV+6nycl0ePla4zXTBbJ/uOFzwfj1njAdw2DT4ceTsvtkTAc9qEi3S1hrRL2z3mHQ4loZCTJ9Nn9Cx0WOgfs/bCDvExa7b+AJ3ScE= + file: + - libskycoin-${VERSION}-${OS}-${ARCH}.tar.gz + skip_cleanup: true + draft: true + overwrite: true + on: + repo: skycoin/hardware-wallet + tags: true notifications: email: false webhooks: https://fathomless-fjord-24024.herokuapp.com/notify + From 4c8ef5544a4b42a5172fe05cd996ea2ff22c1d82 Mon Sep 17 00:00:00 2001 From: Olemis Lang Date: Tue, 14 May 2019 01:53:56 -0400 Subject: [PATCH 06/14] [ci] refs #18 - chmod a+x ci-scripts/install-golangci-lint.sh --- ci-scripts/install-golangci-lint.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 ci-scripts/install-golangci-lint.sh diff --git a/ci-scripts/install-golangci-lint.sh b/ci-scripts/install-golangci-lint.sh old mode 100644 new mode 100755 From 6f511cb248a9cdd0e1c7e7a50c21cb63c3ecd9c3 Mon Sep 17 00:00:00 2001 From: Maykel Arias Torres Date: Wed, 15 May 2019 01:23:14 -0400 Subject: [PATCH 07/14] [travis] refs #18 Adding that when the QEMU is defined, it is compiled according to the defined version --- .travis.yml | 5 ++++- ci-scripts/build.sh | 2 ++ docker/images/test-arm/Dockerfile | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 ci-scripts/build.sh diff --git a/.travis.yml b/.travis.yml index ee26e7013..52cc8b83e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -152,7 +152,10 @@ before_deploy: - export VERSION="$(git describe --tags --exact-match HEAD 2> /dev/null)" - export ARCH="$(uname -m)" - export OS="$(uname -s)" - - make build-libc + - if [[ "$QEMU_PLATFORM" ]]; then + docker run -v $PWD:/go/src/github.com/skycoin/libskycoin ./ci-scripts/build.sh ; + if + - if [[ -z "$QEMU_PLATFORM" ]]; then make build-libc ; if - tar -c -z -f libskycoin-${VERSION}-${OS}-${ARCH}.tar.gz -C build ./* deploy: - provider: releases diff --git a/ci-scripts/build.sh b/ci-scripts/build.sh new file mode 100644 index 000000000..2ad83cf0a --- /dev/null +++ b/ci-scripts/build.sh @@ -0,0 +1,2 @@ +echo "Init" +make -C $GOPATH/src/github.com/skycoin/libskycoin build-libc \ No newline at end of file diff --git a/docker/images/test-arm/Dockerfile b/docker/images/test-arm/Dockerfile index 74bfb7197..8578f4de4 100644 --- a/docker/images/test-arm/Dockerfile +++ b/docker/images/test-arm/Dockerfile @@ -19,4 +19,5 @@ RUN make -C $GOPATH/src/github.com/skycoin/libskycoin test-libc RUN [ "cross-build-end" ] -WORKDIR $GOPATH/src +WORKDIR $GOPATH/src/github.com/skycoin +VOLUME $GOPATH/src/ From c7a19f94b9ad1101210d504f32ed609beb3e5f67 Mon Sep 17 00:00:00 2001 From: Maykel Arias Torres Date: Wed, 15 May 2019 13:19:37 -0400 Subject: [PATCH 08/14] [travis] refs #18 Reviewed all matrices and adding in install to test if the deploy works. --- .travis.yml | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 52cc8b83e..bb3c7c5f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,20 +7,20 @@ go: matrix: include: - - os: linux - dist: xenial + # - os: linux + # dist: xenial - 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=orangepi-plus2 + # - QEMU_OS=debian + # - os: linux + # env: + # - QEMU_PLATFORM=orangepi-plus2 + # - QEMU_OS=fedora # - os: linux # env: # - QEMU_PLATFORM=raspberry-pi2 @@ -33,18 +33,18 @@ matrix: # 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=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 @@ -148,12 +148,15 @@ script: - if [[ "$QEMU_PLATFORM" ]]; then docker build --build-arg QEMU_PLATFORM --build-arg QEMU_OS --file docker/images/test-arm/Dockerfile . -t skydev-test ; fi + - if [[ "$QEMU_PLATFORM" ]]; then + docker run skydev-test -v $PWD:/go/src/github.com/skycoin/libskycoin ci-scripts/build.sh; + if before_deploy: - export VERSION="$(git describe --tags --exact-match HEAD 2> /dev/null)" - export ARCH="$(uname -m)" - export OS="$(uname -s)" - if [[ "$QEMU_PLATFORM" ]]; then - docker run -v $PWD:/go/src/github.com/skycoin/libskycoin ./ci-scripts/build.sh ; + docker run skydev-test -v $PWD:/go/src/github.com/skycoin/libskycoin ci-scripts/build.sh; if - if [[ -z "$QEMU_PLATFORM" ]]; then make build-libc ; if - tar -c -z -f libskycoin-${VERSION}-${OS}-${ARCH}.tar.gz -C build ./* From f34e8c4ab80326d10e2fe28ed6bb46adc5b11dd5 Mon Sep 17 00:00:00 2001 From: Maykel Arias Torres Date: Wed, 15 May 2019 16:26:08 -0400 Subject: [PATCH 09/14] [travis] refs #18 Discomment OSX --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index bb3c7c5f1..0dacc6899 100644 --- a/.travis.yml +++ b/.travis.yml @@ -117,8 +117,8 @@ matrix: # env: # - QEMU_PLATFORM=odroid-xu4 # - QEMU_OS=fedora - - os: osx - osx_image: xcode8.3 + # - os: osx + # osx_image: xcode8.3 before_install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && sudo apt-get update -qq; @@ -149,7 +149,7 @@ script: docker build --build-arg QEMU_PLATFORM --build-arg QEMU_OS --file docker/images/test-arm/Dockerfile . -t skydev-test ; fi - if [[ "$QEMU_PLATFORM" ]]; then - docker run skydev-test -v $PWD:/go/src/github.com/skycoin/libskycoin ci-scripts/build.sh; + docker run skydev-test ci-scripts/build.sh; if before_deploy: - export VERSION="$(git describe --tags --exact-match HEAD 2> /dev/null)" From deda78beb1fc50d398cf51dc80d30796016382ba Mon Sep 17 00:00:00 2001 From: Olemis Lang Date: Sat, 18 May 2019 17:37:45 -0400 Subject: [PATCH 10/14] [ci] refs #18 - Ensure package index is up-to-date before installing clang-format --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index faee1e1f2..9d2e309eb 100644 --- a/Makefile +++ b/Makefile @@ -136,6 +136,7 @@ lint-libc: format-libc check: lint test-libc lint-libc ## Run tests and linters install-linters-Linux: ## Install linters on GNU/Linux + sudo apt-get update sudo apt-get install $(PKG_CLANG_FORMAT) sudo apt-get install $(PKG_CLANG_LINTER) From b975601c3c25e92461cc142a19763b52d9154879 Mon Sep 17 00:00:00 2001 From: Olemis Lang Date: Sat, 18 May 2019 18:29:01 -0400 Subject: [PATCH 11/14] [ci] refs #18 - Restore build matrix. Install cmake from PPA on Linux --- .travis.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4c94aa0ad..b813a59eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,10 @@ language: go go: matrix: include: - # - os: linux - # dist: xenial - # - os: osx - # osx_image: xcode8.3 + - os: linux + dist: xenial + - os: osx + osx_image: xcode8.3 before_install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && sudo apt-get update -qq; @@ -24,12 +24,13 @@ env: - VERSION_UPGRADE_TEST_WAIT_TIMEOUT: 60s - PATH_DIR: "$GOPATH/src/github.com/skycoin/libskycoin/" install: - # Install gox + # 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 - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then DEPS_DIR="${TRAVIS_BUILD_DIR}/deps" && mkdir ${DEPS_DIR} && cd ${DEPS_DIR} && travis_retry wget --no-check-certificate https://cmake.org/files/v3.3/cmake-3.3.2-Linux-x86_64.tar.gz && echo "f3546812c11ce7f5d64dc132a566b749 *cmake-3.3.2-Linux-x86_64.tar.gz" > cmake_md5.txt && md5sum -c cmake_md5.txt && tar -xvf cmake-3.3.2-Linux-x86_64.tar.gz > /dev/null && mv cmake-3.3.2-Linux-x86_64 cmake-install && PATH=${DEPS_DIR}/cmake-install:${DEPS_DIR}/cmake-install/bin:$PATH && cd ${TRAVIS_BUILD_DIR}; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + sudo apt-get install cmake ; + fi - make install-deps-libc - make install-lib-curl script: From c92887efe908afad04b681c6fddfd6310e5e19fa Mon Sep 17 00:00:00 2001 From: Olemis Lang Date: Sat, 18 May 2019 21:28:16 -0400 Subject: [PATCH 12/14] refs #18 - Skycoin REST API docs in README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9e57aa5c4..ad896ac0a 100644 --- a/README.md +++ b/README.md @@ -113,11 +113,11 @@ 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`). -### Lib Curl, a Wrapper for Skycoin Api +### SkyApi libcurl client for Skycoin REST API -This wrapper is Auto generated by openapi-generator directly from `Skycoin Api` code for version v0.25.1. +This wrapper is auto-generated by `openapi-generator` directly from [Skycoin REST API code](https://github.com/skycoin/skycoin/tree/master/src/api). -For further details of usage of `Lib Curl wrapper for Skycoin Api` see [Autogenerated documentation](./lib/curl/README.md) +For further instructions see [Autogenerated documentation](./lib/curl/README.md). ### Doxygen comment syntax From 5f477bbce9afd78253bb53b73fb048d6373aed7b Mon Sep 17 00:00:00 2001 From: Olemis Lang Date: Sat, 18 May 2019 21:54:38 -0400 Subject: [PATCH 13/14] Implement make build --- .travis.yml | 7 +------ Makefile | 11 +++++------ README.md | 5 +++++ 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index b813a59eb..53ec7d431 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,16 +35,11 @@ install: - make install-lib-curl script: - make check - - if [[ "$QEMU_PLATFORM" ]]; then - docker run skydev-test ci-scripts/build.sh; - if before_deploy: - export VERSION="$(git describe --tags --exact-match HEAD 2> /dev/null)" - export ARCH="$(uname -m)" - export OS="$(uname -s)" - - if [[ "$QEMU_PLATFORM" ]]; then - docker run skydev-test -v $PWD:/go/src/github.com/skycoin/libskycoin ci-scripts/build.sh; - if + - make build - if [[ -z "$QEMU_PLATFORM" ]]; then make build-libc ; if - tar -c -z -f libskycoin-${VERSION}-${OS}-${ARCH}.tar.gz -C build ./* deploy: diff --git a/Makefile b/Makefile index 2c296b059..7299c007f 100644 --- a/Makefile +++ b/Makefile @@ -93,14 +93,13 @@ $(BUILDLIB_DIR)/libskycoin.a: $(LIB_FILES) $(SRC_FILES) $(HEADER_FILES) go build -buildmode=c-archive -o $(BUILDLIB_DIR)/libskycoin.a $(LIB_FILES) mv $(BUILDLIB_DIR)/libskycoin.h $(INCLUDE_DIR)/ -## Build libskycoin C static library -build-libc-static: $(BUILDLIB_DIR)/libskycoin.a +build-libc-static: $(BUILDLIB_DIR)/libskycoin.a ## Build libskycoin C static library -## Build libskycoin C shared library -build-libc-shared: $(BUILDLIB_DIR)/libskycoin.so +build-libc-shared: $(BUILDLIB_DIR)/libskycoin.so ## Build libskycoin C shared library -## Build libskycoin C client libraries -build-libc: configure-build build-libc-static build-libc-shared +build-libc: configure-build build-libc-static build-libc-shared ## Build libskycoin C client libraries + +build: build-libc ## Build all C libraries ## Build libskycoin C client library and executable C test suites ## with debug symbols. Use this target to debug the source code diff --git a/README.md b/README.md index ad896ac0a..e3f5c4bb4 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,10 @@ After that, run `make docs` for a new docs generation. You can found the api doc |Target |Help| | :------------- | :----------: | +|build-libc-static |Build libskycoin C static library| +|build-libc-shared |Build libskycoin C shared library| +|build-libc |Build libskycoin C client libraries| +|build |Build all C libraries |test-libc |Run tests for libskycoin C client library| |docs |Generate documentation for all libraries| |docs-libc |Generate libskycoin documentation| @@ -163,3 +167,4 @@ After that, run `make docs` for a new docs generation. You can found the api doc |install-deps-libc-osx |Install locally dependencies for testing libskycoin| |format |Formats the code. Must have goimports installed (use make install-linters).| |clean-libc |Clean files generate by library| + From 4b803d33803ec46ddbf214616ecc1ff6a162050d Mon Sep 17 00:00:00 2001 From: Olemis Lang Date: Sat, 18 May 2019 21:56:45 -0400 Subject: [PATCH 14/14] [ci] refs #18 - Remove condition depending on legacy QEMU_PLATFORM var set --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 53ec7d431..724fef9fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,6 @@ before_deploy: - export ARCH="$(uname -m)" - export OS="$(uname -s)" - make build - - if [[ -z "$QEMU_PLATFORM" ]]; then make build-libc ; if - tar -c -z -f libskycoin-${VERSION}-${OS}-${ARCH}.tar.gz -C build ./* deploy: - provider: releases