-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add GitHub workflow for unit testing and npm publish (#17)
* enhance ci: add auto unit tests * remove open * update test-data.md * change unit test name * add auto npm publish
- Loading branch information
Showing
11 changed files
with
505 additions
and
9 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,59 @@ | ||
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | ||
|
||
name: Node.js Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [14.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Startup Nebula | ||
run: | | ||
cd ./.nebula-up | ||
rm -rf ./data ./log | ||
docker-compose up -d | ||
echo "Sleep 20s for waiting nebula cluster" | ||
sleep 20 | ||
./check.sh | ||
echo "Create space nebula_node" | ||
./console.sh -e "create space nebula_node(vid_type = FIXED_STRING(30));" | ||
echo "Sleep 10s for space creating" | ||
sleep 10 | ||
./console.sh -f /root/init-create.ngql | ||
echo "Sleep 30s for schema creating" | ||
sleep 30 | ||
./console.sh -f /root/init-data.ngql | ||
cd .. | ||
- run: npm run build | ||
- run: npm run test | ||
|
||
publish-npm: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 14 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: npm run build | ||
- run: cd dist && npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.npm_token}} |
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,41 @@ | ||
name: Unit Test | ||
on: [push] | ||
jobs: | ||
unit-test: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [14.x] | ||
|
||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Startup Nebula | ||
run: | | ||
cd ./.nebula-up | ||
rm -rf ./data ./log | ||
docker-compose up -d | ||
echo "Sleep 20s for waiting nebula cluster" | ||
sleep 20 | ||
./check.sh | ||
echo "Create space nebula_node" | ||
./console.sh -e "create space nebula_node(vid_type = FIXED_STRING(30));" | ||
echo "Sleep 10s for space creating" | ||
sleep 10 | ||
./console.sh -f /root/init-create.ngql | ||
echo "Sleep 30s for schema creating" | ||
sleep 30 | ||
./console.sh -f /root/init-data.ngql | ||
cd .. | ||
- name: Unit Test | ||
run: | | ||
npm install --unsafe-perm | ||
npm run coverage |
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 @@ | ||
TZ=UTC |
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,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
retries=0 | ||
|
||
while : | ||
do | ||
retries=$((retries+1)) | ||
|
||
echo "#${retries} - Starting checking nebula graphd..." | ||
if curl -sL --fail http://127.0.0.1:19669; | ||
then | ||
echo "Result: Successfully" | ||
exit 0 | ||
fi | ||
|
||
echo "Result: Failed" | ||
|
||
if [ $retries -gt 120 ]; | ||
then | ||
echo "Max retry limitation exceeded" | ||
exit 1 | ||
fi | ||
|
||
docker-compose ps | ||
|
||
echo "Sleep 10s" | ||
|
||
sleep 10 | ||
done | ||
|
||
exit 0 |
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,10 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) 2021 vesoft inc. All rights reserved. | ||
# | ||
# This source code is licensed under Apache 2.0 License, | ||
|
||
|
||
# Usage: console.sh or console.sh -e "SHOW HOSTS" | ||
|
||
export DOCKER_DEFAULT_PLATFORM=linux/amd64; | ||
docker run --rm -v $PWD:/root --network nebula-up_nebula-net vesoft/nebula-console:v3.0.0 -addr graphd -port 9669 -u root -p nebula "$@" |
Oops, something went wrong.