Skip to content

Merge pull request #38 from kynmh69/35-feature-add-key-auth #83

Merge pull request #38 from kynmh69/35-feature-add-key-auth

Merge pull request #38 from kynmh69/35-feature-add-key-auth #83

Workflow file for this run

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.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.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.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.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 }}