Skip to content

Commit 9d54ce9

Browse files
authored
Update build and imports, request templates. (#8)
1 parent 80c5ae7 commit 9d54ce9

File tree

11 files changed

+122
-43
lines changed

11 files changed

+122
-43
lines changed

.circleci/config.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Golang CircleCI 2.0 configuration file
2+
#
3+
# Check https://circleci.com/docs/2.0/language-go/ for more details
4+
references:
5+
# Common configuration for all jobs
6+
defaults: &defaults
7+
docker:
8+
- image: circleci/golang:1.9
9+
working_directory: /go/src/github.com/Azuka/keycloak-admin-go
10+
steps:
11+
- checkout
12+
- run:
13+
name: Install dependencies
14+
command: |
15+
make init-ci
16+
- run:
17+
name: Lint and run tests
18+
command: |
19+
PATH="$(pwd)/bin:$PATH" make lint
20+
make test-circle
21+
- store_test_results:
22+
path: /tmp/test-results
23+
24+
version: 2
25+
jobs:
26+
go-1.9:
27+
<<: *defaults
28+
docker:
29+
- image: circleci/golang:1.9
30+
go-1.10:
31+
<<: *defaults
32+
docker:
33+
- image: circleci/golang:1.10
34+
go-1.11:
35+
<<: *defaults
36+
docker:
37+
- image: circleci/golang:1.11
38+
39+
workflows:
40+
version: 2
41+
test-all-go-versions:
42+
jobs:
43+
- go-1.9
44+
- go-1.10
45+
- go-1.11
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
**Describe the bug**
2+
A clear and concise description of what the bug is.
3+
4+
**To Reproduce**
5+
Steps to reproduce the behavior:
6+
1. Go to '...'
7+
2. Click on '....'
8+
3. Scroll down to '....'
9+
4. See error
10+
11+
**Expected behavior**
12+
A clear and concise description of what you expected to happen.
13+
14+
**Environment (please complete the following information):**
15+
- `go version` [e.g. `go version go1.11.1 darwin/amd64`]
16+
17+
**Additional context**
18+
Add any other context about the problem here.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
**Is your feature request related to a problem? Please describe.**
2+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
3+
4+
**Describe the solution you'd like**
5+
A clear and concise description of what you want to happen.
6+
7+
**Describe alternatives you've considered**
8+
A clear and concise description of any alternative solutions or features you've considered.
9+
10+
**Additional context**
11+
Add any other context or screenshots about the feature request here.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/.idea
22
/vendor
3+
/bin
34
/lint.json
45
/.testCoverage.txt*

.gitlab-ci.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# This file is a template, and might need editing before it works on your project.
2-
image: circleci/golang:1.10
1+
image: circleci/golang:1.11
32

43
variables:
5-
# Please edit to your GitLab project
64
REPO_NAME: github.com/Azuka/keycloak-admin-go
75

86
cache:
@@ -32,11 +30,4 @@ unit:
3230
stage: test
3331
script:
3432
- cd $GOPATH/src/$REPO_NAME
35-
- make test-ci
36-
- env | sort
37-
38-
lint:
39-
stage: test
40-
script:
41-
- cd $GOPATH/src/$REPO_NAME
42-
- make lint-ci
33+
- make test-ci

Gopkg.lock

Lines changed: 24 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727

2828
[[constraint]]
29-
name = "github.com/go-resty/resty"
29+
name = "gopkg.in/resty.v1"
3030
version = "1.7.0"
3131

3232
[[constraint]]

Makefile

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ CI_TEST_REPORTS ?= /tmp/test-results
1919
.PHONY: init-ci
2020
init-ci:
2121
@echo "$(OK_COLOR)==> Installing minimal build requirements$(NO_COLOR)"
22-
go get -u github.com/alecthomas/gometalinter
23-
gometalinter --install
22+
dep ensure -v
23+
curl -L https://git.io/vp6lP | sh
2424
go get -u github.com/jstemmer/go-junit-report
25-
dep ensure
2625

2726
.PHONY: init
2827
init: init-ci
@@ -86,6 +85,14 @@ test-ci:
8685
go test -v -short -race -cover -coverprofile .testCoverage.txt $(GO_PACKAGES) | tee >(go-junit-report > $(CI_TEST_REPORTS)/report.xml); \
8786
sed '/_easyjson.go/d' .testCoverage.txt > .testCoverage.txt.bak; mv .testCoverage.txt.bak .testCoverage.txt; go tool cover -func=.testCoverage.txt"
8887

88+
# CircleCI test
89+
.PHONY: test-circle
90+
test-circle:
91+
@echo "$(OK_COLOR)==> Running circle test$(NO_COLOR)"
92+
mkdir -p $(CI_TEST_REPORTS)
93+
/bin/bash -c "set -euxo pipefail; \
94+
go test -v -short -race -cover $(GO_PACKAGES) | tee >(go-junit-report > $(CI_TEST_REPORTS)/report.xml)"
95+
8996
# CI Lint
9097
.PHONY: lint-ci
9198
lint-ci:
@@ -100,7 +107,10 @@ qt:
100107

101108
.PHONY: local-ci
102109
local-ci:
103-
@echo "$(OK_COLOR)==> Running CI locally. Did you run brew install gitlab-runner?$(NO_COLOR)"
110+
@echo "$(OK_COLOR)==> Running CI locally. Did you run brew install gitlab-runner and CircleCI?$(NO_COLOR)"
111+
circleci local execute --job go-1.9
112+
circleci local execute --job go-1.10
113+
circleci local execute --job go-1.11
104114
brew services start gitlab-runner
105115
gitlab-runner exec docker unit
106116
gitlab-runner exec docker lint

Readme.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[![pipeline status](https://gitlab.com/Azuka/keycloak-admin-go/badges/master/pipeline.svg)](https://gitlab.com/Azuka/keycloak-admin-go/commits/master)
55
[![coverage report](https://gitlab.com/Azuka/keycloak-admin-go/badges/master/coverage.svg)](https://gitlab.com/Azuka/keycloak-admin-go/commits/master)
66
[![Go Report Card](https://goreportcard.com/badge/github.com/Azuka/keycloak-admin-go)](https://goreportcard.com/report/github.com/Azuka/keycloak-admin-go)
7+
[![CircleCI](https://circleci.com/gh/Azuka/keycloak-admin-go.svg?style=svg)](https://circleci.com/gh/Azuka/keycloak-admin-go)
78

89
Keycloak admin client in go.
910

@@ -20,6 +21,8 @@ make init
2021
make test
2122
make integration
2223
```
24+
### Local CI
25+
- Install CircleCI locally: https://circleci.com/docs/2.0/local-cli
2326

2427
## Wish List
2528
- [x] Add authentication integration tests
@@ -53,7 +56,7 @@ make integration
5356
- [ ] Root
5457

5558
## Thanks to
56-
- https://github.com/go-resty/resty: quick and dirty REST client
59+
- https://gopkg.in/resty.v1: quick and dirty REST client
5760
- https://github.com/mailru/easyjson: faster JSON serialization
5861
- https://godoc.org/golang.org/x/oauth2: for the shamelessly copied authentication
5962
- https://github.com/fatih/gomodifytags: because I'm too lazy to type json struct tags

keycloak/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"context"
1212
"fmt"
1313

14-
"github.com/go-resty/resty"
14+
"gopkg.in/resty.v1"
1515
)
1616

1717
const userAgent = "go/keycloak-admin"

0 commit comments

Comments
 (0)