Skip to content

Commit f203e10

Browse files
authored
Merge pull request #16 from oslabs-beta/lorenc-ci
fix port misconfiguration in yaml file
2 parents c54dba7 + f1a8d49 commit f203e10

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ jobs:
1818
runs-on: ubuntu-latest
1919
env:
2020
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY}}
21+
PORT: 4000
2122
steps:
2223
- uses: actions/checkout@v4
2324
- uses: actions/setup-node@v4
2425
with:
2526
node-version: 20
2627
- run: npm ci
28+
- run: npm run start & sleep 3
2729
- run: npm test
2830
- run: echo "Deploying to ${{ inputs.environment || 'dev' }}..."

test/smoke.test.js

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
1-
// import assert from 'node:assert/strict';
2-
// assert.equal(1 + 1, 2, 'Math still works');
3-
// import '../server/server.js';
4-
// console.log('✅ smoke test passed');
5-
// import 'dotenv/config';
6-
// import { healthCheck } from '../server/db.js';
1+
import fetch from 'node-fetch';
72

8-
// async function main() {
9-
// try {
10-
// console.log('Running a smoke test');
3+
const port = process.env.PORT || 4000;
4+
const url = `http://localhost:${port}/health`;
115

12-
// const ok = await healthCheck();
13-
// if (!ok) {
14-
// console.error("❌ Health check didn't pass");
15-
// process.exit(1);
16-
// }
6+
async function main() {
7+
try {
8+
console.log(`🔎 Checking API health @ ${url} ...`);
9+
const res = await fetch(url);
10+
const json = await res.json();
1711

18-
// console.log('✅ Health check passed!');
19-
// process.exit(0);
20-
// } catch (error) {
21-
// console.error('Smoke test failed');
22-
// process.exit(1);
23-
// }
24-
// }
12+
// const ok = await healthCheck();
13+
if (!res.ok || !json.ok) {
14+
console.error('❌ Health check didn"t pass', json);
15+
process.exit(1);
16+
}
2517

26-
// main();
27-
console.log('✅ CI smoke test stub: nothing to check yet.');
28-
process.exit(0);
18+
console.log('✅ Health check passed!', json);
19+
process.exit(0);
20+
} catch (error) {
21+
console.error('❌ Smoke test failed');
22+
process.exit(1);
23+
}
24+
}
25+
26+
main();

0 commit comments

Comments
 (0)