diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4de9114 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,57 @@ +name: ci + +on: + push: + branches: + - '**' + tags-ignore: + - '*.*' + pull_request: + +env: + DEVELOPER_NODE: 1 + RETAILCRM_URL: https://test.retailcrm.pro + RETAILCRM_KEY: key + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + strategy: + matrix: + go-version: ['1.8', '1.9', '1.10', '1.11', '1.12', '1.13'] + include: + - go-version: '1.14' + coverage: 1 + steps: + - name: Set up Go ${{ matrix.go-version }} + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + - name: Get dependencies + run: | + go get -v github.com/google/go-querystring/query + go get -v github.com/h2non/gock + go get -v github.com/joho/godotenv + go get -v github.com/retailcrm/api-client-go/errs + cp .env.dist .env + - name: Tests + env: + COVERAGE: ${{ matrix.coverage }} + if: env.COVERAGE != 1 + run: go test ./... + - name: Tests with coverage + env: + COVERAGE: ${{ matrix.coverage }} + if: env.COVERAGE == 1 + run: | + go test ./... -race -coverprofile=coverage.txt -covermode=atomic "$d" + - name: Coverage + env: + COVERAGE: ${{ matrix.coverage }} + if: env.COVERAGE == 1 + run: | + bash <(curl -s https://codecov.io/bash) + rm coverage.txt diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 62acb07..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: go -go: - - '1.8' - - '1.9' - - '1.10' - - '1.11' - - '1.12' - - '1.13' -before_install: - - go get -v github.com/google/go-querystring/query - - go get -v github.com/h2non/gock - - cp .env.dist .env -script: ./go.test.sh -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index ee44de2..ae6ba39 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -[![Build Status](https://img.shields.io/travis/retailcrm/api-client-go/master.svg?style=flat-square)](https://travis-ci.org/retailcrm/api-client-go) -[![Covarage](https://img.shields.io/codecov/c/gh/retailcrm/api-client-go/master.svg?style=flat-square)](https://codecov.io/gh/retailcrm/api-client-go) -[![GitHub release](https://img.shields.io/github/release/retailcrm/api-client-go.svg?style=flat-square)](https://github.com/retailcrm/api-client-go/releases) -[![GoLang version](https://img.shields.io/badge/go->=1.8-blue?style=flat-square)](https://golang.org/dl/) -[![Godoc reference](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/retailcrm/api-client-go) +[![Build Status](https://github.com/retailcrm/api-client-go/workflows/ci/badge.svg)](https://github.com/retailcrm/api-client-go/actions) +[![Covarage](https://img.shields.io/codecov/c/gh/retailcrm/api-client-go/master.svg?logo=codecov)](https://codecov.io/gh/retailcrm/api-client-go) +[![GitHub release](https://img.shields.io/github/release/retailcrm/api-client-go.svg)](https://github.com/retailcrm/api-client-go/releases) +[![GoLang version](https://img.shields.io/badge/go->=1.8-blue)](https://golang.org/dl/) +[![Godoc reference](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/retailcrm/api-client-go) # retailCRM API Go client diff --git a/go.test.sh b/go.test.sh deleted file mode 100755 index d153907..0000000 --- a/go.test.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -set -e -export DEVELOPER_NODE=1 -export RETAILCRM_URL=https://test.retailcrm.pro -export RETAILCRM_KEY=key -echo "" > coverage.txt - -for d in $(go list ./... | grep -v vendor); do - go test -race -coverprofile=profile.out -covermode=atomic "$d" - if [ -f profile.out ]; then - cat profile.out >> coverage.txt - rm profile.out - fi -done \ No newline at end of file