* Use action insted download binary file * Update ci * Add config option * Use pre-built docker image for golangci-lint-action * Remove pre build docker action * Update action name * Remove env * Update ci file * Add working directory * Change GITHUB_WORKSPACE * Update ci file * Fix ci * Comment golangci-lint-action * Update working-directory * Fix path * Update ci-build.yml * Update path * Revert changes * Update .golangci.yml * Add new path for triggers ci * Separate steps * Add working-directory * Add test pwd and ls * Fix working directory * Update script for linting in Dockerfile * Move .golangci.yml to dir backend * Delete unnecessary word * Remove multiline string * Reformat multiline strings to single * Update disable-all option
68 lines
1.9 KiB
YAML
68 lines
1.9 KiB
YAML
name: test_backend
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
tags:
|
|
paths:
|
|
- '.github/workflows/ci-test-backend.yml'
|
|
- 'backend/**'
|
|
- '!backend/scripts/**'
|
|
- '.golangci.yml'
|
|
pull_request:
|
|
paths:
|
|
- '.github/workflows/ci-test-backend.yml'
|
|
- 'backend/**'
|
|
- '!backend/scripts/**'
|
|
- '.golangci.yml'
|
|
|
|
jobs:
|
|
backend:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- 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: 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
|
|
cd ../_example/memory_store
|
|
go test -race ./...
|
|
|
|
- name: install golangci-lint and goveralls
|
|
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/mattn/goveralls
|
|
|
|
- name: run backend linters
|
|
run: $GITHUB_WORKSPACE/golangci-lint run --config .golangci.yml ./...
|
|
working-directory: backend
|
|
|
|
- name: run linters for examples
|
|
run: $GITHUB_WORKSPACE/golangci-lint run --config ${GITHUB_WORKSPACE}/backend/.golangci.yml ./...
|
|
working-directory: backend/_example/memory_store
|
|
|
|
- name: submit coverage
|
|
run: $(go env GOPATH)/bin/goveralls -service="github" -coverprofile=$GITHUB_WORKSPACE/profile.cov
|
|
working-directory: backend
|
|
env:
|
|
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|