From 75a44678b6373651c24cae3a68246b339b5957ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franc=CC=A7ois=20Hodierne?= Date: Wed, 22 Nov 2023 15:44:42 +0100 Subject: [PATCH] add depcheck --- .github/workflows/ci.yml | 49 ++++++++++++++++++++++++++++++++++++++++ package.json | 8 ++++++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b70f5276..ed750e2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,8 @@ jobs: lint: runs-on: ubuntu-latest + timeout-minutes: 15 + steps: - name: Update apt run: sudo apt-get update || exit 0 @@ -58,6 +60,8 @@ jobs: prettier: runs-on: ubuntu-latest + timeout-minutes: 15 + steps: - name: Update apt run: sudo apt-get update || exit 0 @@ -96,9 +100,54 @@ jobs: - run: npm run prettier:check + depcheck: + runs-on: ubuntu-latest + + timeout-minutes: 15 + + steps: + - name: Update apt + run: sudo apt-get update || exit 0 + + - name: Install graphicsmagick + run: sudo apt-get install -y graphicsmagick + + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version-file: 'package.json' + + # Npm cache + - name: Restore .npm cache + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-npm-cache-${{ github.sha }} + restore-keys: | + - ${{ runner.os }}-npm-cache-${{ github.sha }} + - ${{ runner.os }}-npm-cache- + + - name: Restore node_modules + uses: actions/cache@v3 + id: node-modules + with: + path: node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }} + + - name: Install dependencies + if: steps.node-modules.outputs.cache-hit != 'true' + run: npm ci --prefer-offline --no-audit + + - run: npm run depcheck + test: runs-on: ubuntu-latest + timeout-minutes: 30 + services: redis: image: redis diff --git a/package.json b/package.json index ba1f6d21..5714f485 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,8 @@ "prettier:write": "npm run prettier -- --write", "start": "node dist/server", "test:server": "TZ=UTC ./scripts/run_test.sh", - "prepare": "husky install" + "prepare": "husky install", + "depcheck": "npx depcheck" }, "devDependencies": { "@babel/cli": "^7.23.4", @@ -98,5 +99,10 @@ "cacheDirectories": [ "node_modules" ], + "depcheck": { + "ignores": [ + "jest" + ] + }, "heroku-run-build-script": true }