Skip to content

Commit

Permalink
Removing code from CICD
Browse files Browse the repository at this point in the history
  • Loading branch information
safaci2000 committed Oct 6, 2023
1 parent 6d0bc1d commit 5a8b599
Show file tree
Hide file tree
Showing 11 changed files with 213 additions and 211 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/code_scanners.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Code Scanners
on:
push:
branches:
- master
pull_request:
branches:
- master

env:
GO_VERSION: 1.21


permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read


jobs:
govulncheck_job:
runs-on: ubuntu-latest
name: Run govulncheck
steps:
- id: govulncheck
uses: golang/govulncheck-action@v1
with:
go-version-input: "1.21.2"
go-package: ./...
security_scan:
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- name: Checkout Source
uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: "1.21.2"
cache: false
- name: Install Task
run: sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d
- name: Installing Go Tools
run: ./bin/task install_tools
- name: Running security scanning
run: ./bin/task security
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: $GO_VERSION
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v1.54
args: --timeout=30m
31 changes: 8 additions & 23 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,19 @@ on:
- master
pull_request:

env:
GO_VERSION: 1.21.0

jobs:
test:
strategy:
matrix:
go: [ 1.21.0]
grafana: [ 9.4.3, 10.0.0 ]
go: [ $GO_VERSION ]
grafana: [ 8.5.22, 9.4.3, 10.1.4 ]

env:
GRAFANA_INTEGRATION: 1

services:
minio:
image: bitnami/minio:latest
ports:
- 9000:9000
- 9001:9001
options: >-
-e GF_AUTH_ANONYMOUS_ENABLED=true -e MINIO_ROOT_USER="test" -e MINIO_ROOT_PASSWORD="secretsss"
grafana:
# Docker Hub image
image: "grafana/grafana:${{ matrix.grafana }}"
ports:
- 3000:3000
options: >-
-e GF_AUTH_ANONYMOUS_ENABLED=true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -51,16 +38,14 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: Wait for Minio to come up.
run: nc -z -v -w15 127.0.0.1 9000
- name: Calc coverage
if: "${{ matrix.go == '1.21.0' && matrix.grafana == '9.4.3' }}"
if: "${{ matrix.go == '1.21.0' && matrix.grafana == '10.1.4' }}"
run: |
go test -v -covermode=atomic -coverprofile=coverage.out ./...
- name: Convert coverage.out to coverage.lcov
if: "${{ matrix.go == '1.21.0' && matrix.grafana == '9.4.3' }}"
if: "${{ matrix.go == '1.21.0' && matrix.grafana == '10.1.4' }}"
uses: jandelgado/[email protected]
- name: Test
if: "${{ matrix.grafana != '9.4.3' }}"
if: "${{ matrix.grafana != '10.1.4' }}"
run: go test -v ./...

31 changes: 0 additions & 31 deletions .github/workflows/golangci-lint.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/security.yml

This file was deleted.

18 changes: 13 additions & 5 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ tasks:
cmds:
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- go install github.com/client9/misspell/cmd/misspell@latest
- go install github.com/securego/gosec/v2/cmd/gosec@master
- go install golang.org/x/vuln/cmd/govulncheck@latest
format:
desc: "Format code"
cmds:
- gofmt -w -s .
security:
desc: "Run security scan"
cmds:
- gosec --exclude=G402,G304 ./...
lint:
desc: "Lint project, skipping test files."
cmds:
Expand Down Expand Up @@ -62,10 +68,6 @@ tasks:
- go install -ldflags "{{ .LD_FLAGS}}"
- mv ${GOPATH}/bin/gdg ${GOPATH}/bin/{{ .BIN_NAME }}
silent: false
test:
desc: "Dos tuff"
cmds:
- echo ${GOPATH}
get-deps:
desc: "Tidy Deps"
cmds:
Expand Down Expand Up @@ -103,6 +105,12 @@ tasks:
cmds:
- goreleaser release
test:
desc: ""
desc: "test check"
cmds:
- go test -v ./... -cover
env:
GRAFANA_INTEGRATION: "1"
vuln_check:
desc: "Vulnerability check"
cmds:
- govulncheck ./...
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build Stage
FROM golang:1.20.0 AS build-stage
FROM golang:1.21.2 AS build-stage

LABEL app="build-gdg"
LABEL REPO="https://github.com/esnet/gdg"
Expand All @@ -15,7 +15,7 @@ WORKDIR /go/src/github.com/esnet/gdg
RUN make build-alpine

# Final Stage
FROM golang:1.20.0
FROM golang:1.21.2

ARG GIT_COMMIT
ARG VERSION
Expand Down
77 changes: 40 additions & 37 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/esnet/gdg

go 1.21
go 1.21.2

require (
github.com/AlecAivazis/survey/v2 v2.3.7
Expand All @@ -12,7 +12,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.7.0
github.com/spf13/viper v1.16.0
github.com/spf13/viper v1.17.0
github.com/stretchr/testify v1.8.4
github.com/thoas/go-funk v0.9.3
github.com/tidwall/pretty v1.2.1
Expand All @@ -26,26 +26,26 @@ require (
)

require (
github.com/aws/aws-sdk-go v1.45.0
github.com/aws/aws-sdk-go v1.45.23
github.com/bep/simplecobra v0.3.2
github.com/carlmjohnson/requests v0.23.4
github.com/esnet/grafana-swagger-api-golang v0.0.0-20230622184543-9252e4b83277
github.com/esnet/grafana-swagger-api-golang v0.0.0-20230904013855-9a47b55d30d3
github.com/go-openapi/runtime v0.26.0
github.com/jedib0t/go-pretty/v6 v6.4.7
github.com/jedib0t/go-pretty/v6 v6.4.8
github.com/ory/dockertest/v3 v3.10.0
github.com/samber/lo v1.38.1
github.com/tidwall/gjson v1.16.0
github.com/tidwall/gjson v1.17.0
gocloud.dev v0.34.0
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
)

require (
cloud.google.com/go v0.110.7 // indirect
cloud.google.com/go v0.110.8 // indirect
cloud.google.com/go/compute v1.23.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.2 // indirect
cloud.google.com/go/storage v1.32.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1 // indirect
cloud.google.com/go/storage v1.33.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.1.0 // indirect
Expand All @@ -57,27 +57,27 @@ require (
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/aws/aws-sdk-go-v2 v1.21.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13 // indirect
github.com/aws/aws-sdk-go-v2/config v1.18.37 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.35 // indirect
github.com/aws/aws-sdk-go-v2/config v1.18.43 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.41 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.81 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.88 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.42 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.43 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.14 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.36 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.4 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.38.5 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.13.5 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.5 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.21.5 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.40.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.15.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.23.0 // indirect
github.com/aws/smithy-go v1.14.2 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/containerd/continuity v0.3.0 // indirect
github.com/creack/pty v1.1.18 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/docker/cli v20.10.17+incompatible // indirect
github.com/docker/docker v20.10.7+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
Expand All @@ -99,11 +99,11 @@ require (
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/s2a-go v0.1.5 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/google/wire v0.5.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.1 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/gosimple/unidecode v1.0.1 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
Expand All @@ -126,35 +126,38 @@ require (
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/stretchr/objx v0.5.1 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel v1.17.0 // indirect
go.opentelemetry.io/otel/metric v1.17.0 // indirect
go.opentelemetry.io/otel/trace v1.17.0 // indirect
go.opentelemetry.io/otel v1.19.0 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.16.0 // indirect
golang.org/x/oauth2 v0.11.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sync v0.4.0 // indirect
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 // indirect
golang.org/x/tools v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.138.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/grpc v1.57.0 // indirect
google.golang.org/api v0.145.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect
google.golang.org/grpc v1.58.2 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
Loading

0 comments on commit 5a8b599

Please sign in to comment.