name: Run tests on: push jobs: container-job: name: Test runs-on: ubuntu-latest # Service containers to run with `container-job` services: # Label used to access the service container postgres: # Docker Hub image image: postgres # Provide the password for postgres env: POSTGRES_USER: postgres POSTGRES_PASSWORD: password POSTGRES_DB: sekret_link_test # 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: - name: Set up Go 1.x uses: actions/setup-go@v5 with: go-version: ^1.16 id: go - name: Check out code into the Go module directory uses: actions/checkout@v4 with: fetch-depth: 0 - name: Get dependencies run: | go get -v -t -d ./... if [ -f Gopkg.toml ]; then curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh dep ensure fi - name: Test env: POSTGRES_URL: "postgres://postgres:password@localhost:5432/sekret_link_test?sslmode=disable" run: make test