From 5704bf2fea798191dba9a5672a083d5dbb905aa6 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 26 Mar 2024 08:08:53 +0200 Subject: [PATCH] Update CI * limit on main pushes * update actions * drop coveralls parallel --- .github/workflows/lint.yml | 36 +++++++++++++++++++++++ .github/workflows/test.yml | 60 +++++++++++++++----------------------- package.json | 4 ++- 3 files changed, 63 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..5be0f90 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,36 @@ +name: Lint + +on: + push: + branches: + - main + - "!dependabot/**" + pull_request: + workflow_dispatch: + +env: + FORCE_COLOR: 2 + NODE: 20 # The Node.js version to run lint on + +jobs: + run: + name: Lint + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE }} + cache: npm + + - name: Install npm dependencies + run: npm ci + + - name: Run lint + run: npm run lint diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ff8fe23..01b874c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,61 +1,49 @@ name: Tests -on: [push, pull_request] + +on: + push: + branches: + - main + - "!dependabot/**" + pull_request: + workflow_dispatch: + env: - CI: true + FORCE_COLOR: 2 + NODE_COV: 20 # The Node.js version to run coveralls on jobs: - run: + test: name: Node ${{ matrix.node }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - node: [18,20] + node: [18, 20] os: [ubuntu-latest, windows-latest] steps: - name: Clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 + with: + persist-credentials: false - name: Set up Node.js - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - - - run: node --version - - run: npm --version - - - name: Set up npm cache - uses: actions/cache@v2 - with: - path: ~/.npm - key: ${{ runner.os }}-node-v${{ matrix.node }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }} - restore-keys: | - ${{ runner.OS }}-node-v${{ matrix.node }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }} - ${{ runner.OS }}-node-v${{ matrix.node }}- + architecture: ${{ matrix.architecture }} + cache: npm - name: Install npm dependencies run: npm ci - name: Run tests - run: npm test + run: npm run jest - - name: Coveralls Parallel - uses: coverallsapp/github-action@master - env: - NODE_COVERALLS_DEBUG: 1 + - name: Run Coveralls + uses: coverallsapp/github-action@v2 + if: startsWith(matrix.os, 'ubuntu') && matrix.node == env.NODE_COV with: - github-token: ${{ secrets.github_token }} - flag-name: run-${{ matrix.os }}-${{ matrix.node }} - parallel: true - - finish: - needs: run - runs-on: ubuntu-latest - steps: - - name: Coveralls Finished - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.github_token }} - parallel-finished: true + github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/package.json b/package.json index e37cd3c..8c7c384 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,9 @@ "type": "module", "scripts": { "jest": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage --runInBand --detectOpenHandles", - "xo": "xo --fix", + "lint": "xo", + "xo": "xo", + "fix": "xo --fix", "test": "npm run xo && npm run jest" }, "files": [