Skip to content

Commit f3eb871

Browse files
authored
Merge pull request #214 from hashicorp/add-circle-config
convert from Travis CI to Circle CI
2 parents cb8f972 + 9240d6e commit f3eb871

File tree

5 files changed

+66
-28
lines changed

5 files changed

+66
-28
lines changed

.circleci/config.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
version: 2.1
2+
3+
references:
4+
images:
5+
go: &GOLANG_IMAGE circleci/golang:latest
6+
environments:
7+
tmp: &TEST_RESULTS_PATH /tmp/test-results # path to where test results are saved
8+
9+
# reusable 'executor' object for jobs
10+
executors:
11+
go:
12+
docker:
13+
- image: *GOLANG_IMAGE
14+
environment:
15+
- TEST_RESULTS: *TEST_RESULTS_PATH
16+
17+
jobs:
18+
go-fmt-and-test:
19+
executor: go
20+
steps:
21+
- checkout
22+
- run: mkdir -p $TEST_RESULTS
23+
24+
# Restore go module cache if there is one
25+
- restore_cache:
26+
keys:
27+
- go-getter-modcache-v1-{{ checksum "go.mod" }}
28+
29+
# Save go module cache if the go.mod file has changed
30+
- save_cache:
31+
key: go-getter-modcache-v1-{{ checksum "go.mod" }}
32+
paths:
33+
- "/go/pkg/mod"
34+
35+
# check go fmt output because it does not report non-zero when there are fmt changes
36+
- run:
37+
name: check go fmt
38+
command: |
39+
files=$(go fmt ./...)
40+
if [ -n "$files" ]; then
41+
echo "The following file(s) do not conform to go fmt:"
42+
echo "$files"
43+
exit 1
44+
fi
45+
46+
# run go tests with gotestsum
47+
- run: |
48+
PACKAGE_NAMES=$(go list ./...)
49+
gotestsum --format=short-verbose --junitfile $TEST_RESULTS/gotestsum-report.xml -- $PACKAGE_NAMES
50+
- store_test_results:
51+
path: *TEST_RESULTS_PATH
52+
- store_artifacts:
53+
path: *TEST_RESULTS_PATH
54+
55+
workflows:
56+
version: 2
57+
test-and-build:
58+
jobs:
59+
- go-fmt-and-test

.travis.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# go-getter
22

3-
[![Build Status](http://img.shields.io/travis/hashicorp/go-getter.svg?style=flat-square)][travis]
3+
[![CircleCI](https://circleci.com/gh/hashicorp/go-getter/tree/master.svg?style=svg)][circleci]
44
[![Build status](https://ci.appveyor.com/api/projects/status/ulq3qr43n62croyq/branch/master?svg=true)][appveyor]
55
[![Go Documentation](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)][godocs]
66

7-
[travis]: http://travis-ci.org/hashicorp/go-getter
7+
[circleci]: https://circleci.com/gh/hashicorp/go-getter/tree/master
88
[godocs]: http://godoc.org/github.com/hashicorp/go-getter
99
[appveyor]: https://ci.appveyor.com/project/hashicorp/go-getter/branch/master
1010

@@ -356,3 +356,7 @@ In order to access to GCS, authentication credentials should be provided. More i
356356
- gcs::https://www.googleapis.com/storage/v1/bucket
357357
- gcs::https://www.googleapis.com/storage/v1/bucket/foo.zip
358358
- www.googleapis.com/storage/v1/bucket/foo
359+
360+
#### GCS Testing
361+
362+
The tests for `get_gcs.go` require you to have GCP credentials set in your environment. These credentials can have any level of permissions to any project, they just need to exist. This means setting `GOOGLE_APPLICATION_CREDENTIALS="~/path/to/credentials.json"` or `GOOGLE_CREDENTIALS="{stringified-credentials-json}"`. Due to this configuration, `get_gcs_test.go` will fail for external contributors in CircleCI.

client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
// Using a client directly allows more fine-grained control over how downloading
2020
// is done, as well as customizing the protocols supported.
2121
type Client struct {
22-
// Ctx for cancellation
22+
// Ctx for cancellation
2323
Ctx context.Context
2424

2525
// Src is the source URL to get.

get_git_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,6 @@ func TestGitGetter_sshExplicitPort(t *testing.T) {
418418
}
419419
}
420420

421-
422421
func TestGitGetter_sshSCPStyleInvalidScheme(t *testing.T) {
423422
if !testHasGit {
424423
t.Skip("git not found, skipping")

0 commit comments

Comments
 (0)