Skip to content

Commit

Permalink
Add build and test workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
SaadAhmedGit committed Dec 23, 2023
1 parent b0249aa commit 0d11d31
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build

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: Build
run: go build ./cmd/formify/main.go
12 changes: 3 additions & 9 deletions .github/workflows/go.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go
name: Test

on:
push:
Expand All @@ -21,9 +18,6 @@ jobs:
with:
go-version: '1.21.3'

- name: Build
run: go build ./cmd/formify/main.go

- name: Start PostgreSQL
run: |
docker run -d \
Expand All @@ -34,11 +28,11 @@ jobs:
-p 5432:5432 \
postgres
- name: Test
- 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/...
run: go test -v ./tests/...

0 comments on commit 0d11d31

Please sign in to comment.