Skip to content

Commit

Permalink
Merge pull request #19 from martines3000/feat/improve-node-version-ha…
Browse files Browse the repository at this point in the history
…ndling
  • Loading branch information
vmidyllic authored Apr 8, 2024
2 parents 8b79955 + 83001ed commit f047396
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 28 deletions.
40 changes: 16 additions & 24 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 4 additions & 3 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.11.1
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f047396

Please sign in to comment.