Skip to content

Commit

Permalink
switch to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcz committed May 30, 2021
1 parent eb87341 commit 836c163
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 17 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
LICENSE.md
target/s3backup*
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
Expand All @@ -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)
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 ...
Expand Down

0 comments on commit 836c163

Please sign in to comment.