This commit is contained in:
59
.github/workflows/ci.yml
vendored
Normal file
59
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
name: ai-ops-ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
pull_request:
|
||||
branches: [ main, master ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
env:
|
||||
POSTGRES_USER: aiops
|
||||
POSTGRES_PASSWORD: aiops123
|
||||
POSTGRES_DB: ai_ops
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd="pg_isready -U aiops -d ai_ops"
|
||||
--health-interval=10s
|
||||
--health-timeout=5s
|
||||
--health-retries=5
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
ports:
|
||||
- 6379:6379
|
||||
options: >-
|
||||
--health-cmd="redis-cli ping"
|
||||
--health-interval=10s
|
||||
--health-timeout=5s
|
||||
--health-retries=5
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.22.x'
|
||||
cache: true
|
||||
|
||||
- name: Verify formatting
|
||||
run: test -z "$(gofmt -l .)"
|
||||
|
||||
- name: Build
|
||||
run: go build -buildvcs=false ./...
|
||||
|
||||
- name: Test
|
||||
run: go test -buildvcs=false -race ./...
|
||||
|
||||
- name: Apply migrations smoke test
|
||||
env:
|
||||
PGPASSWORD: aiops123
|
||||
run: |
|
||||
psql -h localhost -U aiops -d ai_ops -f tech/migrations/000001_init_schema.up.sql
|
||||
psql -h localhost -U aiops -d ai_ops -f tech/migrations/000002_add_notification_logs.up.sql
|
||||
Reference in New Issue
Block a user