Skip to content

Commit 08c4e8d

Browse files
CI: Add Redis installation steps to CircleCI and GitHub Actions workflows; update init.js to dynamically load configuration file
1 parent d8cdafb commit 08c4e8d

File tree

4 files changed

+63
-4
lines changed

4 files changed

+63
-4
lines changed

.circleci/config.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ jobs:
77
- image: circleci/node:8
88
steps:
99
- checkout
10+
- run:
11+
name: Install Redis
12+
command: |
13+
sudo apt-get update
14+
sudo apt-get install -y redis-server
1015
- run:
1116
name: Run build
1217
command: npm install
@@ -23,6 +28,11 @@ jobs:
2328
- checkout
2429
- node/install:
2530
node-version: '10.24'
31+
- run:
32+
name: Install Redis
33+
command: |
34+
sudo apt-get update
35+
sudo apt-get install -y redis-server
2636
- run:
2737
name: Run build
2838
command: npm install
@@ -39,6 +49,11 @@ jobs:
3949
- checkout
4050
- node/install:
4151
node-version: '12.22'
52+
- run:
53+
name: Install Redis
54+
command: |
55+
sudo apt-get update
56+
sudo apt-get install -y redis-server
4257
- run:
4358
name: Run build
4459
command: npm install
@@ -55,6 +70,11 @@ jobs:
5570
- checkout
5671
- node/install:
5772
node-version: '14.21'
73+
- run:
74+
name: Install Redis
75+
command: |
76+
sudo apt-get update
77+
sudo apt-get install -y redis-server
5878
- run:
5979
name: Run build
6080
command: npm install
@@ -71,6 +91,11 @@ jobs:
7191
- checkout
7292
- node/install:
7393
node-version: '16.20'
94+
- run:
95+
name: Install Redis
96+
command: |
97+
sudo apt-get update
98+
sudo apt-get install -y redis-server
7499
- run:
75100
name: Run build
76101
command: npm install
@@ -87,6 +112,11 @@ jobs:
87112
- checkout
88113
- node/install:
89114
node-version: '18.20'
115+
- run:
116+
name: Install Redis
117+
command: |
118+
sudo apt-get update
119+
sudo apt-get install -y redis-server
90120
- run:
91121
name: Run build
92122
command: npm install
@@ -103,6 +133,11 @@ jobs:
103133
- checkout
104134
- node/install:
105135
node-version: '20.19'
136+
- run:
137+
name: Install Redis
138+
command: |
139+
sudo apt-get update
140+
sudo apt-get install -y redis-server
106141
- run:
107142
name: Run build
108143
command: npm install
@@ -119,6 +154,11 @@ jobs:
119154
- checkout
120155
- node/install:
121156
node-version: '22.17'
157+
- run:
158+
name: Install Redis
159+
command: |
160+
sudo apt-get update
161+
sudo apt-get install -y redis-server
122162
- run:
123163
name: Run build
124164
command: npm install
@@ -135,6 +175,11 @@ jobs:
135175
- checkout
136176
- node/install:
137177
node-version: '24.3'
178+
- run:
179+
name: Install Redis
180+
command: |
181+
sudo apt-get update
182+
sudo apt-get install -y redis-server
138183
- run:
139184
name: Run build
140185
command: npm install

.github/workflows/node.js.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ jobs:
2020
with:
2121
node-version: ${{ matrix.node-version }}
2222
- name: Run build
23-
run: npm isntall
23+
run: npm install
24+
- name: Install Redis
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y redis-server
28+
sudo service redis-server start
2429
- name: Run test
2530
run: npm run test
2631
- name: Verify build and test

init.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,23 @@ import jsonMinify from 'node-json-minify';
1616
// Set JSON.minify for backward compatibility
1717
JSON.minify = JSON.minify || jsonMinify;
1818

19-
if (!fs.existsSync('config.json')) {
19+
// Determine config file name: prefer config.json, else fallback to config_example.json
20+
const configFileName = fs.existsSync('config.json')
21+
? 'config.json'
22+
: fs.existsSync('config_example.json')
23+
? 'config_example.json'
24+
: null;
25+
26+
if (!configFileName) {
2027
console.log(
2128
'config.json file does not exist. Read the installation/setup instructions.'
2229
);
2330
process.exit(0);
2431
}
2532

33+
// Load portal configuration from determined file
2634
const portalConfig = JSON.parse(
27-
JSON.minify(fs.readFileSync('config.json', { encoding: 'utf8' }))
35+
JSON.minify(fs.readFileSync(configFileName, { encoding: 'utf8' }))
2836
);
2937
let poolConfigs;
3038

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
"lint": "eslint init.js",
4343
"lint:fix": "eslint init.js --fix",
4444
"format": "prettier --write .",
45-
"format:check": "prettier --check ."
45+
"format:check": "prettier --check .",
46+
"test": "node init.js"
4647
},
4748
"dependencies": {
4849
"async": "^3.2.6",

0 commit comments

Comments
 (0)