diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..1ac1a0f --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +name: Run unit tests + +on: + pull_request: + branches: [ develop ] + +jobs: + + test: + name: Test + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:14-alpine + env: + POSTGRES_USER: root + POSTGRES_PASSWORD: secret + POSTGRES_DB: eth + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run build --if-present + - run: npm run test:cover \ No newline at end of file diff --git a/package.json b/package.json index 15a038d..42c7a02 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "jest --config ./test/jest-e2e.json", "test:int": "jest -i --no-cache --watch --config jest-int.json", - "migrate": "npx sequelize-cli db:migrate --migrations-path=src/migrations" + "migrate": "npx sequelize-cli db:migrate --migrations-path=src/migrations", + "test:cover": "jest -i --no-cache --config jest-int.json" }, "dependencies": { "@nestjs/common": "^10.3.4",