diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7739e52..39b88d8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,44 +1,36 @@ -name: RUN ES LINT ANS TESTS +name: Build, Lint and Test on: push jobs: build: - strategy: - matrix: - version: [16.15, 18] timeout-minutes: 7 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 with: - node-version: ${{ matrix.version }} + node-version: 'lts/*' - name: Cache node modules - id: cache-npm - uses: actions/cache@v3 - env: - cache-name: cache-node-modules + uses: actions/cache@v4 with: # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- + key: cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} - - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} - name: List the state of node modules - continue-on-error: true - run: npm list - - name: Install modules - run: npm install + - name: Install dependencies + run: npm ci - name: Run Prettier - run: npm run format + run: npm run format:check - name: Run ESLint - run: npm run lint + run: npm run lint:check + + - name: Build + run: npm run build - name: Run Tests run: npm run test diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index f81a322..aca357e 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -8,11 +8,12 @@ jobs: publish-npm: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: 16 + node-version-file: '.nvmrc' registry-url: https://registry.npmjs.org/ + cache: 'npm' - run: npm ci - run: npm run build - run: npm publish diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..ee09fac --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v20.11.1 diff --git a/package.json b/package.json index dc04c8f..35f5a55 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,9 @@ "clean": "rimraf ./dist", "test": "jest", "lint": "eslint --fix --ext .js,.ts src/**", - "format": "prettier --config .prettierrc './**/*.ts' --write" + "lint:check": "eslint --ext .js,.ts src/**", + "format": "prettier --config .prettierrc './**/*.ts' --write", + "format:check": "prettier --config .prettierrc './**/*.ts' --check" }, "repository": { "type": "git",