Skip to content

Commit b902c75

Browse files
committed
ci: migrate to shared workflows
* Replaces js-tests with shared inveniosoftware/workflows * Updates Node test matrix to 22.x, 24.x, 26.x * Adds run-js-linter.sh and run-js-tests.sh scripts * Removes conflicting react-app lint rules * Updates Node requirement to >=22.0.0
1 parent 9d18249 commit b902c75

4 files changed

Lines changed: 85 additions & 34 deletions

File tree

.github/workflows/js-tests.yml

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,38 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Copyright (C) 2020-2024 CERN.
4+
# Copyright (C) 2020 Northwestern University.
5+
# Copyright (C) 2024 Graz University of Technology.
6+
#
7+
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
8+
# it under the terms of the MIT License; see LICENSE file for more details.
9+
110
name: CI
211

312
on:
413
push:
514
branches:
615
- master
16+
- "feature/*"
17+
- "maint-**"
718
pull_request:
819
branches:
920
- master
21+
- "maint-**"
22+
- "feature/*"
1023
schedule:
1124
# * is a special character in YAML so you have to quote this string
12-
- cron: '0 2 * * 5'
25+
- cron: "0 2 * * 5"
1326
workflow_dispatch:
1427
inputs:
1528
reason:
16-
description: 'Reason'
29+
description: "Reason"
1730
required: false
18-
default: 'Manual trigger'
31+
default: "Manual trigger"
1932

2033
jobs:
21-
Tests:
22-
runs-on: ubuntu-latest
23-
24-
strategy:
25-
matrix:
26-
node-version: [22.x, 18.x, 16.x]
27-
28-
steps:
29-
- name: Checkout
30-
uses: actions/checkout@v4
31-
32-
- name: Use Node.js ${{ matrix.node-version }}
33-
uses: actions/setup-node@v4
34-
with:
35-
node-version: ${{ matrix.node-version }}
36-
37-
- name: Install & Build
38-
run: npm ci
39-
40-
- name: Lint
41-
run: npm run lint
42-
43-
- name: Test
44-
run: npm test
45-
46-
- name: Coverage
47-
run: npm test -- --coverage
34+
JS:
35+
uses: inveniosoftware/workflows/.github/workflows/tests-js.yml@master
36+
with:
37+
js-working-directory: ./
38+
node-version: '["22.x", "24.x", "26.x"]'

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@
9494
"search",
9595
"react search"
9696
],
97-
"eslintConfig": {
98-
"extends": "react-app"
99-
},
10097
"browserslist": {
10198
"production": [
10299
">0.2%",
@@ -111,6 +108,6 @@
111108
]
112109
},
113110
"engines": {
114-
"node": ">=14.0.0"
111+
"node": ">=22.0.0"
115112
}
116113
}

run-js-linter.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
# -*- coding: utf-8 -*-
3+
#
4+
# Copyright (C) 2026 CERN.
5+
#
6+
# React-SearchKit is free software; you can redistribute it and/or modify it
7+
# under the terms of the MIT License; see LICENSE file for more details.
8+
9+
# Usage:
10+
# ./run-js-linter.sh [args]
11+
12+
# Arguments
13+
# -i|--install: installs dependencies
14+
GREEN='\033[0;32m'
15+
RED='\033[0;31m'
16+
NC='\033[0m' # No Color
17+
18+
ESLINT=./node_modules/.bin/eslint
19+
20+
for arg in $@; do
21+
case ${arg} in
22+
-i|--install)
23+
npm install;;
24+
-f|--fix)
25+
printf "${GREEN}Run eslint${NC}\n";
26+
$ESLINT -c .eslintrc.yml src/**/*.js --fix;;
27+
*)
28+
printf "Argument ${RED}$arg${NC} not supported\n"
29+
exit;;
30+
esac
31+
done
32+
33+
printf "${GREEN}Run eslint${NC}\n"
34+
$ESLINT -c .eslintrc.yml src/**/*.js

run-js-tests.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
# -*- coding: utf-8 -*-
3+
#
4+
# Copyright (C) 2026 CERN.
5+
#
6+
# React-SearchKit is free software; you can redistribute it and/or modify it
7+
# under the terms of the MIT License; see LICENSE file for more details.
8+
9+
# Usage:
10+
# ./run-js-tests.sh [args]
11+
12+
# Arguments
13+
# -i|--install: installs dependencies
14+
GREEN='\033[0;32m'
15+
RED='\033[0;31m'
16+
NC='\033[0m' # No Color
17+
18+
for arg in $@; do
19+
case ${arg} in
20+
-i|--install)
21+
npm install;;
22+
*)
23+
printf "Argument ${RED}$arg${NC} not supported\n"
24+
exit;;
25+
esac
26+
done
27+
28+
printf "${GREEN}Run tests${NC}\n"
29+
CI=true npm test

0 commit comments

Comments
 (0)