Skip to content

Commit

Permalink
Replace travis job with github action. (#66)
Browse files Browse the repository at this point in the history
* Replace travis job with github action.

* Add action rule in Makefile to perform the same steps as github action.
Github actions also run on pull_request.
Add help option to Makefile.

* Add missing regenerate step.
  • Loading branch information
jmrtt committed Oct 4, 2020
1 parent 909238c commit a1621d0
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 26 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: build

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
env:
working-directory: ./src/github.com/awalterschulze/gographviz

steps:
- name: Set GOPATH
run: |
echo "##[set-env name=GOPATH;]$(dirname $GITHUB_WORKSPACE)/gographviz"
echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/gographviz/bin"
shell: bash

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.14'

- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
path: src/github.com/awalterschulze/gographviz

- name: Install dependencies
run: make dependencies
working-directory: ${{env.working-directory}}

- name: Run regenerate
run: make regenerate
working-directory: ${{env.working-directory}}

- name: Run build
run: make build
working-directory: ${{env.working-directory}}

- name: Run checkers
run: make checkers
working-directory: ${{env.working-directory}}

- name: Run testing
run: make test
working-directory: ${{env.working-directory}}
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

33 changes: 26 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
regenerate:
.PHONY: help regenerate test dependencies build checkers action

# Prefer tools that we've installed
export PATH := $(HOME)/go/bin:$(PATH)

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

regenerate: ## Re-generate lexers and parsers and pass through goimports
go get github.com/goccmack/gocc
go install github.com/goccmack/gocc
gocc -zip -o ./internal/ dot.bnf
gocc -zip -o ./internal/ dot.bnf
find . -type f -name '*.go' | xargs goimports -w
go mod tidy

test:
test: ## Perform package tests
go test ./...

travis:
make regenerate
go build ./...
go test ./...
dependencies: ## Grab necessary dependencies for checkers
go version
go get golang.org/x/tools/cmd/goimports
go get github.com/kisielk/errcheck
go get -u golang.org/x/lint/golint
go mod tidy

build: ## Perform build process
go build .

checkers: ## Run all checkers (errcheck, gofmt and golint)
errcheck -ignore 'fmt:[FS]?[Pp]rint*' ./...
gofmt -l -s -w .
golint -set_exit_status
git diff --exit-code

action: dependencies regenerate build test checkers ## Run steps of github action
5 changes: 3 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ output := graph.String()
### Installation ###
go get github.com/awalterschulze/gographviz

### Tests ###
### Build and Tests ###

[![Build Status](https://github.com/awalterschulze/gographviz/workflows/build/badge.svg)](https://github.com/awalterschulze/gographviz/actions)

[![Build Status](https://travis-ci.org/awalterschulze/gographviz.svg?branch=master)](https://travis-ci.org/awalterschulze/gographviz)

### Users ###

Expand Down
7 changes: 0 additions & 7 deletions install-godeps.sh

This file was deleted.

60 changes: 60 additions & 0 deletions internal/token/token.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a1621d0

Please sign in to comment.