Merge pull request #64 from quangdangfit/cart #125
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: master | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
env: | |
environment: production | |
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: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |