Skip to content

Commit

Permalink
refactor: testing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
shikharish committed Dec 24, 2023
1 parent 5afef69 commit 6dbdfeb
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 50 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/test_and_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ on:

jobs:
test_and_lint:
env:
BACKEND_PORT: 8080
DATABASE_HOST: localhost
DATABASE_PORT: 5432
DATABASE_NAME: testDb
DATABASE_USERNAME: user
DATABASE_PASSWORD: pass

runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -22,7 +30,10 @@ jobs:
go-version: ${{ matrix.go-version }}

- name: Test
run: ./tests/run_tests.sh
run: |
docker compose -f docker-compose.yaml up --build -d
go test ./... -p 1
docker compose -f docker-compose.yaml down
- name: Lint
uses: golangci/golangci-lint-action@v3
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ require (
github.com/rs/cors v1.10.1
github.com/rs/zerolog v1.28.0
gorm.io/driver/postgres v1.5.2
gorm.io/driver/sqlite v1.5.2
gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55
)

Expand All @@ -21,7 +20,6 @@ require (
github.com/jinzhu/now v1.1.5 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-sqlite3 v1.14.17 // indirect
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZb
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM=
github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand All @@ -49,7 +47,5 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gorm.io/driver/postgres v1.5.2 h1:ytTDxxEv+MplXOfFe3Lzm7SjG09fcdb3Z/c056DTBx0=
gorm.io/driver/postgres v1.5.2/go.mod h1:fmpX0m2I1PKuR7mKZiEluwrP3hbs+ps7JIGMUBpCgl8=
gorm.io/driver/sqlite v1.5.2 h1:TpQ+/dqCY4uCigCFyrfnrJnrW9zjpelWVoEVNy5qJkc=
gorm.io/driver/sqlite v1.5.2/go.mod h1:qxAuCol+2r6PannQDpOP1FP6ag3mKi4esLnB/jHed+4=
gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55 h1:sC1Xj4TYrLqg1n3AN10w871An7wJM0gzgcm8jkIkECQ=
gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
11 changes: 0 additions & 11 deletions tests/.env

This file was deleted.

2 changes: 1 addition & 1 deletion tests/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func expectResponseJSONBodyToBe[T comparable](t *testing.T, res *httptest.Respon
}

func setTestDB() *gorm.DB {
_ = godotenv.Load(".env")
_ = godotenv.Load("../.env")
db, _ := utils.GetDB()
_ = utils.MigrateModels(db)

Expand Down
17 changes: 0 additions & 17 deletions tests/docker-compose.test.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions tests/run_tests.sh

This file was deleted.

0 comments on commit 6dbdfeb

Please sign in to comment.