From 1e26707afcecfe04f15b5d18a425411e6ef03d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej?= <46246339+BartekCK@users.noreply.github.com> Date: Sat, 21 Jan 2023 00:22:43 +0100 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=92=82=E2=80=8D=E2=99=82?= =?UTF-8?q?=EF=B8=8F=20create=20test=20CI=20(#2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: :guardsman: update tsconfig and package.json * chore: :guardsman: add test CI --- .github/workflows/test.yml | 51 ++++++++++++++++++++++++++++++++++++++ package.json | 2 ++ tsconfig.json | 2 +- 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..6b0f76c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,51 @@ +name: App testing + +on: + push: + branches: [ "develop", "master" ] + pull_request: + branches: [ "develop", "master" ] + +jobs: + test: + + services: + postgres: + image: postgres + ports: + - "5432:5432" + env: + POSTGRES_USER: user123 + POSTGRES_PASSWORD: root + POSTGRES_DB: test + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + + 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' + + - name: Install all dependencies + run: npm ci + + - name: Check typescript types + run: npm run check-types + + - name: Check lint + run: npm run lint + + - name: Run test + run: npm test diff --git a/package.json b/package.json index 552abcf..b07f39e 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,8 @@ "scripts": { "dev": "echo \"Error: no test specified\" && exit 1", "build": "rimraf ./dist && tsc", + "lint": "eslint \"src/**/*.ts\" --fix --quiet", + "check-types": "tsc --noEmit", "pretest": "NODE_ENV=test npm run migrations:latest", "test": "NODE_ENV=test jest --runInBand", "posttest": "NODE_ENV=test npm run migrations:rollback:all", diff --git a/tsconfig.json b/tsconfig.json index 2ab3991..0dadb4f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -68,6 +68,6 @@ "skipLibCheck": true, /* Skip type checking of declaration files. */ "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ }, - "exclude": ["node_modules", "dist"], + "exclude": ["node_modules", "dist", "**/__tests__", "**/migrations"], "include": ["src"] }