Skip to content

Commit

Permalink
New base docker image
Browse files Browse the repository at this point in the history
Additionally adjust a couple of configuration files and workflows.
  • Loading branch information
bcessa committed Jul 8, 2021
1 parent cef26fd commit 848eab7
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 40 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Expand Up @@ -15,11 +15,11 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
# Go 1.15
- name: Set up Go 1.15
# Go 1.16
- name: Set up Go 1.16
uses: actions/setup-go@v2
with:
go-version: ^1.15
go-version: ^1.16

# Checkout code
- name: Checkout repository
Expand All @@ -32,7 +32,7 @@ jobs:
# if: steps.vendor-cache.outputs.cache-hit != 'true'
- name: Restore vendor from cache
id: vendor-cache
uses: actions/cache@v2.1.4
uses: actions/cache@v2.1.6
env:
cache-name: vendor
with:
Expand All @@ -42,9 +42,9 @@ jobs:
# Style consistency and static analysis using 'golangci-lint'
# https://github.com/marketplace/actions/run-golangci-lint
- name: Static analysis
uses: golangci/golangci-lint-action@v2.4.0
uses: golangci/golangci-lint-action@v2.5.2
with:
version: v1.38
version: latest

# Run unit tests
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maintenance.yml
Expand Up @@ -7,7 +7,7 @@ jobs:
name: "close stale issues and pull requests"
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
- uses: actions/stale@v3.0.19
with:
# On the 'debug' mode the action will not perform any operation.
# Add the secret ACTIONS_STEP_DEBUG with a value of 'true' in the repository.
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/release.yml → .github/workflows/publish.yml
@@ -1,4 +1,4 @@
name: release
name: publish
on:
push:
tags:
Expand All @@ -11,15 +11,16 @@ jobs:
timeout-minutes: 10
if: startsWith(github.ref, 'refs/tags/')
steps:
# Go 1.15
- name: Set up Go 1.15
# Go 1.16
- name: Set up Go 1.16
uses: actions/setup-go@v2
with:
go-version: ^1.15
go-version: ^1.16

# Checkout code
- name: Checkout repository
uses: actions/checkout@v2
# This is required for the changelog to be properly generated
with:
fetch-depth: 0

Expand All @@ -28,20 +29,17 @@ jobs:
# if: steps.vendor-cache.outputs.cache-hit != 'true'
- name: Restore vendor from cache
id: vendor-cache
uses: actions/cache@v2.1.4
uses: actions/cache@v2.1.6
env:
cache-name: vendor
with:
path: ./vendor
key: ${{ env.cache-name }}-${{ hashFiles('go.sum') }}

# Ensure project compile and build successfully
- name: Build
run: make build-for os=linux arch=amd64

# Use goreleaser to create the new release
# https://github.com/goreleaser/goreleaser-action
- name: Create release
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v2.6.1
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
Expand Down
9 changes: 2 additions & 7 deletions .golangci.yml
Expand Up @@ -24,7 +24,7 @@ linters:
- errcheck
- gosimple
- govet
- golint
- revive
- gofmt
- ineffassign
- staticcheck
Expand All @@ -39,7 +39,6 @@ linters:
- nakedret
- prealloc
- gosec
- scopelint
- bodyclose
- stylecheck
- unparam
Expand All @@ -48,13 +47,12 @@ linters:
- asciicheck
- errorlint
- exhaustive
- exportloopref
- forcetypeassert
- godot
- ifshort
- noctx
- predeclared
- scopelint
- exportloopref
- wastedassign
- whitespace
#- wrapcheck
Expand All @@ -75,7 +73,6 @@ issues:
- gosec
- lll
- nakedret
- scopelint
- funlen
- nestif
- noctx
Expand Down Expand Up @@ -103,8 +100,6 @@ linters-settings:
- unusedresult
- tests
#- fieldalignment
golint:
min-confidence: 0.8
gofmt:
simplify: true
gocyclo:
Expand Down
23 changes: 14 additions & 9 deletions .goreleaser.yml
Expand Up @@ -58,38 +58,43 @@ snapshot:
# configure the 'CHANGELOG.md' file produced
# https://goreleaser.com/customization/release/#customize-the-changelog
changelog:
sort: asc
# Sorts the changelog by the commit messages (asc, desc or '')
sort: ''
# Remove certain commit messages from the changelog
filters:
# Standard commit messages can help to produce better changelogs
# https://www.conventionalcommits.org/en/v1.0.0/
exclude:
- "^docs:"
- "^test:"
- typo
- "^chore:"
- "^typo:"
# build and publish docker images
# https://goreleaser.com/customization/docker/
dockers:
-
# Build IDs to gather the binaries from
ids:
- govanity
# GOOS of the built binary that should be used
goos: linux
# GOARCH of the built binary that should be used
goarch: amd64
# Dockerfile location
dockerfile: Dockerfile
# Binaries that should be used
binaries:
- govanity
# Build IDs to gather the binaries from
builds:
- govanity
# OCI image tags
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
- "--label=org.opencontainers.image.version={{ .Version }}"
- "--label=org.opencontainers.image.created={{ .CommitDate }}"
- "--label=org.opencontainers.image.source=https://github.com/bryk-io/{{ .ProjectName }}"
# Skips the docker push if there is an indicator for prerelease
# in the tag e.g. v1.0.0-rc1 (auto)
skip_push: auto
skip_push: false
# Additional files to add/copy into the container image
extra_files: []
image_templates:
- "ghcr.io/bryk-io/{{ .ProjectName }}:{{ .Version }}"
- "ghcr.io/bryk-io/{{ .ProjectName }}:latest"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
@@ -1,4 +1,4 @@
FROM ghcr.io/bryk-io/shell:0.1.0
FROM ghcr.io/bryk-io/shell:0.2.0

# Expose required ports and volumes
VOLUME ["/tmp", "/etc/govanity"]
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Expand Up @@ -18,7 +18,6 @@ LD_FLAGS += -X main.coreVersion=$(GIT_TAG)
LD_FLAGS += -X main.buildTimestamp=$(GIT_COMMIT_DATE)
LD_FLAGS += -X main.buildCode=$(GIT_COMMIT_HASH)

## help: Prints this help message
help:
@echo "Commands available"
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /' | sort
Expand Down Expand Up @@ -82,7 +81,7 @@ release:
## scan: Look for known vulnerabilities in the project dependencies
# https://github.com/sonatype-nexus-community/nancy
scan:
@go list -f '{{if not .Indirect}}{{.}}{{end}}' -mod=mod -m all | nancy sleuth -o text
@go list -f '{{if not .Indirect}}{{.}}{{end}}' -m all | nancy sleuth --skip-update-check

## test: Run unit tests excluding the vendor dependencies
test:
Expand Down
7 changes: 3 additions & 4 deletions config_test.go
Expand Up @@ -3,15 +3,14 @@ package main

import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"testing"

"gopkg.in/yaml.v2"
)

var sampleConf string = `
var sampleConf = `
host: go.bryk.io
cache_max_age: 3600
paths:
Expand Down Expand Up @@ -118,7 +117,7 @@ func TestServer(t *testing.T) {
if err != nil {
t.Error(err)
}
if fmt.Sprintf("%s", response) != "pong" {
if string(response) != "pong" {
t.Error("invalid response")
}
})
Expand Down Expand Up @@ -153,7 +152,7 @@ func TestServer(t *testing.T) {
if err != nil {
t.Error(err)
}
if fmt.Sprintf("%s", response) != "unknown path" {
if string(response) != "unknown path" {
t.Error("invalid response")
}
})
Expand Down

0 comments on commit 848eab7

Please sign in to comment.