Skip to content

Commit

Permalink
add circleci, release
Browse files Browse the repository at this point in the history
  • Loading branch information
theganyo committed Mar 20, 2020
1 parent ee635d8 commit d0993b6
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 2 deletions.
93 changes: 93 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
version: 2 # use CircleCI 2.0

jobs:

build:

docker:
# CircleCI Go images available at: https://hub.docker.com/r/circleci/golang/
- image: circleci/golang:1.14

environment: # environment variables for the build itself
TEST_RESULTS: /tmp/test-results # path to where test results will be saved

steps: # steps that comprise the `build` job
- checkout # check out source code to working directory
- run: mkdir -p ${TEST_RESULTS} # create the test results directory
- restore_cache: # restores saved cache if no changes are detected since last run
keys:
- go-mod-v4-{{ checksum "go.sum" }}

- run:
name: Run unit tests
command: go test -coverprofile=coverage.txt ./...; cp coverage.txt ${TEST_RESULTS}

- run:
name: Upload codecov
command: bash <(curl -s https://codecov.io/bash)

- save_cache:
key: go-mod-v4-{{ checksum "go.sum" }}
paths:
- "/go/pkg/mod"

- store_artifacts: # upload test summary for display in Artifacts
path: /tmp/test-results
destination: raw-test-output

- store_test_results: # upload test results for display in Test Summary
path: /tmp/test-results

release:

docker:
- image: circleci/golang:1.14

steps:
- checkout
- restore_cache: # restores saved cache if no changes are detected since last run
keys:
- go-mod-v4-{{ checksum "go.sum" }}

- run:
name: Set GoReleaser Version
command: |
echo "export VERSION=v0.128.0" >> $BASH_ENV
- run:
name: "Run GoReleaser"
command: curl -sL https://git.io/goreleaser | bash

build-dist:

docker:
- image: circleci/golang:1.14

steps:
- checkout
- restore_cache: # restores saved cache if no changes are detected since last run
keys:
- go-mod-v4-{{ checksum "go.sum" }}

- run:
name: Set GoReleaser Version
command: |
echo "export VERSION=v0.128.0" >> $BASH_ENV
- run:
name: "Run GoReleaser"
command: curl -sL https://git.io/goreleaser | bash -s -- --snapshot --skip-publish --rm-dist

workflows:
version: 2
build-and-release:
jobs:
- build
- release:
requires:
- build
filters: # Only run on git tag pushes
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
2 changes: 0 additions & 2 deletions .goreleaser → .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ archives:
files:
- LICENSE
- README.md
- samples/**/*
- install/**/*
release:
draft: true
prerelease: true

0 comments on commit d0993b6

Please sign in to comment.