diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d20ed2b..7bd86f2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,9 +13,9 @@ jobs: postgres: image: postgres:latest env: - POSTGRES_USER: postgres + POSTGRES_USER: ${{ secrets.DB_USER }} POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} - POSTGRES_DB: librarymanagementsystem_test + POSTGRES_DB: ${{ secrets.DB_NAME }} ports: - 5432:5432 @@ -31,6 +31,14 @@ jobs: - name: Install dependencies run: go mod download + - name: Create .env.test file + run: | + echo "DB_HOST=${{ secrets.DB_HOST }}" >> .env.test + echo "DB_PORT=${{ secrets.DB_PORT }}" >> .env.test + echo "DB_USER=${{ secrets.DB_USER }}" >> .env.test + echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> .env.test + echo "DB_NAME=${{ secrets.DB_NAME }}" >> .env.test + - name: Start PostgreSQL and wait for connection run: | sudo apt-get update @@ -47,4 +55,4 @@ jobs: run: ./scripts/create_migrations.sh - name: Run tests - run: go test -v ./... -coverprofile=coverage.txt -covermode=atomic + run: go test -v ./... -covermode=atomic