Skip to content

Commit

Permalink
feat: Update CI and release workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
kianaza committed Jun 4, 2024
1 parent 6846425 commit c8835bb
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 28 deletions.
59 changes: 32 additions & 27 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
---
name: ci
on:
- push
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
name: ci
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.58
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
go-version: 1.22
- run: go test -v ./... -covermode=atomic -coverprofile=coverage.out
- uses: codecov/codecov-action@v4.0.1
with:
version: v1.58
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.22
- run: go test -v ./... -covermode=atomic -coverprofile=coverage.out
- uses: codecov/[email protected]
with:
files: coverage.out
token: ${{ secrets.CODECOV_TOKEN }}
slug: snapp-incubator/nats-blackbox-exporter
files: coverage.out
token: ${{ secrets.CODECOV_TOKEN }}
slug: snapp-incubator/nats-blackbox-exporter
31 changes: 31 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release

on:
push:
tags:
- 'v*.*.*'

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'

- name: Install dependencies
run: go mod download

- name: Install Goreleaser
run: |
curl -sSfL https://raw.githubusercontent.com/goreleaser/goreleaser/main/scripts/install.sh | sh
- name: Run Goreleaser
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goreleaser release --rm-dist
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
# config
config.yaml

.DS_Store
.DS_Store
dist/
63 changes: 63 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
project_name: nats-blackbox-exporter

release:
draft: true
github:
owner: snappcloud
name: nats-blackbox-exporter

name_template: 'Release {{.Tag}}'

builds:
- main: ./cmd/nats-blackbox-exporter
id: nats-blackbox-exporter
binary: nats-blackbox-exporter
ldflags:
- "-s -w -X github.com/nats-io/nats-blackbox-exporter/cmd.Version={{ .Tag }}"
env:
- GO111MODULE=on
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- 386
- amd64
- arm
- arm64
goarm:
- 6
- 7
ignore:
- goos: darwin
goarch: 386

archives:
- id: zipfiles
wrap_in_directory: true
name_template: '{{ .ProjectName }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm
}}v{{ .Arm }}{{ end }}'
format: zip
files:
- LICENSE
- README.md
- nats-blackbox-exporter*

nfpms:
- formats:
- deb
file_name_template: '{{ .ProjectName }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm
}}v{{ .Arm }}{{ end }}'
bindir: /usr/local/bin
description: A Simplified Prometheus Monitoring Solution for NATS
vendor: nats.io
maintainer: Colin Sullivan <[email protected]>
homepage: https://nats.io
license: Apache 2.0

snapshot:
name_template: SNAPSHOT-{{ .Commit }}

checksum:
name_template: '{{ .ProjectName }}-v{{ .Version }}-checksums.txt'

0 comments on commit c8835bb

Please sign in to comment.