Skip to content

Commit 1b7cbff

Browse files
harsimranmaansbarzowski
authored andcommitted
Add github actions ci
1 parent ba5dc76 commit 1b7cbff

13 files changed

+163
-95
lines changed

.github/workflows/ci.yml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: ci
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
push:
7+
branches:
8+
- master
9+
jobs:
10+
test:
11+
name: Test go${{ matrix.goVersion}}.x ${{ matrix.goArch }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
- goVersion: "1"
17+
GOARCH: "amd64"
18+
SKIP_PYTHON_BINDINGS_TESTS: "0"
19+
# - goVersion: "1"
20+
# GOARCH: "arm64"
21+
# SKIP_PYTHON_BINDINGS_TESTS: "0"
22+
# - goVersion: "1"
23+
# GOARCH: "386"
24+
# SKIP_PYTHON_BINDINGS_TESTS: "1"
25+
# - goVersion: "1"
26+
# GOARCH: "ppc64le"
27+
# SKIP_PYTHON_BINDINGS_TESTS: "0"
28+
- goVersion: "1.11"
29+
GOARCH: "amd64"
30+
SKIP_PYTHON_BINDINGS_TESTS: "0"
31+
- goVersion: "1.12"
32+
GOARCH: "amd64"
33+
SKIP_PYTHON_BINDINGS_TESTS: "0"
34+
- goVersion: "1.13"
35+
GOARCH: "amd64"
36+
SKIP_PYTHON_BINDINGS_TESTS: "0"
37+
- goVersion: "1.14"
38+
GOARCH: "amd64"
39+
SKIP_PYTHON_BINDINGS_TESTS: "0"
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v2
43+
- uses: actions/setup-go@v2
44+
with:
45+
go-version: ${{ matrix.goVersion }}
46+
- run: sudo apt install python3-dev python3-setuptools
47+
- run: pip install -U wheel
48+
- run: pip install -U pytest setuptools
49+
- run: make install.dependencies
50+
- run: make test
51+
env:
52+
GOARCH: ${{ matrix.GOARCH }}
53+
CGO_ENABLED: "1"
54+
SKIP_PYTHON_BINDINGS_TESTS: ${{ matrix.SKIP_PYTHON_BINDINGS_TESTS }}
55+
56+
all:
57+
name: Check all
58+
runs-on: ubuntu-latest
59+
steps:
60+
- uses: actions/checkout@v2
61+
- run: sudo apt install python3-dev python3-setuptools
62+
- run: pip install -U wheel
63+
- run: pip install -U pytest setuptools
64+
# - uses: golangci/golangci-lint-action@v2
65+
# with:
66+
# version: v1.30.0
67+
- run: make all
68+
- name: Install goveralls
69+
env:
70+
GO111MODULE: off
71+
run: |
72+
export GOPATH=$GITHUB_WORKSPACE
73+
go get github.com/mattn/goveralls
74+
- name: Send coverage
75+
env:
76+
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
run: ./bin/goveralls -coverprofile=coverage.out -service=github
78+
79+
goreleaser:
80+
name: Goreleaser
81+
runs-on: ubuntu-latest
82+
steps:
83+
- uses: actions/checkout@v2
84+
- uses: goreleaser/goreleaser-action@v2
85+
with:
86+
args: release --snapshot --skip-publish --rm-dist

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ gojsonnet.egg-info/
2828
/tests_path.source
2929

3030
/jsonnet-lint
31-
31+
/jsonnet-deps
3232
/builtin-benchmark-results

.goreleaser.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ builds:
3636
- arm64
3737
ignore:
3838
- goos: darwin
39-
goarch: 386
39+
- goarch: 386
4040

4141
id: jsonnetfmt
4242
main: ./cmd/jsonnetfmt
@@ -50,7 +50,7 @@ archives:
5050
386: i386
5151
amd64: x86_64
5252
checksum:
53-
name_template: 'checksums.txt'
53+
name_template: "checksums.txt"
5454

5555
nfpms:
5656
- id: jsonnet

Makefile

-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ install.dependencies:
1010
git submodule update
1111
go get github.com/clipperhouse/gen
1212
go get github.com/clipperhouse/set
13-
go get github.com/fatih/color
14-
go get github.com/axw/gocov/gocov
15-
go get github.com/mattn/goveralls
16-
go get github.com/sergi/go-diff/diffmatchpatch
17-
if ! go get github.com/golang/tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi;
1813
.PHONY: install.dependencies
1914

2015
build.bazel:

WORKSPACE

-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
workspace(name = "google_jsonnet_go")
22

3-
load(
4-
"@bazel_tools//tools/build_defs/repo:http.bzl",
5-
"http_archive",
6-
)
73
load(
84
"@google_jsonnet_go//bazel:repositories.bzl",
95
"jsonnet_go_repositories",

bazel/deps.bzl

+33-31
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ load(
1111

1212
def jsonnet_go_dependencies():
1313
go_rules_dependencies()
14-
go_register_toolchains()
14+
go_register_toolchains(version = "host")
1515
gazelle_dependencies()
1616
go_repository(
1717
name = "com_github_davecgh_go_spew",
@@ -22,20 +22,39 @@ def jsonnet_go_dependencies():
2222
go_repository(
2323
name = "com_github_fatih_color",
2424
importpath = "github.com/fatih/color",
25-
sum = "h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=",
26-
version = "v1.9.0",
25+
sum = "h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=",
26+
version = "v1.10.0",
27+
)
28+
29+
go_repository(
30+
name = "com_github_kr_pretty",
31+
importpath = "github.com/kr/pretty",
32+
sum = "h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=",
33+
version = "v0.1.0",
34+
)
35+
go_repository(
36+
name = "com_github_kr_pty",
37+
importpath = "github.com/kr/pty",
38+
sum = "h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=",
39+
version = "v1.1.1",
40+
)
41+
go_repository(
42+
name = "com_github_kr_text",
43+
importpath = "github.com/kr/text",
44+
sum = "h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=",
45+
version = "v0.1.0",
2746
)
2847
go_repository(
2948
name = "com_github_mattn_go_colorable",
3049
importpath = "github.com/mattn/go-colorable",
31-
sum = "h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=",
32-
version = "v0.1.4",
50+
sum = "h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=",
51+
version = "v0.1.8",
3352
)
3453
go_repository(
3554
name = "com_github_mattn_go_isatty",
3655
importpath = "github.com/mattn/go-isatty",
37-
sum = "h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM=",
38-
version = "v0.0.11",
56+
sum = "h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=",
57+
version = "v0.0.12",
3958
)
4059
go_repository(
4160
name = "com_github_pmezard_go_difflib",
@@ -61,30 +80,7 @@ def jsonnet_go_dependencies():
6180
sum = "h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=",
6281
version = "v1.4.0",
6382
)
64-
go_repository(
65-
name = "org_golang_x_sys",
66-
importpath = "golang.org/x/sys",
67-
sum = "h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=",
68-
version = "v0.0.0-20191026070338-33540a1f6037",
69-
)
70-
go_repository(
71-
name = "com_github_kr_pretty",
72-
importpath = "github.com/kr/pretty",
73-
sum = "h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=",
74-
version = "v0.1.0",
75-
)
76-
go_repository(
77-
name = "com_github_kr_pty",
78-
importpath = "github.com/kr/pty",
79-
sum = "h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=",
80-
version = "v1.1.1",
81-
)
82-
go_repository(
83-
name = "com_github_kr_text",
84-
importpath = "github.com/kr/text",
85-
sum = "h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=",
86-
version = "v0.1.0",
87-
)
83+
8884
go_repository(
8985
name = "in_gopkg_check_v1",
9086
importpath = "gopkg.in/check.v1",
@@ -97,3 +93,9 @@ def jsonnet_go_dependencies():
9793
sum = "h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=",
9894
version = "v2.2.4",
9995
)
96+
go_repository(
97+
name = "org_golang_x_sys",
98+
importpath = "golang.org/x/sys",
99+
sum = "h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=",
100+
version = "v0.0.0-20200223170610-d5e6a3e2c0ae",
101+
)

bazel/repositories.bzl

+14-23
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,25 @@ load(
33
"http_archive",
44
)
55

6-
def _maybe(repo_rule, name, **kwargs):
7-
"""Executes the given repository rule if it hasn't been executed already.
8-
Args:
9-
repo_rule: The repository rule to be executed (e.g.,
10-
`native.git_repository`.)
11-
name: The name of the repository to be defined by the rule.
12-
**kwargs: Additional arguments passed directly to the repository rule.
13-
"""
14-
if not native.existing_rule(name):
15-
repo_rule(name = name, **kwargs)
16-
176
def jsonnet_go_repositories():
18-
_maybe(
19-
http_archive,
7+
http_archive(
208
name = "io_bazel_rules_go",
21-
sha256 = "e6f8cb2da438cc4899809b66ba96d57397ed871640fe5c848ca9c56190b7c8ba",
22-
strip_prefix = "rules_go-8ea79bbd5e6ea09dc611c245d1dc09ef7ab7118a",
23-
urls = ["https://github.com/bazelbuild/rules_go/archive/8ea79bbd5e6ea09dc611c245d1dc09ef7ab7118a.zip"],
9+
sha256 = "7904dbecbaffd068651916dce77ff3437679f9d20e1a7956bff43826e7645fcc",
10+
urls = [
11+
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.25.1/rules_go-v0.25.1.tar.gz",
12+
"https://github.com/bazelbuild/rules_go/releases/download/v0.25.1/rules_go-v0.25.1.tar.gz",
13+
],
2414
)
25-
_maybe(
26-
http_archive,
15+
16+
http_archive(
2717
name = "bazel_gazelle",
28-
sha256 = "c5faf839dd1da0065ed7d44ac248b01ab5ffcd0db46e7193439906df68867c39",
29-
strip_prefix = "bazel-gazelle-38bd65ead186af23549480d6189b89c7c53c023e",
30-
urls = ["https://github.com/bazelbuild/bazel-gazelle/archive/38bd65ead186af23549480d6189b89c7c53c023e.zip"],
18+
sha256 = "222e49f034ca7a1d1231422cdb67066b885819885c356673cb1f72f748a3c9d4",
19+
urls = [
20+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.3/bazel-gazelle-v0.22.3.tar.gz",
21+
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.3/bazel-gazelle-v0.22.3.tar.gz",
22+
],
3123
)
32-
_maybe(
33-
http_archive,
24+
http_archive(
3425
name = "cpp_jsonnet",
3526
sha256 = "82d3cd35de8ef230d094b60a30e7659f415c350b0aa2bd62162cf2afdf163959",
3627
strip_prefix = "jsonnet-90cad75dcc2eafdcf059c901169d36539dc8a699",

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ module github.com/google/go-jsonnet
33
go 1.13
44

55
require (
6-
github.com/fatih/color v1.9.0
6+
github.com/fatih/color v1.10.0
77
github.com/sergi/go-diff v1.1.0
88
)

go.sum

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
22
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
33
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4-
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
5-
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
4+
github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=
5+
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
66
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
77
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
88
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
99
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
1010
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
11-
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
12-
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
13-
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
14-
github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM=
15-
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
11+
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
12+
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
13+
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
14+
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
1615
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1716
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1817
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
1918
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
2019
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
2120
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
2221
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
23-
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
24-
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
25-
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
22+
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
23+
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=
24+
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
2625
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
2726
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
2827
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

main_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ var standardExtCode = map[string]string{
6060
}
6161

6262
var metadataForTests = map[string]testMetadata{
63-
"testdata/extvar_code": testMetadata{extVars: standardExtVars, extCode: standardExtCode},
64-
"testdata/extvar_error": testMetadata{extVars: standardExtVars, extCode: standardExtCode},
65-
"testdata/extvar_hermetic": testMetadata{extVars: standardExtVars, extCode: standardExtCode},
66-
"testdata/extvar_mutually_recursive": testMetadata{extVars: standardExtVars, extCode: standardExtCode},
67-
"testdata/extvar_self_recursive": testMetadata{extVars: standardExtVars, extCode: standardExtCode},
68-
"testdata/extvar_static_error": testMetadata{extVars: standardExtVars, extCode: standardExtCode},
69-
"testdata/extvar_string": testMetadata{extVars: standardExtVars, extCode: standardExtCode},
63+
"testdata/extvar_code": {extVars: standardExtVars, extCode: standardExtCode},
64+
"testdata/extvar_error": {extVars: standardExtVars, extCode: standardExtCode},
65+
"testdata/extvar_hermetic": {extVars: standardExtVars, extCode: standardExtCode},
66+
"testdata/extvar_mutually_recursive": {extVars: standardExtVars, extCode: standardExtCode},
67+
"testdata/extvar_self_recursive": {extVars: standardExtVars, extCode: standardExtCode},
68+
"testdata/extvar_static_error": {extVars: standardExtVars, extCode: standardExtCode},
69+
"testdata/extvar_string": {extVars: standardExtVars, extCode: standardExtCode},
7070
}
7171

7272
type mainTest struct {

tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ JSONNET_CPP_DIR=${JSONNET_CPP_DIR:=$PWD/cpp-jsonnet}
77

88
set -x
99

10-
[ "$SKIP_GO_TESTS" == 1 ] || go test ./...
10+
go test -covermode atomic -coverprofile=coverage.out ./...
1111

1212
if [ "$SKIP_PYTHON_BINDINGS_TESTS" == 1 ]
1313
then

travisBuild.sh

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ set -e
44

55
run_tests() {
66
golangci-lint run ./...
7-
$GOPATH/bin/goveralls -service=travis-ci
87
SKIP_GO_TESTS=1 ./tests.sh
98
}
109

0 commit comments

Comments
 (0)