Skip to content

Commit

Permalink
Merge pull request #3 from project-ncl/add-go-lint-and-renovate
Browse files Browse the repository at this point in the history
Improve go CI.
  • Loading branch information
tecarter94 authored Dec 23, 2024
2 parents 7accbd6 + 286112f commit c1584e5
Show file tree
Hide file tree
Showing 104 changed files with 110,643 additions and 40 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/go-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: GoLang CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
- name: golangci-lint
uses: golangci/[email protected]
with:
args: "--timeout=10m --build-tags='normal periodic minikube'"
go:
name: Check sources
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
- name: Check go mod status
run: |
go mod tidy
if [[ ! -z $(git status -s) ]]
then
echo "Go mod state is not clean:"
git --no-pager diff
exit 1
fi
- name: Check format
run: |
go fmt ./cmd/... ./pkg/...
if [[ ! -z $(git status -s) ]]
then
echo "not all golang files properly gofmt'ed:"
git --no-pager diff
exit 1
fi
unit:
name: Golang Unit tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
- name: Build Domain Proxy Server
run: go build -v -o bin/domainproxyserver cmd/server/main.go
- name: Build Domain Proxy Client
run: go build -v -o bin/domainproxyclient cmd/client/main.go
- name: Test
run: go test -v ./test
- name: Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
security_scan:
name: Security scan
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
# https://github.com/securego/gosec/blob/12be14859bc7d4b956b71bef0b443694aa519d8a/README.md#integrating-with-code-scanning
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
# we let the report trigger content trigger a failure using the GitHub Security features.
args: '-tags normal,periodic -no-fail -fmt sarif -out results.sarif ./...'
- name: Upload SARIF file
uses: github/codeql-action/[email protected]
with:
# Path to SARIF file relative to the root of the repository
sarif_file: results.sarif
34 changes: 0 additions & 34 deletions .github/workflows/go.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
/vendor/

# Go workspace file
go.work
go.work.sum
Expand Down
5 changes: 2 additions & 3 deletions deploy/Dockerfile.all-in-one
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
FROM registry.access.redhat.com/ubi9/go-toolset:1.22.5-1731639025@sha256:45170b6e45114849b5d2c0e55d730ffa4a709ddf5f58b9e810548097b085e78f as builder
FROM registry.access.redhat.com/ubi9/go-toolset@sha256:ead35188c5748efe2b9420352aba56b02b43d8fcd7e879cc96c6b9ac2548e454 as builder
USER 0
WORKDIR /work
COPY ./ .

ENV GOTOOLCHAIN=auto \
GOSUMDB=sum.golang.org

RUN go mod tidy && \
go build -o domainproxyserver cmd/server/main.go && \
RUN go build -o domainproxyserver cmd/server/main.go && \
go build -o domainproxyclient cmd/client/main.go

FROM quay.io/konflux-ci/buildah-task:latest@sha256:5cbd487022fb7ac476cbfdea25513b810f7e343ec48f89dc6a4e8c3c39fa37a2
Expand Down
2 changes: 2 additions & 0 deletions vendor/github.com/elazarl/goproxy/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions vendor/github.com/elazarl/goproxy/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

170 changes: 170 additions & 0 deletions vendor/github.com/elazarl/goproxy/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c1584e5

Please sign in to comment.