mirror of https://github.com/fmartingr/bazaar.git
Added github workflows
This commit is contained in:
parent
07dcd73c3c
commit
d7afaa915d
|
@ -0,0 +1,21 @@
|
|||
name: Go
|
||||
|
||||
on: workflow_call
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: go-versions
|
||||
strategy:
|
||||
matrix:
|
||||
go_version: ${{ fromJSON(needs.go-versions.outputs.matrix) }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go_version }}
|
||||
|
||||
- name: Build
|
||||
run: make build
|
|
@ -0,0 +1,14 @@
|
|||
name: Go
|
||||
|
||||
on: workflow_call
|
||||
|
||||
jobs:
|
||||
go-versions:
|
||||
name: Lookup go versions
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.versions.outputs.matrix }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: arnested/go-version-action@v1
|
||||
id: versions
|
|
@ -0,0 +1,17 @@
|
|||
name: "golangci-lint"
|
||||
|
||||
on: workflow_call
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
jobs:
|
||||
golangci:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
with:
|
||||
version: latest
|
||||
only-new-issues: true
|
|
@ -0,0 +1,21 @@
|
|||
name: "Unit Tests"
|
||||
|
||||
on: workflow_call
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
needs: go-versions
|
||||
strategy:
|
||||
matrix:
|
||||
go_version: ${{ fromJSON(needs.go-versions.outputs.matrix) }}
|
||||
name: Go ${{ matrix.go_version }} unit tests
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go_version }}
|
||||
|
||||
- run: make test
|
|
@ -1,24 +0,0 @@
|
|||
name: Go
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["latest"]
|
||||
pull_request:
|
||||
branches: ["latest"]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.18
|
||||
|
||||
- name: Build
|
||||
run: go build -v ./...
|
||||
|
||||
- name: Test and coverage
|
||||
run: go test -cover -v ./...
|
|
@ -0,0 +1,20 @@
|
|||
name: "Pull Request"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- latest
|
||||
|
||||
concurrency:
|
||||
group: ci-tests-${{ github.ref }}-1
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
go-versions:
|
||||
uses: ./.github/workflows/_go-versions.yml
|
||||
call-lint:
|
||||
uses: ./.github/workflows/_golangci-lint.yml
|
||||
call-build:
|
||||
uses: ./.github/workflows/_build.yml
|
||||
call-test:
|
||||
uses: ./.github/workflows/_test.yml
|
|
@ -0,0 +1,31 @@
|
|||
name: goreleaser
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*" # Versioning tags
|
||||
|
||||
permissions:
|
||||
contents: write # Required to upload dist files
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.19
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
version: latest
|
||||
args: release --rm-dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -0,0 +1,32 @@
|
|||
before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- linux
|
||||
- windows
|
||||
- darwin
|
||||
main: ./cmd/server
|
||||
archives:
|
||||
- replacements:
|
||||
darwin: macos
|
||||
linux: linux
|
||||
windows: windows
|
||||
386: i386
|
||||
amd64: x86_64
|
||||
source:
|
||||
enabled: true
|
||||
name_template: "{{ .ProjectName }}-{{ .Version }}-sources"
|
||||
format: "tar.gz"
|
||||
checksum:
|
||||
name_template: "checksums.txt"
|
||||
snapshot:
|
||||
name_template: "{{ .Tag }}-dev"
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- "^docs:"
|
||||
- "^test:"
|
Loading…
Reference in New Issue