Skip to content

More unittest

More unittest #110

Workflow file for this run

name: master
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
ci:
runs-on: ubuntu-latest
env:
environment: testing
database_uri: postgres://postgres:test@localhost:5432/postgres
redis_uri: localhost:6379
services:
postgres:
image: postgres:12
env:
POSTGRES_PASSWORD: "test"
ports:
- 5432:5432
redis:
image: redis:alpine
ports:
- 6379:6379
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Set up Golang
uses: actions/setup-go@v4
with:
go-version: 1.20.x
- name: Setup Golang caches
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- name: Install dependencies
run: go mod download
- name: Build
run: go build -o main cmd/api
env:
GOOS: linux
GOARCH: amd64
CGO_ENABLED: 0
- name: Run unit tests
run: make unittest
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}