From 836c16347c8a55263fb231180df8ea91d6d8cef5 Mon Sep 17 00:00:00 2001 From: Tom Czarniecki Date: Sun, 30 May 2021 10:50:33 +1000 Subject: [PATCH] switch to github actions --- .github/workflows/build.yml | 20 ++++++++++++++++++++ .github/workflows/release.yml | 28 ++++++++++++++++++++++++++++ .travis.yml | 14 -------------- Makefile | 9 ++++++++- README.md | 2 -- 5 files changed, 56 insertions(+), 17 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 00000000..b31331c9 --- /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 00000000..3d74bbe9 --- /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/s3backup* diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4f82d89f..00000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: go -go: - - 1.16.x -script: - - make travis -deploy: - provider: releases - api_key: - secure: EVgMJz8z1gELgzOKr0YhgjWSbtTOxSj5eVuuuOQ7+JC2gq/xFiLXS+yb6qR9lLIH3OCT0v57bSrR3AQaVdqH58cvFcxUgFWwc3wOU/j8/gu3NGImq+Q3iYsJ41a/OTtY1xztEn3LN4L19TYWeYyDDGFNNstR8DyOjN+VFmibkEV0ZzFUatK9vRo6yG32GEmLD9mkyAmYvtwVXueJsraABmLH75pNGAL8TQixOY9sUYH7Q3vj+TC23McUDTkosQyJ+DiPhykl0YOz4BQva6vPqm8156ovxFZh6Uz+Ze+VeUHduKUPKozcQXfhsrmnjGKkusR3jgXH1mnsNh6bX265S3WZki+wUBvwF/HM2ZHsqPF6Zfdo6JjcRnjNJ/wMIskWkubQJXPI4G9cmnEEimJjdd4hz5lUVHpO1t6Kl9EPZAKPoOoYb/R08jGjkTG8n6rVu1Jl7gjo6H6h1Rzql2cRPCC3F/ozWM9o21M5bmFXB6was0Mwp1jINwq11zOtusxoEDdnxWXHJWVNp8GUPNkmLBaQtGj9YpPHn6iWYcg8TzSMiFdbwqWGHyC1fh+k5e3jkzExZ2vpmBYjbzfYdFa/OhJxExcdgnSIEewmjlhMgFoG7IYIXGSGNjc9rJeDTiiqqh7uh/6ilVYpQqmoM820M0U0YQ6+6ymG8ygm85GkPvs= - file_glob: true - file: target/* - skip_cleanup: true - on: - tags: true diff --git a/Makefile b/Makefile index a6b3f6ab..10e069e0 100644 --- a/Makefile +++ b/Makefile @@ -4,24 +4,30 @@ GIT_TAG := $(shell git describe --tags 2>/dev/null) LDFLAGS := -X github.com/tomcz/s3backup/config.commit=${GITCOMMIT} LDFLAGS := ${LDFLAGS} -X github.com/tomcz/s3backup/config.tag=${GIT_TAG} +.PHONY: precommit precommit: clean format test build -travis: clean +.PHONY: commit +commit: clean GO111MODULE=on GOFLAGS='-mod=vendor' $(MAKE) test build +.PHONY: clean clean: rm -rf target target: mkdir target +.PHONY: format format: @echo "Running goimports ..." @goimports -w -local github.com/tomcz/s3backup $(shell find . -type f -name '*.go' | grep -v '/vendor/') +.PHONY: test test: go test -race -cover -ldflags "${LDFLAGS}" ./... +.PHONY: generate generate: ifeq (, $(shell which mockgen)) go install github.com/golang/mock/mockgen@v1.5.0 @@ -31,6 +37,7 @@ endif compile = GOOS=$2 GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o target/$1-$2 ./cmd/$1 +.PHONY: build build: target $(call compile,s3backup,linux) $(call compile,s3backup,darwin) diff --git a/README.md b/README.md index 3e6d5e3d..7b487e54 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -[![Build Status](https://travis-ci.org/tomcz/s3backup.svg?branch=master)](https://travis-ci.org/tomcz/s3backup) - # S3 backup script in a single binary Provides a standard way of backing up an archive to a S3 bucket, and restoring the backed up archive from its S3 bucket. No more custom backup scripts please ...