Add build and test workflows #1
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: Test | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21.3' | |
- name: Start PostgreSQL | |
run: | | |
docker run -d \ | |
--name postgres \ | |
-e POSTGRES_DB=formify_test \ | |
-e POSTGRES_USER=gh_action_user \ | |
-e POSTGRES_PASSWORD=gh_action_user_password \ | |
-p 5432:5432 \ | |
postgres | |
- name: Run tests | |
env: | |
TEST_DB_HOST: localhost | |
TEST_DB_PORT: 5432 | |
TEST_DB_NAME: formify_test | |
TEST_DB_USER: gh_action_user | |
TEST_DB_PASSWORD: gh_action_user_password | |
run: go test -v ./tests/... |