Skip to content
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
23 changes: 7 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ jobs:
echo "VERSION -> $GITVERSION_SEMVER"
test:
runs-on: ubuntu-latest
container:
image: golang:1.24-bookworm
needs: set-version
env:
SEMVER: ${{ needs.set-version.outputs.semVer }}
Expand All @@ -51,25 +49,18 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: install deps
run: |
apt update && apt install -y jq git unzip
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config user.email ${{ github.actor }}[email protected]
git config user.name ${{ github.actor }}
- name: Install Eirctl
uses: ensono/actions/[email protected]
with:
version: 0.6.5
isPrerelease: false

- name: Run Lint
run: |
task lint
eirctl run pipeline lint
- name: Run Tests
run: |
task coverage
eirctl run pipeline test
ls -alt .coverage/out
ls -lat .coverage/report-junit.xml
- name: Publish Junit style Test Report
Expand Down
25 changes: 10 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ jobs:

release:
runs-on: ubuntu-latest
container:
image: golang:1.24-bookworm
env:
FOO: Bar
needs: set-version
env:
SEMVER: ${{ needs.set-version.outputs.semVer }}
Expand All @@ -52,24 +48,23 @@ jobs:
with:
fetch-depth: 1

- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Eirctl
uses: ensono/actions/[email protected]
with:
version: 0.6.5
isPrerelease: false

- name: install deps
- name: release library
run: |
apt-get update && apt-get install jq git -y
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config user.email ${{ github.actor }}[email protected]
git config user.name ${{ github.actor }}
- name: release library
run: |
task tag GIT_TAG=${SEMVER} REVISION=$GITHUB_SHA
GIT_TAG=${SEMVER} REVISION=$GITHUB_SHA eirctl run tag

- name: build binary
run: |
task bin REVISION=$GITHUB_SHA GIT_TAG=${SEMVER}
eirctl run pipeline build:bin --set VERSION=${SEMVER} --set REVISION=$GITHUB_SHA

- name: Release binary
uses: softprops/action-gh-release@v2
with:
Expand Down
174 changes: 174 additions & 0 deletions eirctl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Ensono/eirctl/refs/heads/main/schemas/schema_v1.json

output: prefixed
debug: false

contexts:
go1x:
container:
name: golang:1.24.4-bookworm
enable_dind: true
enable_mount: true
envfile:
exclude:
- GO
- CXX
- CGO

golint:
container:
name: golangci/golangci-lint:v2.1.5-alpine
enable_dind: true
enable_mount: true
envfile:
exclude:
- GO
- CXX
- CGO
- PATH
- HOME

tasks:
clean:
context: go1x
command:
- rm -rf dist/*
- rm -rf .coverage
- mkdir -p dist .coverage

run:test:
description: Runs the tests
context: go1x
command:
- |
go test ./... -v -buildvcs=false -mod=readonly -race -coverpkg=./... -coverprofile=.coverage/out | tee .coverage/unit

install:
description: Install dependencies
command: |
go mod tidy

lint:vet:
description: Runs lint and vet
context: go1x
command: |
go vet

golint:
# in CI it is run
context: golint
description: Runs the linter and go vet and other default static checks
allow_failure: false
command:
# echo "lint ran with exit code: $?"
# pwd && ls -lat
- |
golangci-lint run

vuln:check:
context: go1x
description: |
Runs a vulnerability scan against the code base
command:
- |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...

coverage:
description: generate coverage
context: go1x
command:
- |
go install github.com/jstemmer/go-junit-report/v2@latest
go install github.com/axw/gocov/gocov@latest
go install github.com/AlekSi/gocov-xml@latest
go-junit-report -in .coverage/unit > .coverage/report-junit.xml
gocov convert .coverage/out | gocov-xml > .coverage/report-cobertura.xml

show:coverage:
description: Opens the current coverage viewer for the the configmanager utility.
command: go tool cover -html=.coverage/out

show_docs:
description: |
Opens a webview with godoc running
Already filters the packages to this one and enables
internal/private package documentation
# go install golang.org/x/tools/cmd/godoc@latest
command: |
open http://localhost:6060/pkg/github.com/DevLabFoundry/configmanager/v2/?m=all
godoc -notes "BUG|TODO" -play -http=:6060

build:binary:
context: go1x
description: |
Generates binaries in a dist folder

Generates all the binaries for the configmanager utility.
command:
- |
ldflags="-s -w -X \"github.com/DevLabFoundry/configmanager/v2/cmd/configmanager.Version={{.VERSION}}\" -X \"github.com/DevLabFoundry/configmanager/v2/cmd/configmanager.Revision={{.REVISION}}\" -extldflags -static"
GOOS=${BUILD_GOOS} GOARCH=${BUILD_GOARCH} CGO_ENABLED=0 go build -mod=readonly -buildvcs=false -ldflags="$ldflags" \
-o ./dist/configmanager-${GOOS}-${GOARCH}${BUILD_SUFFIX} ./cmd
reset_context: true
variations:
- BUILD_GOOS: darwin
BUILD_GOARCH: amd64
BUILD_SUFFIX: ""
- BUILD_GOOS: darwin
BUILD_GOARCH: arm64
BUILD_SUFFIX: ""
- BUILD_GOOS: linux
BUILD_GOARCH: amd64
BUILD_SUFFIX: ""
- BUILD_GOOS: linux
BUILD_GOARCH: arm64
BUILD_SUFFIX: ""
- BUILD_GOOS: windows
BUILD_GOARCH: amd64
BUILD_SUFFIX: ".exe"
- BUILD_GOOS: windows
BUILD_GOARCH: arm64
BUILD_SUFFIX: ".exe"
- BUILD_GOOS: windows
BUILD_GOARCH: "386"
BUILD_SUFFIX: ".exe"
required:
args:
- VERSION
- REVISION

tag:
description: |
Usage `eirctl tag GIT_TAG=2111dsfsdfa REVISION=as2342432`

command: |
git tag -a ${VERSION} -m "ci tag release" ${REVISION}
git push origin ${VERSION}
required:
env:
- VERSION
- REVISION

pipelines:
test:
- task: clean
- task: run:test
depends_on: clean
- task: coverage
depends_on: run:test

lint:
- task: lint:vet
- task: vuln:check

show_coverage:
- pipeline: test
- task: show:coverage
depends_on: test

build:bin:
- task: clean
- task: build:binary
depends_on: clean

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/DevLabFoundry/configmanager/v2

go 1.24.3
go 1.24.4

require (
cloud.google.com/go/secretmanager v1.14.7
Expand Down
3 changes: 2 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ sonar.tests=.
sonar.test.inclusions=**/*_test.go
sonar.test.exclusions=**/*_generated*.go,**/*_generated/**,**/vendor/**

sonar.sourceEncoding=UTF-8
sonar.sourceEncoding=UTF-8
sonar.qualitygate.wait=true
105 changes: 0 additions & 105 deletions taskfile.yml

This file was deleted.