Skip to content

Commit

Permalink
build: auto testing
Browse files Browse the repository at this point in the history
  • Loading branch information
rolu01 authored May 16, 2024
2 parents 001925e + 049ab58 commit 87f7e64
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 10 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/build-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- run: npm test
- name: Install dependencies
run: find . -name 'package-lock.json' -execdir npm ci \;
- name: Run server
run: npm start &
- name: Wait for server to start
run: npx wait-on tcp:8585
- name: Run tests
run: npm run test
build-latest:
name: Build branch
runs-on: ubuntu-latest
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/build-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- run: npm test
- name: Install dependencies
run: find . -name 'package-lock.json' -execdir npm ci \;
- name: Run server
run: npm start &
- name: Wait for server to start
run: npx wait-on tcp:8585
- name: Run tests
run: npm run test
build-latest:
name: Build latest
runs-on: ubuntu-latest
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- run: npm test
- name: Install dependencies
run: find . -name 'package-lock.json' -execdir npm ci \;
- name: Run server
run: npm start &
- name: Wait for server to start
run: npx wait-on tcp:8585
- name: Run tests
run: npm run test
build:
name: Build with google cloud
runs-on: ubuntu-latest
Expand Down
34 changes: 33 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"start": "node app.js",
"dev": "nodemon --inspect=0.0.0.0:9229 app.js",
"test": "vitest run"
"test": "vitest"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -37,7 +37,8 @@
"pino-http": "^9.0.0",
"pino-pretty": "^10.3.1",
"swagger-ui-express": "^5.0.0",
"vitest": "^0.34.6"
"vitest": "^0.34.6",
"wait-on": "^7.2.0"
},
"devDependencies": {
"@types/express": "^4.17.18",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/setup-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ dotenv.config();
const rootDir = resolve();
let allResources = null; // This will store the entire resources tree.

const port = process.env.PORT || 8585;
const port =
process.env.PORT_OVERRIDE || process.env.ONIFY_API_INTERNAL_PORT || 8585;
const resourcesSource = process.env.ONIFY_API_RESOURCES_SOURCE || '/';
const resourceURL = `${process.env.ONIFY_API_URL}/admin/resources/file?stream=false&path=${resourcesSource}`;
const listResourcesURL = `${process.env.ONIFY_API_URL}/admin/resources?tree=true`;
Expand Down

0 comments on commit 87f7e64

Please sign in to comment.