Skip to content

Commit 87f7e64

Browse files
authored
build: auto testing
2 parents 001925e + 049ab58 commit 87f7e64

File tree

6 files changed

+62
-10
lines changed

6 files changed

+62
-10
lines changed

.github/workflows/build-branch.yaml

+8-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ jobs:
1515
uses: actions/setup-node@v3
1616
with:
1717
node-version: 18
18-
- run: npm ci
19-
- run: npm test
18+
- name: Install dependencies
19+
run: find . -name 'package-lock.json' -execdir npm ci \;
20+
- name: Run server
21+
run: npm start &
22+
- name: Wait for server to start
23+
run: npx wait-on tcp:8585
24+
- name: Run tests
25+
run: npm run test
2026
build-latest:
2127
name: Build branch
2228
runs-on: ubuntu-latest

.github/workflows/build-latest.yaml

+8-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@ jobs:
1414
uses: actions/setup-node@v3
1515
with:
1616
node-version: 18
17-
- run: npm ci
18-
- run: npm test
17+
- name: Install dependencies
18+
run: find . -name 'package-lock.json' -execdir npm ci \;
19+
- name: Run server
20+
run: npm start &
21+
- name: Wait for server to start
22+
run: npx wait-on tcp:8585
23+
- name: Run tests
24+
run: npm run test
1925
build-latest:
2026
name: Build latest
2127
runs-on: ubuntu-latest

.github/workflows/release.yaml

+8-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ jobs:
1515
uses: actions/setup-node@v3
1616
with:
1717
node-version: 18
18-
- run: npm ci
19-
- run: npm test
18+
- name: Install dependencies
19+
run: find . -name 'package-lock.json' -execdir npm ci \;
20+
- name: Run server
21+
run: npm start &
22+
- name: Wait for server to start
23+
run: npx wait-on tcp:8585
24+
- name: Run tests
25+
run: npm run test
2026
build:
2127
name: Build with google cloud
2228
runs-on: ubuntu-latest

package-lock.json

+33-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"scripts": {
88
"start": "node app.js",
99
"dev": "nodemon --inspect=0.0.0.0:9229 app.js",
10-
"test": "vitest run"
10+
"test": "vitest"
1111
},
1212
"repository": {
1313
"type": "git",
@@ -37,7 +37,8 @@
3737
"pino-http": "^9.0.0",
3838
"pino-pretty": "^10.3.1",
3939
"swagger-ui-express": "^5.0.0",
40-
"vitest": "^0.34.6"
40+
"vitest": "^0.34.6",
41+
"wait-on": "^7.2.0"
4142
},
4243
"devDependencies": {
4344
"@types/express": "^4.17.18",

src/lib/setup-app.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ dotenv.config();
1515
const rootDir = resolve();
1616
let allResources = null; // This will store the entire resources tree.
1717

18-
const port = process.env.PORT || 8585;
18+
const port =
19+
process.env.PORT_OVERRIDE || process.env.ONIFY_API_INTERNAL_PORT || 8585;
1920
const resourcesSource = process.env.ONIFY_API_RESOURCES_SOURCE || '/';
2021
const resourceURL = `${process.env.ONIFY_API_URL}/admin/resources/file?stream=false&path=${resourcesSource}`;
2122
const listResourcesURL = `${process.env.ONIFY_API_URL}/admin/resources?tree=true`;

0 commit comments

Comments
 (0)