mirror of
https://github.com/QuiteAFancyEmerald/Holy-Unblocker.git
synced 2025-05-16 13:10:00 -04:00
test
This commit is contained in:
parent
dd1aeba2ee
commit
649b6b7878
2 changed files with 33 additions and 16 deletions
45
.github/workflows/ci.yml
vendored
45
.github/workflows/ci.yml
vendored
|
@ -11,22 +11,39 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '20.8.0'
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Build project
|
||||
run: npm run build
|
||||
- name: Check if server is already running
|
||||
id: check-server
|
||||
run: |
|
||||
if lsof -Pi :8080 -sTCP:LISTEN -t >/dev/null ; then
|
||||
echo "Server is already running"
|
||||
exit 0
|
||||
else
|
||||
echo "Server is not running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Start server and run tests
|
||||
run: |
|
||||
npm run start-test-server
|
||||
sleep 10 # Wait for the server to start
|
||||
npm run test-400
|
||||
- name: Start server if not already running
|
||||
if: steps.check-server.outcome == 'failure'
|
||||
run: npm run start-test-server
|
||||
|
||||
- name: Wait for server to start
|
||||
if: steps.check-server.outcome == 'failure'
|
||||
run: sleep 30
|
||||
|
||||
- name: Test server response
|
||||
run: npm run test-400
|
||||
|
||||
- name: Stop server after testing
|
||||
if: steps.check-server.outcome == 'failure'
|
||||
run: pkill node || true
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
"main": "backend.js",
|
||||
"scripts": {
|
||||
"start": "node backend.js",
|
||||
"build": "echo 'Building project...' && exit 0",
|
||||
"test": "echo 'Running tests...' && exit 0",
|
||||
"build": "npm run start",
|
||||
"test": "npm run test-400",
|
||||
"start-test-server": "node backend.js &",
|
||||
"test-400": "curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/ | grep 400"
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue