-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (35 loc) · 1.07 KB
/
check-port.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Check if Next.js App Runs Successfully at Port
on:
pull_request:
branches:
- develop
jobs:
check-port:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20.14.0' # Specify the Node.js version your Next.js app uses
- name: Install dependencies
run: npm install
- name: Code linting
run: npm run lint
- name: Build the Next.js application
run: npm run build
- name: Start the Next.js application
run: npm start &
env:
PORT: 3000 # Next.js defaults to port 3000
- name: Wait for the application to start
run: sleep 15 # Adjust the sleep duration based on how long your app takes to start
- name: Check if the app is running on the specified port
run: |
if nc -zv localhost 3000; then
echo "Next.js app is running on port 3000";
else
echo "Next.js app is not running on port 3000";
exit 1;
fi