♻️ (cron.go): refactor cron job scheduling to use robfig/cron instead… #39
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: Go Test with PostgreSQL | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: testdb | |
options: >- | |
--health-cmd "pg_isready -U postgres" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.22' | |
- name: Install dependencies | |
run: go mod download | |
- name: Wait for PostgreSQL to be ready | |
run: | | |
until pg_isready -h localhost -p 5432 -U postgres; do | |
echo "Waiting for PostgreSQL to be ready..." | |
sleep 1 | |
done | |
- name: Run tests | |
env: | |
ENV: test | |
DATABASE_TEST_URL: postgresql://postgres:password@localhost:5432/testdb?sslmode=disable | |
run: | | |
curl -L https://github.com/golang-migrate/migrate/releases/download/v4.17.1/migrate.linux-amd64.tar.gz | tar xvz | |
mv migrate /usr/local/bin/ | |
make migration-up-test | |
go test -v ./... |