Skip to content

Commit ec56379

Browse files
author
Gonzalo Diaz
committed
[CONFIG] Node script for github-actions.
* Split in 2: One for Coverage, the another to run multi-version/multi-OS tests. * Node current version updated to 22.x.
1 parent 777db88 commit ec56379

File tree

2 files changed

+53
-15
lines changed

2 files changed

+53
-15
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Node.js CI Coverage
2+
3+
on:
4+
push:
5+
branches: [ "main", "develop", "feature/*" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
os: [
17+
"ubuntu-latest"
18+
]
19+
node-version: [22.x]
20+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4
25+
26+
- name: Set up Node.js ${{ matrix.node-version }}
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: ${{ matrix.node-version }}
30+
31+
- name: Install dependencies
32+
run: npm ci --verbose
33+
34+
- name: Lint
35+
run: npm run lint
36+
37+
- name: Run the tests
38+
run: npm test -- --coverage
39+
40+
- name: Upload coverage reports to Codecov with GitHub Action
41+
uses: codecov/codecov-action@v4
42+
with:
43+
token: ${{ secrets.CODECOV_TOKEN }} # required
44+
verbose: true # optional (default = false)
45+
46+
- name: SonarCloud Scan
47+
uses: SonarSource/sonarcloud-github-action@master
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
50+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/node.js.yml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Node.js CI
1+
name: Node.js CI Tests
22

33
on:
44
push:
@@ -18,7 +18,7 @@ jobs:
1818
"ubuntu-latest",
1919
"macOS-latest"
2020
]
21-
node-version: [18.x, 19.x, 20.x]
21+
node-version: [19.x, 20.x, 22.x]
2222
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2323

2424
steps:
@@ -37,16 +37,4 @@ jobs:
3737
run: npm run lint
3838

3939
- name: Run the tests
40-
run: npm test -- --coverage
41-
42-
- name: Upload coverage reports to Codecov with GitHub Action
43-
uses: codecov/codecov-action@v4
44-
with:
45-
token: ${{ secrets.CODECOV_TOKEN }} # required
46-
verbose: true # optional (default = false)
47-
48-
- name: SonarCloud Scan
49-
uses: SonarSource/sonarcloud-github-action@master
50-
env:
51-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
52-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
40+
run: npm test

0 commit comments

Comments
 (0)