name: test_backend on: push: branches: tags: paths: - ".github/workflows/ci-test-backend.yml" - "backend/**" - "!backend/scripts/**" - "!**.md" pull_request: paths: - ".github/workflows/ci-test-backend.yml" - "backend/**" - "!backend/scripts/**" - "!**.md" jobs: test-backend: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: debug if needed run: if [[ "$DEBUG" == "true" ]]; then env; fi env: DEBUG: ${{secrets.DEBUG}} - name: install go uses: actions/setup-go@v2 with: go-version: 1.16 - 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.39.0 go get -u github.com/mattn/goveralls - name: test and lint backend run: | go test -race -timeout=60s -covermode=atomic -coverprofile=$GITHUB_WORKSPACE/profile.cov_tmp ./... cat $GITHUB_WORKSPACE/profile.cov_tmp | grep -v "_mock.go" > $GITHUB_WORKSPACE/profile.cov $GITHUB_WORKSPACE/golangci-lint --config ${GITHUB_WORKSPACE}/backend/.golangci.yml run --out-format=github-actions ./... working-directory: backend/app env: GOFLAGS: "-mod=vendor" TZ: "America/Chicago" - name: test and lint examples run: | go version $GITHUB_WORKSPACE/golangci-lint version go test -race ./... $GITHUB_WORKSPACE/golangci-lint --config ${GITHUB_WORKSPACE}/backend/.golangci.yml run --out-format=github-actions ./... working-directory: backend/_example/memory_store env: TZ: "America/Chicago" - 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 }}