Skip to content

Commit

Permalink
update go version matrix (#72)
Browse files Browse the repository at this point in the history
* update go version matrix

* update tooling installation
  • Loading branch information
ajatprabha committed Jun 12, 2023
1 parent d80daf9 commit dbc80fc
Show file tree
Hide file tree
Showing 10 changed files with 207 additions and 161 deletions.
85 changes: 42 additions & 43 deletions .github/workflows/checks.yml
Expand Up @@ -12,57 +12,56 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ 1.14.x, 1.15.x, 1.16.x ]
go-version: [ 1.18.x, 1.19.x, 1.20.x ]
steps:
- uses: actions/checkout@v2
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Run test scripts
run: |
make setup
make test-ci
env:
GO111MODULE: on
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make coverage
- uses: actions/checkout@v2
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Run test scripts
run: |
make test-ci
env:
GO111MODULE: on
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make coverage
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ 1.14.x, 1.15.x, 1.16.x ]
go-version: [ 1.18.x, 1.19.x, 1.20.x ]
steps:
- uses: actions/checkout@v2
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Build
run: make compile
env:
GO111MODULE: on
- uses: actions/checkout@v2
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Build
run: make compile
env:
GO111MODULE: on
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Test Build
run: |
cd website
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
npm run build
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Test Build
run: |
cd website
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
npm run build
102 changes: 51 additions & 51 deletions .github/workflows/release.yml
Expand Up @@ -3,64 +3,64 @@ name: Release
on:
push:
tags:
- v\d+.\d+.\d+
- v\d+.\d+.\d+

jobs:
release:
name: Docker Push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build Push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
shell: bash
run: |
docker run --rm --privileged -v $(pwd):/darkroom \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(which docker):$(which docker) -w /darkroom \
-e GITHUB_TOKEN \
-e DOCKER_USERNAME \
-e DOCKER_PASSWORD \
ajatprabha/ci-goreleaser \
/bin/bash -c "echo $DOCKER_PASSWORD | docker login docker.io --username $DOCKER_USERNAME --password-stdin && goreleaser release --skip-validate --rm-dist"
- uses: actions/checkout@v2
- name: Build Push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
shell: bash
run: |
docker run --rm --privileged -v $(pwd):/darkroom \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(which docker):$(which docker) -w /darkroom \
-e GITHUB_TOKEN \
-e DOCKER_USERNAME \
-e DOCKER_PASSWORD \
ajatprabha/ci-goreleaser \
/bin/bash -c "echo $DOCKER_PASSWORD | docker login docker.io --username $DOCKER_USERNAME --password-stdin && goreleaser release --skip-validate --rm-dist"
release-docs:
name: Publish GH Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Add key to allow access to repository
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
GH_PAGES_DEPLOY: ${{ secrets.CI_DEPLOY_KEY }}
run: |
mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
echo "$GH_PAGES_DEPLOY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
cat <<EOT >> ~/.ssh/config
Host github.com
HostName github.com
IdentityFile ~/.ssh/id_rsa
EOT
- name: Release to GitHub Pages
env:
USE_SSH: true
GIT_USER: git
run: |
cd website
git config --global user.email "actions@gihub.com"
git config --global user.name "gh-actions"
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
npx docusaurus deploy
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Add key to allow access to repository
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
GH_PAGES_DEPLOY: ${{ secrets.CI_DEPLOY_KEY }}
run: |
mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
echo "$GH_PAGES_DEPLOY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
cat <<EOT >> ~/.ssh/config
Host github.com
HostName github.com
IdentityFile ~/.ssh/id_rsa
EOT
- name: Release to GitHub Pages
env:
USE_SSH: true
GIT_USER: git
run: |
cd website
git config --global user.email "actions@gihub.com"
git config --global user.name "gh-actions"
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
npx docusaurus deploy
38 changes: 21 additions & 17 deletions Makefile
Expand Up @@ -27,18 +27,15 @@ GO_RUN := GOOS=${GOOS} GOARCH=${GOARCH} CGO_ENABLED=1 go run $(LD_FLAGS)

all: test-ci

setup:
go get golang.org/x/lint/golint

run: copy-config
@$(GO_RUN) main.go server

compile:
@mkdir -p $(BUILD_DIR)
@$(GO_BUILD) -o $(APP_EXECUTABLE) main.go

lint:
@golint ./... | { grep -vwE "exported (var|function|method|type|const) \S+ should have comment" || true; }
lint: golint
@$(GOLINT) ./... | { grep -vwE "exported (var|function|method|type|const) \S+ should have comment" || true; }

format:
go fmt ./...
Expand All @@ -63,18 +60,25 @@ docker-docs:

test-ci: copy-config compile lint format vet test

# find or download goveralls
### Helper functions

golint:
$(call install-if-needed,GOLINT,golang.org/x/lint/golint,v0.0.0-20210508222113-6edffad5e616)

goveralls:
ifeq (, $(shell which goveralls))
@{ \
$(call install-if-needed,GOVERALLS,github.com/mattn/goveralls,v0.0.12)

is-available = $(if $(shell command -v $(1) 2> /dev/null),yes,no)

define install-if-needed
@if [ $(call is-available,$(notdir $(2))) = "no" ] ; then \
echo "Installing $(2)..." ;\
set -e ;\
GOVERALLS_TMP_DIR=$$(mktemp -d) ;\
cd $$GOVERALLS_TMP_DIR ;\
TMP_DIR=$$(mktemp -d) ;\
cd $$TMP_DIR ;\
go mod init tmp ;\
go get github.com/mattn/goveralls ;\
rm -rf $$GOVERALLS_TMP_DIR ;\
}
GOVERALLS=$(GOBIN)/goveralls
else
GOVERALLS=$(shell which goveralls)
endif
go install $(2)@$(3) ;\
rm -rf $$TMP_DIR ;\
fi
@$(eval $1 := $(if $(shell command -v $(notdir $(2))),$(shell command -v $(notdir $(2))),$(GOBIN)/$(notdir $(2))))
endef
2 changes: 1 addition & 1 deletion build/Dockerfile
@@ -1,4 +1,4 @@
FROM golang:1.16-alpine AS builder
FROM golang:1.20-alpine AS builder
ENV GO111MODULE=on
WORKDIR /app
COPY . .
Expand Down
62 changes: 53 additions & 9 deletions go.mod
@@ -1,30 +1,74 @@
module github.com/gojek/darkroom

go 1.16
go 1.18

require (
cloud.google.com/go/storage v1.0.0
github.com/DataDog/datadog-go v2.2.0+incompatible // indirect
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5
github.com/anthonynsimon/bild v0.13.0
github.com/aws/aws-sdk-go v1.34.0
github.com/cactus/go-statsd-client/statsd v0.0.0-20190501063751-9a7692639588
github.com/chai2010/webp v1.1.0
github.com/gojektech/heimdall v5.0.2+incompatible
github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c // indirect
github.com/gorilla/mux v1.8.0
github.com/pelletier/go-toml v1.4.0 // indirect
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.11.1
github.com/rcrowley/go-metrics v0.0.0-20190706150252-9beb055b7962 // indirect
github.com/smartystreets/assertions v1.0.0 // indirect
github.com/spf13/cobra v1.1.3
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.7.0
github.com/stretchr/testify v1.7.0
go.opencensus.io v0.22.2 // indirect
go.uber.org/zap v1.17.0
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114 // indirect
google.golang.org/api v0.13.0
sigs.k8s.io/controller-runtime v0.6.1
)

require (
cloud.google.com/go v0.46.3 // indirect
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/DataDog/datadog-go v2.2.0+incompatible // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect
github.com/golang/protobuf v1.4.3 // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.3.0 // indirect
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/pelletier/go-toml v1.4.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20190706150252-9beb055b7962 // indirect
github.com/smartystreets/assertions v1.0.0 // indirect
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cast v1.3.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
go.opencensus.io v0.22.2 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136 // indirect
golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect
golang.org/x/net v0.0.0-20200625001655-4c5254603344 // indirect
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 // indirect
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 // indirect
golang.org/x/text v0.3.3 // indirect
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114 // indirect
google.golang.org/appengine v1.6.1 // indirect
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a // indirect
google.golang.org/grpc v1.26.0 // indirect
google.golang.org/protobuf v1.26.0-rc.1 // indirect
gopkg.in/ini.v1 v1.51.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
honnef.co/go/tools v0.0.1-2019.2.3 // indirect
)
1 change: 0 additions & 1 deletion go.sum
Expand Up @@ -65,7 +65,6 @@ github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnweb
github.com/cactus/go-statsd-client/statsd v0.0.0-20190501063751-9a7692639588 h1:6yVhh6P5OsW6HutPt7z2ggDgZczgUtSl2kGRe+DslPU=
github.com/cactus/go-statsd-client/statsd v0.0.0-20190501063751-9a7692639588/go.mod h1:3/sdo8I67TaOslRGJ6FqQC/ynu+wg7H6IE4WYtr51hk=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/config.go
Expand Up @@ -99,7 +99,7 @@ func DefaultParams() []string {
return strings.Split(getConfig().defaultParams, ";")
}

// MetricSystem returns the metrics system to be used for MetricService in dependencies from the environment
// MetricsSystem returns the metrics system to be used for MetricService in dependencies from the environment
func MetricsSystem() string {
return getConfig().metricsSystem
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/regex/regex.go
Expand Up @@ -13,6 +13,6 @@ var (
WebFolderMatcher = regexp.MustCompile("^(?i)webfolder$")
// PrometheusMatcher regex matches against string prometheus in any case
PrometheusMatcher = regexp.MustCompile("^(?i)prometheus$")
// StatsDMatcher regex matches against string statsd in any case
// StatsdMatcher regex matches against string statsd in any case
StatsdMatcher = regexp.MustCompile("^(?i)statsd$")
)

0 comments on commit dbc80fc

Please sign in to comment.