Skip to content

Commit

Permalink
ci: enable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fgouteroux committed Dec 19, 2023
1 parent e2e9feb commit b4028a2
Show file tree
Hide file tree
Showing 5 changed files with 396 additions and 13 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: CI
on:
pull_request:
push:

jobs:

golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest

build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
thread: [ 0, 1, 2 ]
steps:
- uses: actions/checkout@v3
- uses: prometheus/[email protected]
- uses: ./.github/promci/actions/build
with:
parallelism: 3
thread: ${{ matrix.thread }}

publish_release:
name: Publish release arfefacts
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
- uses: prometheus/[email protected]
- uses: ./.github/promci/actions/publish_release
with:
github_token: ${{ secrets.TOKEN }}
20 changes: 20 additions & 0 deletions .promu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
go:
version: 1.21
repository:
path: github.com/fgouteroux/promk
build:
binaries:
- name: promk
ldflags: |
-X github.com/prometheus/common/version.Version={{.Version}}
-X github.com/prometheus/common/version.Revision={{.Revision}}
-X github.com/prometheus/common/version.Branch={{.Branch}}
-X github.com/prometheus/common/version.BuildUser={{user}}@{{host}}
-X github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}}
tarball:
files:
- LICENSE
crossbuild:
platforms:
- linux
- windows
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1 / 2023-12-19

* [FEATURE] first version
22 changes: 9 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
TEST?=$$(go list ./... |grep -v 'vendor')
GO ?= go
GOFMT ?= $(GO)fmt
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
GO_CMD ?= go
BUILD_DIR = $(PWD)/build
SHELL := /bin/bash
FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
PROMU := $(FIRST_GOPATH)/bin/promu

include Makefile.common

clean:
rm -rf ./build ./dist
Expand All @@ -11,21 +15,13 @@ tidy:
go mod tidy

fmt:
$(GO_CMD)fmt -w $(GOFMT_FILES)
$(GOFMT) -w $(GOFMT_FILES)

lint:
golangci-lint run

security:
gosec -exclude-dir _local -quiet ./...

build:
goreleaser build --snapshot --rm-dist

test:
go test -v -timeout 30s -coverprofile=cover.out -cover $(TEST)
go tool cover -func=cover.out

release:
goreleaser release --skip-publish --rm-dist

promu:
$(PROMU) build
Loading

0 comments on commit b4028a2

Please sign in to comment.