|
| 1 | +# yaml-language-server: $schema=https://raw.githubusercontent.com/Ensono/eirctl/refs/heads/main/schemas/schema_v1.json |
| 2 | + |
| 3 | +output: prefixed |
| 4 | +debug: false |
| 5 | + |
| 6 | +contexts: |
| 7 | + go1x: |
| 8 | + container: |
| 9 | + name: golang:1.24.4-bookworm |
| 10 | + enable_dind: true |
| 11 | + enable_mount: true |
| 12 | + envfile: |
| 13 | + exclude: |
| 14 | + - GO |
| 15 | + - CXX |
| 16 | + - CGO |
| 17 | + |
| 18 | + golint: |
| 19 | + container: |
| 20 | + name: golangci/golangci-lint:v2.1.5-alpine |
| 21 | + enable_dind: true |
| 22 | + enable_mount: true |
| 23 | + envfile: |
| 24 | + exclude: |
| 25 | + - GO |
| 26 | + - CXX |
| 27 | + - CGO |
| 28 | + - PATH |
| 29 | + - HOME |
| 30 | + |
| 31 | +tasks: |
| 32 | + clean: |
| 33 | + context: go1x |
| 34 | + command: |
| 35 | + - rm -rf dist/* |
| 36 | + - rm -rf .coverage |
| 37 | + - mkdir -p dist .coverage |
| 38 | + |
| 39 | + run:test: |
| 40 | + description: Runs the tests |
| 41 | + context: go1x |
| 42 | + command: |
| 43 | + - | |
| 44 | + go test ./... -v -buildvcs=false -mod=readonly -race -coverpkg=./... -coverprofile=.coverage/out | tee .coverage/unit |
| 45 | +
|
| 46 | + install: |
| 47 | + description: Install dependencies |
| 48 | + command: | |
| 49 | + go mod tidy |
| 50 | +
|
| 51 | + lint:vet: |
| 52 | + description: Runs lint and vet |
| 53 | + context: go1x |
| 54 | + command: | |
| 55 | + go vet |
| 56 | +
|
| 57 | + golint: |
| 58 | + # in CI it is run |
| 59 | + context: golint |
| 60 | + description: Runs the linter and go vet and other default static checks |
| 61 | + allow_failure: false |
| 62 | + command: |
| 63 | + # echo "lint ran with exit code: $?" |
| 64 | + # pwd && ls -lat |
| 65 | + - | |
| 66 | + golangci-lint run |
| 67 | +
|
| 68 | + vuln:check: |
| 69 | + context: go1x |
| 70 | + description: | |
| 71 | + Runs a vulnerability scan against the code base |
| 72 | + command: |
| 73 | + - | |
| 74 | + go install golang.org/x/vuln/cmd/govulncheck@latest |
| 75 | + govulncheck ./... |
| 76 | +
|
| 77 | + coverage: |
| 78 | + description: generate coverage |
| 79 | + context: go1x |
| 80 | + command: |
| 81 | + - | |
| 82 | + go install github.com/jstemmer/go-junit-report/v2@latest |
| 83 | + go install github.com/axw/gocov/gocov@latest |
| 84 | + go install github.com/AlekSi/gocov-xml@latest |
| 85 | + go-junit-report -in .coverage/unit > .coverage/report-junit.xml |
| 86 | + gocov convert .coverage/out | gocov-xml > .coverage/report-cobertura.xml |
| 87 | +
|
| 88 | + show:coverage: |
| 89 | + description: Opens the current coverage viewer for the the configmanager utility. |
| 90 | + command: go tool cover -html=.coverage/out |
| 91 | + |
| 92 | + show_docs: |
| 93 | + description: | |
| 94 | + Opens a webview with godoc running |
| 95 | + Already filters the packages to this one and enables |
| 96 | + internal/private package documentation |
| 97 | +# go install golang.org/x/tools/cmd/godoc@latest |
| 98 | + command: | |
| 99 | + open http://localhost:6060/pkg/github.com/DevLabFoundry/configmanager/v2/?m=all |
| 100 | + godoc -notes "BUG|TODO" -play -http=:6060 |
| 101 | +
|
| 102 | + build:binary: |
| 103 | + context: go1x |
| 104 | + description: | |
| 105 | + Generates binaries in a dist folder |
| 106 | +
|
| 107 | + Generates all the binaries for the configmanager utility. |
| 108 | + command: |
| 109 | + - | |
| 110 | + 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" |
| 111 | + GOOS=${BUILD_GOOS} GOARCH=${BUILD_GOARCH} CGO_ENABLED=0 go build -mod=readonly -buildvcs=false -ldflags="$ldflags" \ |
| 112 | + -o ./dist/configmanager-${GOOS}-${GOARCH}${BUILD_SUFFIX} ./cmd |
| 113 | + reset_context: true |
| 114 | + variations: |
| 115 | + - BUILD_GOOS: darwin |
| 116 | + BUILD_GOARCH: amd64 |
| 117 | + BUILD_SUFFIX: "" |
| 118 | + - BUILD_GOOS: darwin |
| 119 | + BUILD_GOARCH: arm64 |
| 120 | + BUILD_SUFFIX: "" |
| 121 | + - BUILD_GOOS: linux |
| 122 | + BUILD_GOARCH: amd64 |
| 123 | + BUILD_SUFFIX: "" |
| 124 | + - BUILD_GOOS: linux |
| 125 | + BUILD_GOARCH: arm64 |
| 126 | + BUILD_SUFFIX: "" |
| 127 | + - BUILD_GOOS: windows |
| 128 | + BUILD_GOARCH: amd64 |
| 129 | + BUILD_SUFFIX: ".exe" |
| 130 | + - BUILD_GOOS: windows |
| 131 | + BUILD_GOARCH: arm64 |
| 132 | + BUILD_SUFFIX: ".exe" |
| 133 | + - BUILD_GOOS: windows |
| 134 | + BUILD_GOARCH: "386" |
| 135 | + BUILD_SUFFIX: ".exe" |
| 136 | + required: |
| 137 | + args: |
| 138 | + - VERSION |
| 139 | + - REVISION |
| 140 | + |
| 141 | + tag: |
| 142 | + description: | |
| 143 | + Usage `eirctl tag GIT_TAG=2111dsfsdfa REVISION=as2342432` |
| 144 | +
|
| 145 | + command: | |
| 146 | + git tag -a ${VERSION} -m "ci tag release" ${REVISION} |
| 147 | + git push origin ${VERSION} |
| 148 | + required: |
| 149 | + env: |
| 150 | + - VERSION |
| 151 | + - REVISION |
| 152 | + |
| 153 | +pipelines: |
| 154 | + test: |
| 155 | + - task: clean |
| 156 | + - task: run:test |
| 157 | + depends_on: clean |
| 158 | + - task: coverage |
| 159 | + depends_on: run:test |
| 160 | + |
| 161 | + lint: |
| 162 | + - task: lint:vet |
| 163 | + - task: vuln:check |
| 164 | + |
| 165 | + show_coverage: |
| 166 | + - pipeline: test |
| 167 | + - task: show:coverage |
| 168 | + depends_on: test |
| 169 | + |
| 170 | + build:bin: |
| 171 | + - task: clean |
| 172 | + - task: build:binary |
| 173 | + depends_on: clean |
| 174 | + |
0 commit comments