Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding dockertest to project #202

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/code_scanners.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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:
code_scanning:
strategy:
matrix:
job_name: [security, vuln_check, lint]

runs-on: ubuntu-latest
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 Scan
run: ./bin/task ${{ matrix.job_name }}

29 changes: 6 additions & 23 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,17 @@ on:
- master
pull_request:


jobs:
test:
strategy:
matrix:
go: [ 1.21.0]
grafana: [ 9.4.3, 10.0.0 ]
go: [ 1.21.0 ]
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 +36,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.

20 changes: 14 additions & 6 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,20 @@ 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:
- golangci-lint run --skip-dirs "(^|/)test($|/)" --skip-files "_test.go" ./...
- golangci-lint run --timeout=30m --skip-dirs "(^|/)test($|/)" --skip-files "_test.go" ./...
spellcheck:
desc: "Check Spelling across code"
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
Loading
Loading