From 1238e9856ff5a2228cbf33fa20541c29aac29886 Mon Sep 17 00:00:00 2001 From: Tom Czarniecki Date: Sun, 30 May 2021 10:34:17 +1000 Subject: [PATCH] switch to github actions --- .github/workflows/build.yml | 20 ++++++++++++++++++++ .github/workflows/release.yml | 28 ++++++++++++++++++++++++++++ .travis.yml | 14 -------------- Makefile | 7 ++++++- README.md | 2 -- go.mod | 2 +- vendor/modules.txt | 5 +++++ 7 files changed, 60 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b31331c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,20 @@ +name: build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Build + run: make commit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a5e5fb4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +--- +name: "tagged-release" + +on: + push: + tags: + - "v*" + +jobs: + tagged-release: + name: "Tagged Release" + runs-on: "ubuntu-latest" + steps: + - uses: actions/checkout@v2 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Build + run: make commit + - name: Automatic Releases + uses: marvinpinto/action-automatic-releases@v1.2.0 + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + prerelease: false + files: | + LICENSE.md + target/openldap_exporter* diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3c3c619..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: go -go: - - 1.13.x -script: - - make travis -deploy: - provider: releases - api_key: - secure: cnW0us8VBEztRQVHblityiZVHD1axdaZHZLt3mwhkYF9lkUOjXlq8shqAQDqDR7DrRy3kOpkccVS0nrxGJvlGYp9rrlcQdYySB45OO7rKV+AgKcFDiLBxPuyjfOb72dlyGq6S116bMjaa8XkPZ/HmNNKxDmGXJhghAes/9kT3M3N0eSdWJpGZlsyX99oFIoHAuwGqeYVoKi6sVnA0uGX2Gb/erYpJkfRdotUNjGPqGwE1otLKsUi21XtX6L8v7kO7VqPYELsrYArTvVkJIT6MKnOrJi1kCbF5WeczbsUs6ArjVR+6b4JVscpwzSxSnUvxszHd3ZVbQCec5FagmLnJ2k2EsyL+23tqBeppoqQW7aXGNcJMnWBj8tNYMflIRelrW/eKbVohnyBc5gAL5ui3huEYaaNag5pVGI+ceFvIoXbgmt2GJ3u1fE2GnrCQlL0QTHmGFBQTghnggzypKIpeQdRtTkSIqTDB54AEOC/pgHghvysHsb0+3N6NQedhMp0Hvv1lobDmsh7UqZdbZlESmiF44CsTJOaynN4gAjiAbpmbvQ//SNicY5N6BhQp6gPmU3DuLAFuEaW3x59rU5t5gg7FYqjm3VmOs7XP5tXuEXS5Ji3pLVr6GthYm1yFqb8//xSsvcwDude3+ucAFHoWXbXDqZyGFnyil/RTsH4hg0= - file_glob: true - file: target/* - skip_cleanup: true - on: - tags: true diff --git a/Makefile b/Makefile index e7a5643..dad313f 100644 --- a/Makefile +++ b/Makefile @@ -4,23 +4,28 @@ GIT_TAG := $(shell git describe --tags 2>/dev/null) LDFLAGS := -X github.com/tomcz/openldap_exporter.commit=${GITCOMMIT} LDFLAGS := ${LDFLAGS} -X github.com/tomcz/openldap_exporter.tag=${GIT_TAG} +.PHONY: precommit precommit: clean format build -travis: clean +.PHONY: commit +commit: clean GO111MODULE=on GOFLAGS='-mod=vendor' $(MAKE) build +.PHONY: clean clean: rm -rf target target: mkdir target +.PHONY: format format: @echo "Running goimports ..." @goimports -w -local github.com/tomcz/openldap_exporter $(shell find . -type f -name '*.go' | grep -v '/vendor/') compile = GOOS=$1 GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o target/openldap_exporter-$1 ./cmd/openldap_exporter +.PHONY: build build: target $(call compile,linux) $(call compile,darwin) diff --git a/README.md b/README.md index 65e3b9a..47c7c69 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -[![Build Status](https://travis-ci.org/tomcz/openldap_exporter.svg?branch=master)](https://travis-ci.org/tomcz/openldap_exporter) - # OpenLDAP Prometheus Exporter This is a simple service that scrapes metrics from OpenLDAP and exports them via HTTP for Prometheus consumption. diff --git a/go.mod b/go.mod index bfc8834..a97b657 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/tomcz/openldap_exporter -go 1.13 +go 1.16 require ( github.com/hashicorp/go-multierror v1.0.0 diff --git a/vendor/modules.txt b/vendor/modules.txt index 9a8509a..c78e55f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -11,10 +11,12 @@ github.com/golang/protobuf/proto # github.com/hashicorp/errwrap v1.0.0 github.com/hashicorp/errwrap # github.com/hashicorp/go-multierror v1.0.0 +## explicit github.com/hashicorp/go-multierror # github.com/matttproud/golang_protobuf_extensions v1.0.1 github.com/matttproud/golang_protobuf_extensions/pbutil # github.com/prometheus/client_golang v1.2.1 +## explicit github.com/prometheus/client_golang/prometheus github.com/prometheus/client_golang/prometheus/internal github.com/prometheus/client_golang/prometheus/promhttp @@ -33,13 +35,16 @@ github.com/russross/blackfriday/v2 # github.com/shurcooL/sanitized_anchor_name v1.0.0 github.com/shurcooL/sanitized_anchor_name # github.com/urfave/cli/v2 v2.2.0 +## explicit github.com/urfave/cli/v2 github.com/urfave/cli/v2/altsrc # golang.org/x/sys v0.0.0-20191010194322-b09406accb47 golang.org/x/sys/windows # gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d +## explicit gopkg.in/asn1-ber.v1 # gopkg.in/ldap.v2 v2.5.1 +## explicit gopkg.in/ldap.v2 # gopkg.in/yaml.v2 v2.2.2 gopkg.in/yaml.v2