forked from line/line-bot-sdk-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
52 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: 'Start and Test Node.js App' | ||
description: 'Starts Node.js app, runs tests, and shuts it down' | ||
inputs: | ||
port: | ||
description: 'Port on which the Node.js app is running' | ||
required: true | ||
path: | ||
description: 'Path to test with the HTTP request' | ||
required: false | ||
default: "" | ||
method: | ||
description: 'HTTP method to use for the test (GET, POST, etc.)' | ||
required: true | ||
body: | ||
description: 'Request body for POST method (optional)' | ||
required: false | ||
default: "" | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Start application | ||
run: npm start & | ||
shell: bash | ||
|
||
- name: Wait for application to start | ||
run: sleep 10 | ||
shell: bash | ||
|
||
|
||
- name: Test application | ||
run: | | ||
if [ "${{ inputs.method }}" = "POST" ]; then | ||
curl --fail -X POST -d '${{ inputs.body }}' http://localhost:${{ inputs.port }}/${{ inputs.path }} || exit 1 | ||
else | ||
curl --fail -X ${{ inputs.method }} http://localhost:${{ inputs.port }}/${{ inputs.path }} || exit 1 | ||
fi | ||
shell: bash | ||
|
||
- name: Kill application | ||
run: pkill node | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters