Skip to content

Commit

Permalink
Migrate from Travis CI to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
supercaracal committed Jan 25, 2020
1 parent 29326f9 commit 4553032
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 38 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
name: CD
on:
push:
tags:
- "v*"
jobs:
release:
name: Release
timeout-minutes: 5
strategy:
matrix:
os: ["ubuntu-latest"]
go-ver: ["1.13"]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v1

- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-ver }}

- name: Add $GOPATH/bin to $PATH
run: echo "::add-path::$(go env GOPATH)/bin"

- name: Install goxz
run: |
wget https://github.com/Songmu/${PKG_NAME}/releases/download/${PKG_VER}/${PKG_NAME}_${PKG_VER}_${GOOS}_${GOARCH}.tar.gz
tar zxf ${PKG_NAME}_${PKG_VER}_${GOOS}_${GOARCH}.tar.gz
mkdir -p $(go env GOPATH)/bin
mv ${PKG_NAME}_${PKG_VER}_${GOOS}_${GOARCH}/${PKG_NAME} $(go env GOPATH)/bin/
env:
PKG_NAME: goxz
PKG_VER: v0.6.0
GOOS: linux
GOARCH: amd64

- name: Install ghr
run: |
wget https://github.com/tcnksm/${PKG_NAME}/releases/download/${PKG_VER}/${PKG_NAME}_${PKG_VER}_${GOOS}_${GOARCH}.tar.gz
tar zxf ${PKG_NAME}_${PKG_VER}_${GOOS}_${GOARCH}.tar.gz
mkdir -p $(go env GOPATH)/bin
mv ${PKG_NAME}_${PKG_VER}_${GOOS}_${GOARCH}/${PKG_NAME} $(go env GOPATH)/bin/
env:
PKG_NAME: ghr
PKG_VER: v0.13.0
GOOS: linux
GOARCH: amd64

- name: Cross Compile
run: make cross-compile

- name: Create Release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Assets
run: make upload-assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: CI
on: [push]
jobs:
test:
name: Test
timeout-minutes: 5
strategy:
matrix:
os: ["ubuntu-latest"]
go-ver: ["1.13"]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v1

- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-ver }}

- name: Add $GOPATH/bin to $PATH
run: echo "::add-path::$(go env GOPATH)/bin"

- name: Get dependencies
run: go get golang.org/x/lint/golint

- name: Test
run: make test

- name: Lint
run: make lint
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mackerel-plugin-solrdih
main
__debug_bin
/dist/
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mackerel-plugin-solrdih [![Build Status](https://travis-ci.org/supercaracal/mackerel-plugin-solrdih.svg?branch=master)](https://travis-ci.org/supercaracal/mackerel-plugin-solrdih)
mackerel-plugin-solrdih ![](https://github.com/supercaracal/mackerel-plugin-solrdih/workflows/CI/badge.svg) ![](https://github.com/supercaracal/mackerel-plugin-solrdih/workflows/CD/badge.svg)
=====================

Apache Solr DataImportHandler status metrics plugin for mackerel.io agent.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module mackerel-plugin-solrdih

go 1.12
go 1.13

require (
github.com/mackerelio/go-mackerel-plugin-helper v0.0.0-20190712052147-cc61b45daff1
Expand Down
31 changes: 20 additions & 11 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
SHELL := /bin/bash
SHELL := /bin/bash
owner_id := supercaracal
app_name := mackerel-plugin-solrdih
latest_tag := $(shell git describe --abbrev=0 --tags)

all:
@$(MAKE) --no-print-directory lint
@$(MAKE) --no-print-directory test
@$(MAKE) --no-print-directory build
all: build test lint

build: mackerel-plugin-solrdih

mackerel-plugin-solrdih: main.go
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o $@
go build -ldflags="-s -w" -trimpath -o $@

test:
go test

lint:
@go vet
@golint -set_exit_status
go vet
golint -set_exit_status

test:
@go test
clean:
@rm -f mackerel-plugin-solrdih main

cross-compile:
goxz -d dist/${latest_tag} -z -os windows,darwin,linux -arch amd64,386

upload-assets:
ghr -u ${owner_id} -r ${app_name} ${latest_tag} dist/${latest_tag}

.PHONY: all build lint test
.PHONY: all build test lint clean cross-compile upload-assets
7 changes: 0 additions & 7 deletions release.sh

This file was deleted.

0 comments on commit 4553032

Please sign in to comment.