@@ -0,0 +1,44 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
env:
|
||||
POSTGRES_DB: gardomatic
|
||||
POSTGRES_USER: gardomatic
|
||||
POSTGRES_PASSWORD: gardomatic
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U gardomatic"
|
||||
--health-interval 2s
|
||||
--health-timeout 5s
|
||||
--health-retries 15
|
||||
env:
|
||||
GARDOMATIC_DB_DSN: postgres://gardomatic:gardomatic@localhost:5432/gardomatic?sslmode=disable
|
||||
GARDOMATIC_TEST_DB_DSN: postgres://gardomatic:gardomatic@localhost:5432/gardomatic?sslmode=disable
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- name: Install migrate
|
||||
run: go install -tags postgres github.com/golang-migrate/migrate/v4/cmd/migrate@latest
|
||||
- name: Migrate database
|
||||
run: migrate -path ./internal/storage/postgres/migrations -database "$GARDOMATIC_DB_DSN" up
|
||||
- name: Verify module and source
|
||||
run: |
|
||||
go mod tidy -diff
|
||||
go vet ./...
|
||||
- name: Test with race detector
|
||||
run: go test -race -count=1 ./...
|
||||
- name: Build all binaries
|
||||
run: make build/all
|
||||
@@ -0,0 +1,22 @@
|
||||
name: CLA
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
acceptance:
|
||||
name: Verify CLA acceptance
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check pull request declaration
|
||||
env:
|
||||
PR_BODY: ${{ github.event.pull_request.body }}
|
||||
run: |
|
||||
declaration='^- \[[xX]\] \*\*I have read and agree to the Gardomatic Contributor License Agreement,'
|
||||
if ! grep -Eq "$declaration" <<< "$PR_BODY"; then
|
||||
echo "The pull request author must accept CLA.md using the checkbox in the pull request template."
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user