This repository has been archived by the owner on Mar 16, 2024. It is now read-only.
Merge pull request #46 from rehabaam/feat/add-coverage #114
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | ||
on: | ||
push: | ||
branches: [ develop ] | ||
pull_request: | ||
branches: [ develop ] | ||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
env: | ||
GO111MODULE: on | ||
steps: | ||
- name: Set up Go 1.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.20 | ||
id: go | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
with: | ||
# Disabling shallow clone is recommended for improving relevancy of reporting | ||
fetch-depth: 0 | ||
# Sonar cloud scan for TDBackend project | ||
- name: SonarCloud Scan | ||
uses: sonarsource/sonarcloud-github-action@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.SQGH_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
# Get Project dependencies | ||
- name: Get dependencies | ||
run: | | ||
if [ -f go.mod ]; then | ||
go mod tidy | ||
go mod verify | ||
go get github.com/ory/go-acc | ||
go get github.com/mattn/goveralls | ||
fi | ||
Get Project dependencies | ||
- name: Create Coverage report | ||
run: | | ||
go install github.com/ory/go-acc@latest | ||
go-acc -o coverage.out ./... -- -timeout 30m | ||
- name: Code coverage | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
path-to-lcov: ${{ github.workspace }}/coverage.out | ||
# GoSec security scanner | ||
- name: Run Gosec Security Scanner | ||
run: | | ||
go install github.com/securego/gosec/v2/cmd/gosec@latest | ||
gosec ./... | ||
- name: Build | ||
run: go build -v . | ||
- name: Test | ||
run: go test -v . |