name: backend on: push: branches: tags: paths: - ".github/workflows/ci-test-backend.yml" - "backend/**" - "!backend/scripts/**" - "!**.md" pull_request: types: [opened, reopened] paths: - ".github/workflows/ci-test-backend.yml" - "backend/**" - "!backend/scripts/**" - "!**.md" jobs: test: name: Test & Coverage runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: debug if needed run: if [[ "$DEBUG" == "true" ]]; then env; fi env: DEBUG: ${{secrets.DEBUG}} - name: install go uses: actions/setup-go@v3 with: go-version: "1.20" - name: test and build 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 go build -race ./... working-directory: backend/app env: TZ: "America/Chicago" - name: test examples run: | go test -race ./... go build -race ./... working-directory: backend/_example/memory_store env: TZ: "America/Chicago" - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: version: latest working-directory: backend/app - name: golangci-lint on example directory uses: golangci/golangci-lint-action@v3 with: version: latest args: --config ../../.golangci.yml working-directory: backend/_example/memory_store - name: submit coverage run: | go install github.com/mattn/goveralls@latest goveralls -service="github" -coverprofile=$GITHUB_WORKSPACE/profile.cov working-directory: backend env: COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}