Adding service DB in Github action

This is so useful for testing purposes, plus it’s getting easier to do so. Let’s take a look for PostgreSQL and MySQL. Adding PostgreSQL in Github action name: Build on: push jobs: build: runs-on: ubuntu-latest services: # Label used to access the service container postgres: # Docker Hub image image: postgres:13 # Provide the password for postgres env: POSTGRES_USER: root POSTGRES_PASSWORD: test POSTGRES_DB: sqljson # Set health checks to wait until postgres has started options: >---health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 ports: - 5432:5432 steps: - uses: actions/checkout@v2 - name: Setup go uses: actions/setup-go@v2 with: go-version: ^1....

March 5, 2022 · 2 min · Nolan