feat(ci): prepare concourse pipelines
This commit is contained in:
parent
51b6ffbff3
commit
d4d2cbd586
7 changed files with 204 additions and 73 deletions
42
.concourse/branch-tracker.yml
Normal file
42
.concourse/branch-tracker.yml
Normal file
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
resource_types:
|
||||
- name: git-branches
|
||||
type: registry-image
|
||||
source:
|
||||
repository: aoldershaw/git-branches-resource
|
||||
|
||||
resources:
|
||||
- name: feature-branches
|
||||
type: git-branches
|
||||
source:
|
||||
uri: https://code.icb4dc0.de/prskr/goveal.git
|
||||
# The "(?P<name>pattern)" syntax defines a named capture group.
|
||||
# aoldershaw/git-branches-resource emits the value of each named capture
|
||||
# group under the `groups` key.
|
||||
#
|
||||
# e.g. feature/some-feature ==> {"groups": {"feature": "some-feature"}}
|
||||
branch_regex: '(\d+-|\w+\/)(?P<feature>.*)'
|
||||
|
||||
- name: goveal.git
|
||||
type: git
|
||||
icon: github
|
||||
source:
|
||||
uri: https://code.icb4dc0.de/prskr/goveal.git
|
||||
fetch_tags: true
|
||||
|
||||
jobs:
|
||||
- name: set-feature-pipelines
|
||||
plan:
|
||||
- in_parallel:
|
||||
- get: feature-branches
|
||||
trigger: true
|
||||
- get: goveal.git
|
||||
- load_var: branches
|
||||
file: feature-branches/branches.json
|
||||
- across:
|
||||
- var: branch
|
||||
values: ((.:branches))
|
||||
set_pipeline: goveal-dev
|
||||
file: goveal.git/.concourse/branch-validate.yml
|
||||
instance_vars: {feature: ((.:branch.groups.feature))}
|
||||
vars: {branch: ((.:branch.name))}
|
69
.concourse/branch-validate.yml
Normal file
69
.concourse/branch-validate.yml
Normal file
|
@ -0,0 +1,69 @@
|
|||
---
|
||||
resources:
|
||||
- name: goveal.git
|
||||
type: git
|
||||
icon: github
|
||||
source:
|
||||
uri: https://code.icb4dc0.de/prskr/goveal.git
|
||||
branch: ((branch))
|
||||
|
||||
- name: templates.git
|
||||
type: git
|
||||
icon: github
|
||||
source:
|
||||
uri: https://code.icb4dc0.de/prskr/pipeline-templates.git
|
||||
|
||||
jobs:
|
||||
- name: lint
|
||||
plan:
|
||||
- get: goveal.git
|
||||
trigger: true
|
||||
- get: templates.git
|
||||
- task: lint
|
||||
file: goveal.git/.concourse/tasks/lint.yml
|
||||
input_mapping: {repo: goveal.git}
|
||||
on_success:
|
||||
task: report-success
|
||||
file: templates.git/tasks/gitea-status.yml
|
||||
input_mapping: {repo: goveal.git}
|
||||
vars:
|
||||
project_path: prskr/goveal
|
||||
context: concourse-ci/lint/golangci-lint
|
||||
description: Lint Go files
|
||||
state: success
|
||||
on_failure:
|
||||
task: report-failure
|
||||
file: templates.git/tasks/gitea-status.yml
|
||||
input_mapping: {repo: goveal.git}
|
||||
vars:
|
||||
project_path: prskr/goveal
|
||||
context: concourse-ci/lint/golangci-lint
|
||||
description: Lint Go files
|
||||
state: failure
|
||||
- name: test
|
||||
plan:
|
||||
- get: goveal.git
|
||||
trigger: true
|
||||
- get: templates.git
|
||||
- task: test
|
||||
file: goveal.git/.concourse/tasks/test.yml
|
||||
privileged: true
|
||||
input_mapping: {repo: goveal.git}
|
||||
on_success:
|
||||
task: report-success
|
||||
file: templates.git/tasks/gitea-status.yml
|
||||
input_mapping: {repo: goveal.git}
|
||||
vars:
|
||||
project_path: prskr/goveal
|
||||
context: concourse-ci/test/gotestsum
|
||||
description: Run unit tests
|
||||
state: success
|
||||
on_failure:
|
||||
task: report-failure
|
||||
file: templates.git/tasks/gitea-status.yml
|
||||
input_mapping: {repo: goveal.git}
|
||||
vars:
|
||||
project_path: prskr/goveal
|
||||
context: concourse-ci/test/gotestsum
|
||||
description: Run unit tests
|
||||
state: failure
|
30
.concourse/cleanup.yml
Normal file
30
.concourse/cleanup.yml
Normal file
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
resources:
|
||||
- name: daily
|
||||
type: time
|
||||
source:
|
||||
interval: 24h
|
||||
- name: goveal.git
|
||||
type: git
|
||||
icon: github
|
||||
source:
|
||||
uri: https://code.icb4dc0.de/prskr/goveal.git
|
||||
- name: templates.git
|
||||
type: git
|
||||
icon: github
|
||||
source:
|
||||
uri: https://code.icb4dc0.de/prskr/pipeline-templates.git
|
||||
|
||||
jobs:
|
||||
- name: renovate
|
||||
plan:
|
||||
- get: goveal.git
|
||||
trigger: true
|
||||
- get: templates.git
|
||||
- get: daily
|
||||
trigger: true
|
||||
- task: renovate
|
||||
file: templates.git/tasks/renovate.yml
|
||||
input_mapping: { repo: goveal.git }
|
||||
vars:
|
||||
project_path: prskr/goveal
|
24
.concourse/tasks/lint.yml
Normal file
24
.concourse/tasks/lint.yml
Normal file
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
platform: linux
|
||||
|
||||
image_resource:
|
||||
type: registry-image
|
||||
source:
|
||||
repository: docker.io/golangci/golangci-lint
|
||||
tag: latest
|
||||
|
||||
inputs:
|
||||
- name: repo
|
||||
path: .
|
||||
|
||||
params:
|
||||
GO111MODULE: "on"
|
||||
CGO_ENABLED: "0"
|
||||
GITEA_TOKEN: ((gitea-credentials.token))
|
||||
|
||||
run:
|
||||
path: bash
|
||||
args:
|
||||
- -ce
|
||||
- |
|
||||
golangci-lint run -v
|
25
.concourse/tasks/test.yml
Normal file
25
.concourse/tasks/test.yml
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
platform: linux
|
||||
|
||||
image_resource:
|
||||
type: registry-image
|
||||
source:
|
||||
repository: docker.io/golang:1.19-buster
|
||||
tag: latest
|
||||
|
||||
inputs:
|
||||
- name: repo
|
||||
path: .
|
||||
|
||||
params:
|
||||
GO111MODULE: "on"
|
||||
CGO_ENABLED: "1"
|
||||
GITEA_TOKEN: ((gitea-credentials.token))
|
||||
|
||||
run:
|
||||
path: bash
|
||||
args:
|
||||
- -ce
|
||||
- |
|
||||
go install gotest.tools/gotestsum@latest
|
||||
gotestsum -f pkgname-and-test-fails -- -race -shuffle=on ./...
|
61
.github/workflows/go.yml
vendored
61
.github/workflows/go.yml
vendored
|
@ -1,61 +0,0 @@
|
|||
name: Go
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
packages: write
|
||||
pull-requests: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Go 1.18
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '^1.18'
|
||||
id: go
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
lfs: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Task
|
||||
uses: arduino/setup-task@v1
|
||||
|
||||
- name: Download assets
|
||||
run: task download-assets
|
||||
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
version: latest
|
||||
|
||||
- name: Build & test
|
||||
run: task test
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v3
|
||||
with:
|
||||
version: latest
|
||||
args: release --rm-dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -5,7 +5,7 @@ linters-settings:
|
|||
lines: 100
|
||||
statements: 50
|
||||
gci:
|
||||
local-prefixes: github.com/baez90/goveal
|
||||
local-prefixes: code.icb4dc0.de/prskr/goveal
|
||||
goconst:
|
||||
min-len: 2
|
||||
min-occurrences: 2
|
||||
|
@ -24,7 +24,7 @@ linters-settings:
|
|||
gocyclo:
|
||||
min-complexity: 15
|
||||
goimports:
|
||||
local-prefixes: github.com/baez90/goveal
|
||||
local-prefixes: code.icb4dc0.de/prskr/goveal
|
||||
golint:
|
||||
min-confidence: 0
|
||||
gomnd:
|
||||
|
@ -58,47 +58,52 @@ linters:
|
|||
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
|
||||
disable-all: true
|
||||
enable:
|
||||
- deadcode
|
||||
- contextcheck
|
||||
- dogsled
|
||||
- dupl
|
||||
- errcheck
|
||||
- errchkjson
|
||||
- errname
|
||||
- errorlint
|
||||
- exhaustive
|
||||
- exportloopref
|
||||
- funlen
|
||||
- gocognit
|
||||
- goconst
|
||||
- gocritic
|
||||
# - gocritic
|
||||
- gocyclo
|
||||
- godox
|
||||
- gofumpt
|
||||
- goimports
|
||||
- gomoddirectives
|
||||
- gomnd
|
||||
- gosec
|
||||
- gosimple
|
||||
- govet
|
||||
- importas
|
||||
- ineffassign
|
||||
# - ireturn - enable later
|
||||
- lll
|
||||
- misspell
|
||||
- nakedret
|
||||
- nestif
|
||||
- nilnil
|
||||
- noctx
|
||||
- nolintlint
|
||||
- paralleltest
|
||||
- prealloc
|
||||
- predeclared
|
||||
- promlinter
|
||||
- staticcheck
|
||||
- structcheck
|
||||
- stylecheck
|
||||
- testpackage
|
||||
- thelper
|
||||
- typecheck
|
||||
# - typecheck
|
||||
- unconvert
|
||||
- unparam
|
||||
- varcheck
|
||||
- whitespace
|
||||
|
||||
#- unused
|
||||
- unused
|
||||
- wastedassign
|
||||
|
||||
issues:
|
||||
# Excluding configuration per-path, per-linter, per-text and per-source
|
||||
|
@ -118,6 +123,3 @@ run:
|
|||
skip-files:
|
||||
- ".*\\.pb\\.go$"
|
||||
- ".*.mock.\\.go$"
|
||||
|
||||
service:
|
||||
golangci-lint-version: 1.43.x # use the fixed version to not introduce new linters unexpectedly
|
||||
|
|
Loading…
Reference in a new issue