Skip to content

Commit

Permalink
add github actions (#109)
Browse files Browse the repository at this point in the history
* Use github actions instead of travis
  • Loading branch information
neurosnap authored Jun 21, 2022
1 parent 35bc0d2 commit 0c38fad
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 40 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: release

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: install golang
uses: actions/setup-go@v2
with:
go-version: 1.18.x

- name: checkout code
uses: actions/checkout@v2

- name: build assets
run: make release

- name: gh login
run: echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token

- name: upload assets to release
run: gh release upload ${{ github.event.release.tag_name }} dist/*
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: tests

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
go-version: [1.17.x, 1.18.x]

steps:
- name: install golang
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}

- name: install bats
run: |
git clone https://github.com/sstephenson/bats.git --branch v0.4.0 --depth 1 "${HOME}/bats"
echo "${HOME}/bats/bin" >> $GITHUB_PATH
- name: checkout code
uses: actions/checkout@v2

- name: run tests
run: make test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
supercronic
vendor
dist/*
40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ test: unit integration
fmt:
gofmt -l -w ${GOFILES_NOVENDOR}

.PHONY: release
release:
./build.sh

.DEFAULT_GOAL := test
14 changes: 14 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

set -x

mkdir -p dist
export GOOS="linux"
export CGO_ENABLED=0
for arch in amd64 386 arm arm64; do GOARCH="$arch" go build && file supercronic | grep 'statically linked' && mv supercronic "dist/supercronic-${GOOS}-${arch}"; done
pushd dist
ls -lah *
file *
sha1sum *
sha256sum *
popd

0 comments on commit 0c38fad

Please sign in to comment.