summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony HAMON <anthony.hamon@iadvize.com>2018-08-18 09:27:47 +0200
committerAnthony HAMON <anthony.hamon@iadvize.com>2018-08-19 20:21:14 +0200
commitfbfa48f0fcd2b537c98daa79352a0e224a480937 (patch)
treea8679efe887410e826f89c760e4a622409cfc158
parent81b07daa01244b7f0326adeba2a5429516f2d85d (diff)
update circleci
* define release worflow when a tag is created * add dep install * run tests with coverage * add goreleaser
-rw-r--r--.circleci/config.yml49
-rw-r--r--.gitignore3
-rwxr-xr-xtest.sh14
3 files changed, 49 insertions, 17 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index c5f520b70..939adc60e 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,26 +1,43 @@
-# Golang CircleCI 2.0 configuration file
-#
-# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2
jobs:
build:
docker:
- # specify the version
- - image: circleci/golang:1.9
+ - image: circleci/golang:1.10
- # Specify service dependencies here if necessary
- # CircleCI maintains a library of pre-built images
- # documented at https://circleci.com/docs/2.0/circleci-images/
- # - image: circleci/postgres:9.4
+ working_directory: /go/src/github.com/jesseduffield/lazygit
+ steps:
+ - checkout
+ - run:
+ name: Run tests
+ command: |
+ ./test.sh
+ - run:
+ name: Push on codecov result
+ command: |
+ bash <(curl -s https://codecov.io/bash)
- #### TEMPLATE_NOTE: go expects specific checkout path representing url
- #### expecting it in the form of
- #### /go/src/github.com/circleci/go-tool
- #### /go/src/bitbucket.org/circleci/go-tool
+ release:
+ docker:
+ - image: circleci/golang:1.10
working_directory: /go/src/github.com/jesseduffield/lazygit
steps:
- checkout
+ - run:
+ name: Run gorelease
+ command: |
+ curl -sL https://git.io/goreleaser | bash
- # specify any bash command here prefixed with `run: `
- - run: go test -v ./...
- - run: bash <(curl -s https://codecov.io/bash)
+workflows:
+ version: 2
+ build:
+ jobs:
+ - build
+ release:
+ jobs:
+ - release:
+ context: org-global
+ filters:
+ tags:
+ only: /v[0-9]+(\.[0-9]+)*/
+ branches:
+ ignore: /.*/
diff --git a/.gitignore b/.gitignore
index 304a2356f..f759e8a06 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,7 @@ TODO.md
# Tests
test/repos/repo
+coverage.txt
# Binaries
-lazygit \ No newline at end of file
+lazygit
diff --git a/test.sh b/test.sh
new file mode 100755
index 000000000..a92243cf7
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+
+set -e
+echo "" > coverage.txt
+
+for d in $( find ./* -maxdepth 10 ! -path "./vendor*" ! -path "./.git*" -type d); do
+ if ls $d/*.go &> /dev/null; then
+ go test -v -race -coverprofile=profile.out -covermode=atomic $d
+ if [ -f profile.out ]; then
+ cat profile.out >> coverage.txt
+ rm profile.out
+ fi
+ fi
+done