Skip to content

Commit

Permalink
feat(ci): migrate to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rande committed Feb 25, 2021
1 parent de07f04 commit 39fbd97
Show file tree
Hide file tree
Showing 16 changed files with 105 additions and 760 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Tests

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

jobs:

build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11.6-alpine
env:
# POSTGRES_PASSWORD: password
POSTGRES_DB: gonode
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15

- name: Install
run: |
#go get github.com/wadey/gocovmerge
go get github.com/mattn/goveralls
#go get golang.org/x/tools/cmd/cover
#go get golang.org/x/tools/cmd/goimports
go get -u github.com/jteeuwen/go-bindata/...
./app/assets/bindata.sh
go get ./...
- name: Test
run: |
make test
- name: Convert coverage to lcov
uses: jandelgado/gcov2lcov-action@v1.0.5
with:
infile: data/coverage.out
outfile: data/coverage.lcov

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: data/coverage.lcov
74 changes: 0 additions & 74 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ install:

test:
./app/assets/bindata.sh
echo "mode: atomic" > data/coverage.out
mkdir -p data
echo "mode: atomic" > data/coverage.out

GONODE_TEST_OFFLINE=true GOPATH=${GOPATH} go test -v -failfast -covermode=atomic -coverprofile=data/coverage_core.out $(GONODE_CORE)
GOPATH=${GOPATH} go test -v -failfast -covermode=atomic -coverprofile=data/coverage_modules.out $(GONODE_MODULES)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Go Node
=======

[![Build Status](https://travis-ci.org/rande/gonode.svg?branch=master)](https://travis-ci.org/rande/gonode)
[![Build Status](https://github.com/rande/gonode/actions/workflows/go.yml/badge.svg)](https://github.com/rande/gonode/actions/workflows/go.yml)
[![Coverage Status](https://coveralls.io/repos/github/rande/gonode/badge.svg)](https://coveralls.io/github/rande/gonode)

A prototype to store dynamic node inside a PostgreSQL database with the JSONb storage column.
Expand Down
16 changes: 11 additions & 5 deletions app/assets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,26 @@ Please note, the ``go-bindata`` must be run from ``GOPATH`` folder, so the asset
The ``Makefile`` lines to generate the file will be:

```Makefile
GO_PATH = $(shell go env GOPATH)
GO_BINDATA_PATHS = $(GO_PATH)/src/github.com/rande/gonode/modules/... $(GO_PATH)/src/github.com/rande/gonode/explorer/dist/...
GO_BINDATA_IGNORE = "(.*)\.(go|DS_Store)"
GO_BINDATA_OUTPUT = $(GO_PATH)/src/github.com/rande/gonode/assets/bindata.go
GO_BINDATA_PACKAGE = assets

bin:
app/assets/bindata.sh
cd $(GO_PATH)/src && go-bindata -debug -o $(GO_BINDATA_OUTPUT) -pkg $(GO_BINDATA_PACKAGE) -ignore $(GO_BINDATA_IGNORE) $(GO_BINDATA_PATHS)

run: bin
go run app/main.go server -config=app/server.toml.dist
cd commands && go run main.go server -config=../server.toml.dist

build: bin
build:
rm -rf dist && mkdir dist
app/assets/bindata.sh
go build -a -o ./dist/gonode app/main.go
cd $(GO_PATH)/src && go-bindata -o $(GO_BINDATA_OUTPUT) -pkg $(GO_BINDATA_PACKAGE) -ignore $(GO_BINDATA_IGNORE) $(GO_BINDATA_PATHS)
cd commands && go build -a -o ../dist/gonode


Usage
-----

Just import the package ``assets`` and refer to the ``go-bindata`` documentation.

30 changes: 26 additions & 4 deletions app/assets/bindata.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
#!/usr/bin/env bash

GOPATH=`go env GOPATH`
GO_BINDATA_PATHS="${GOPATH}/src/github.com/rande/gonode/modules/..."
GO_BINDATA_IGNORE="(.*)\.(go|DS_Store)"
GO_BINDATA_OUTPUT="${GOPATH}/src/github.com/rande/gonode/app/assets/bindata.go"
#GO_BINDATA_PATHS="${GOPATH}/src/github.com/rande/gonode/modules/..."
if [ -d ${GOPATH}/src/github.com/rande/gonode/modules ]; then
GO_BINDATA_PATHS="${GOPATH}/src/github.com/rande/gonode/modules/..."
GO_BINDATA_OUTPUT="${GOPATH}/src/github.com/rande/gonode/app/assets/bindata.go"
GO_BINDATA_PREFIX="${GOPATH}/src/github.com/rande/gonode"
else
GO_BINDATA_PATHS="./modules/..."
GO_BINDATA_OUTPUT="./app/assets/bindata.go"
GO_BINDATA_PREFIX=`pwd`
fi

GO_BINDATA_IGNORE="(.*)\.(go|DS_Store|jpg)"
GO_BINDATA_PACKAGE="assets"


echo "Generating bindata file..."
cd ${GOPATH}/src && ${GOPATH}/bin/go-bindata -dev -prefix ${GOPATH}/src -o ${GO_BINDATA_OUTPUT} -pkg ${GO_BINDATA_PACKAGE} -ignore ${GO_BINDATA_IGNORE} ${GO_BINDATA_PATHS}
echo "GO_BINDATA_PATHS=${GO_BINDATA_PATHS}"
echo "GO_BINDATA_IGNORE=${GO_BINDATA_IGNORE}"
echo "GO_BINDATA_OUTPUT=${GO_BINDATA_OUTPUT}"
echo "GO_BINDATA_PACKAGE=${GO_BINDATA_PACKAGE}"
echo "GO_BINDATA_PREFIX=${GO_BINDATA_PREFIX}"

${GOPATH}/bin/go-bindata \
-debug \
-prefix ${GO_BINDATA_PREFIX}/ \
-o ${GO_BINDATA_OUTPUT} \
-pkg ${GO_BINDATA_PACKAGE} \
-ignore ${GO_BINDATA_IGNORE} \
${GO_BINDATA_PATHS}

echo "Done!"
43 changes: 0 additions & 43 deletions assets/README.md

This file was deleted.

17 changes: 0 additions & 17 deletions assets/assets.go

This file was deleted.

Loading

0 comments on commit 39fbd97

Please sign in to comment.