Skip to content

Commit

Permalink
Refactor GitHub Actions to use single node version
Browse files Browse the repository at this point in the history
Removed individual action.yml files for Node 14, 16 and 18 and replaced them with a single .node-version file. Consolidated and refactored the GitHub Actions workflow in main.yml to incorporate these changes. Workflow is now set to perform lint and test jobs for Node versions defined in the .node-version file matrix.
  • Loading branch information
meanmail committed Jan 26, 2024
1 parent a33830d commit 984e5bd
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 79 deletions.
14 changes: 0 additions & 14 deletions .github/actions/node14/action.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/actions/node16/action.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/actions/node18/action.yml

This file was deleted.

81 changes: 44 additions & 37 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,60 @@
name: Checks
on: [ push ]
on:
push:
branches:
- master
- release
pull_request:

jobs:
Lint:
runs-on: ubuntu-latest
lint:
runs-on: [ self-hosted, small ]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/node18
- name: node version

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version-file: .node-version
cache: 'npm'
cache-dependency-path: package-lock.json

- name: Install dependencies
run: npm ci

- name: Display Node.js version
run: node --version

- name: Lint
run: npm run lint

Node_14:
runs-on: ubuntu-latest
env:
NODE_ENV: test_lib
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/node14
- uses: browser-actions/setup-chrome@latest
- run: chrome --version
- name: node version
run: node --version
- name: Test
run: npm run test
Node_16:
runs-on: ubuntu-latest
env:
NODE_ENV: test_lib
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/node16
- uses: browser-actions/setup-chrome@latest
- run: chrome --version
- name: node version
run: node --version
- name: test
run: npm run test
Node_18:
runs-on: ubuntu-latest
tests:
runs-on: [ self-hosted, small ]
env:
NODE_ENV: test_lib
strategy:
matrix:
node-version: [ 16.x, 18.x, 20.x, 21.x ]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/node18

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: package-lock.json

- name: Install dependencies
run: npm ci

- uses: browser-actions/setup-chrome@latest
- run: chrome --version
- name: node version

- name: Display Chrome version
run: chrome --version

- name: Display Node.js version
run: node --version
- name: test

- name: Run tests
run: npm run test
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18

0 comments on commit 984e5bd

Please sign in to comment.