Merge remote-tracking branch 'origin/main' into 46-feature-mod-goqu-t… #75
Workflow file for this run
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: "Codecov Go test" | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*.*.*' | |
paths: | |
- '.github/workflows/codecov.yml' | |
- 'src/**' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/codecov.yml' | |
- 'src/**' | |
env: | |
UPDATER_DIR: "src/updater" | |
API_DIR: "src/api" | |
KEY_MAN_DIR: "src/key_management" | |
SRC_DIR: "src" | |
jobs: | |
coverage-updater: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:16 | |
env: | |
POSTGRES_USER: app | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: unittest | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
cache-dependency-path: | | |
src/go.sum | |
- name: Run migration | |
working-directory: ${{ env.UPDATER_DIR }} | |
shell: bash -l {0} | |
run: | | |
go install github.com/pressly/goose/v3/cmd/goose@latest | |
$(go env GOPATH)/bin/goose --dir database/migrations/ postgres "host=localhost user=app password=password dbname=unittest sslmode=disable" up | |
- name: Build | |
working-directory: ${{ env.UPDATER_DIR }} | |
run: go build -v ./... | |
- name: Test | |
working-directory: ${{ env.UPDATER_DIR }} | |
env: | |
COV_FILE_NAME: coverage.txt | |
MODE: atomic | |
run: go test -v -race -coverprofile=${{ env.COV_FILE_NAME }} -covermode=${{ env.MODE }} ./... | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
flags: smart-tests | |
verbose: true | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
coverage-api: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:16 | |
env: | |
POSTGRES_USER: app | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: unittest | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
cache-dependency-path: | | |
src/go.sum | |
- name: Run migration | |
working-directory: ${{ env.API_DIR }} | |
shell: bash -l {0} | |
run: | | |
go install github.com/pressly/goose/v3/cmd/goose@latest | |
$(go env GOPATH)/bin/goose --dir database/migrations/ postgres "host=localhost user=app password=password dbname=unittest sslmode=disable" up | |
- name: Build | |
working-directory: ${{ env.API_DIR }} | |
run: go build -v ./... | |
- name: Test | |
working-directory: ${{ env.API_DIR }} | |
env: | |
COV_FILE_NAME: coverage.txt | |
MODE: atomic | |
run: go test -v -race -coverprofile=${{ env.COV_FILE_NAME }} -covermode=${{ env.MODE }} ./... | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
flags: smart-tests | |
verbose: true | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
coverage-key-manager: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:16 | |
env: | |
POSTGRES_USER: app | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: unittest | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
cache-dependency-path: | | |
src/go.sum | |
- name: Run migration | |
working-directory: ${{ env.SRC_DIR }} | |
shell: bash -l {0} | |
env: | |
PSQL_HOSTNAME: localhost | |
DATABASE: unittest | |
run: | | |
go mod download | |
go run cmd/migration.go | |
- name: Build | |
working-directory: ${{ env.KEY_MAN_DIR }} | |
run: go build -v ./... | |
- name: Test | |
working-directory: ${{ env.KEY_MAN_DIR }} | |
env: | |
COV_FILE_NAME: coverage.txt | |
MODE: atomic | |
run: go test -v -race -coverprofile=${{ env.COV_FILE_NAME }} -covermode=${{ env.MODE }} ./... | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
flags: smart-tests | |
verbose: true | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |