tercul-backend/.github/workflows/ci.yml
google-labs-jules[bot] 9a2c77a5ca feat: Establish CI/CD Pipeline with Makefile
This commit introduces a `Makefile` to standardize the build, test, and linting process, as suggested in the `TODO.md` file.

The `Makefile` includes targets for `lint`, `test`, and `test-integration`.

The `.github/workflows/ci.yml` file has been updated to use the `make test-integration` target, simplifying the CI configuration.

The `.github/workflows/cd.yml` file has been updated to be ready for deployment to a staging environment. It now calls a `make deploy-staging` target, which serves as a placeholder for the actual deployment script.

This work addresses the 'Establish a CI/CD Pipeline' task from the `TODO.md`.
2025-09-07 21:20:47 +00:00

87 lines
1.8 KiB
YAML

name: Go CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
test:
name: Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: tercul_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.22"
- name: Check out code
uses: actions/checkout@v4
- name: Install dependencies
run: go mod download
- name: Verify dependencies
run: go mod verify
- name: Run integration tests
run: make test-integration
env:
DB_HOST: localhost
DB_PORT: 5432
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: tercul_test
REDIS_HOST: localhost
REDIS_PORT: 6379
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.txt
flags: unittests
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.22"
- name: Check out code
uses: actions/checkout@v4
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest