73 lines
2.1 KiB
YAML
73 lines
2.1 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
tags:
|
|
pull_request:
|
|
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
|
|
- name: debug if needed
|
|
run: |
|
|
export DEBUG=${DEBUG:-false}
|
|
if [[ "$DEBUG" == "true" ]]; then
|
|
env
|
|
fi
|
|
env:
|
|
DEBUG: ${{secrets.DEBUG}}
|
|
|
|
- name: install go
|
|
uses: actions/setup-go@v1
|
|
with:
|
|
go-version: 1.13
|
|
|
|
- name: build and test backend
|
|
run: |
|
|
export TZ="America/Chicago"
|
|
date
|
|
cd backend/app
|
|
go test -mod=vendor -timeout=60s -covermode=count -coverprofile=$GITHUB_WORKSPACE/profile.cov_tmp ./...
|
|
cat $GITHUB_WORKSPACE/profile.cov_tmp | grep -v "_mock.go" > $GITHUB_WORKSPACE/profile.cov
|
|
|
|
- name: install golangci-lint and coveralls support
|
|
run: |
|
|
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $GITHUB_WORKSPACE v1.20.0
|
|
go get -u github.com/jandelgado/gcov2lcov
|
|
|
|
|
|
- name: run backend linters
|
|
run: |
|
|
cd backend
|
|
$GITHUB_WORKSPACE/golangci-lint run --out-format=tab --disable-all --tests=false --enable=unconvert \
|
|
--enable=megacheck --enable=structcheck --enable=gas --enable=gocyclo --enable=dupl --enable=misspell \
|
|
--enable=unparam --enable=varcheck --enable=deadcode --enable=typecheck \
|
|
--enable=ineffassign --enable=varcheck ./... ;
|
|
|
|
- name: convert coverage to lcov
|
|
run: |
|
|
cd backend
|
|
$(go env GOPATH)/bin/gcov2lcov -infile $GITHUB_WORKSPACE/profile.cov -outfile $GITHUB_WORKSPACE/profile.cov
|
|
|
|
- name: submit to coveralls
|
|
uses: coverallsapp/github-action@v1.0.1
|
|
with:
|
|
github-token: ${{ secrets.github_token }}
|
|
path-to-lcov: coverage.lcov
|
|
#
|
|
# - name: submit coverage
|
|
# run: |
|
|
# cd backend
|
|
# $(go env GOPATH)/bin/goveralls -service="GitHub Action" -coverprofile=$GITHUB_WORKSPACE/profile.cov -repotoken $COVERALLS_TOKEN
|
|
# env:
|
|
# COVERALLS_TOKEN: ${{secrets.COVERALLS_TOKEN}}
|
|
|
|
- name: build docker image
|
|
run: docker build --build-arg SKIP_BACKEND_TEST=true --build-arg CI=github .
|