-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update proto files, sample code and unit tests. (#35)
- Loading branch information
1 parent
07785b6
commit 014f00b
Showing
15 changed files
with
6,779 additions
and
2,237 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
## Setting up CircleCI for Scalar DL Node/Web client SDK | ||
|
||
### Environment Variables | ||
|
||
Set environment variables on CircleCi by following [this guide](https://circleci.com/blog/new-on-circleci-import-project-environment-variables/). | ||
Please set environment variables in CircleCi as follows. | ||
|
||
Set the environment variables in the [Context](https://circleci.com/gh/organizations/scalar-labs/settings#contexts) with the name `scalar`. | ||
<pre> | ||
<b>$GHCR_USERNAME</b> | ||
<b>$GHCR_PAT</b> | ||
</pre> | ||
|
||
[Here](https://github.com/scalarindetail/scalardl-node-client-sdk/blob/feature/integration_test/.circleci/config.yml) is the configuration file. |
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 |
---|---|---|
|
@@ -5,26 +5,9 @@ | |
version: 2 | ||
jobs: | ||
build: | ||
docker: | ||
machine: true | ||
# set a fixed version for the image circleci/openjdk:8-jdk-node-browsers | ||
- image: circleci/openjdk:8-jdk-node-browsers | ||
environment: | ||
MAX_HEAP_SIZE: 2048m | ||
HEAP_NEWSIZE: 512m | ||
|
||
- image: cassandra:3.11 | ||
environment: | ||
MAX_HEAP_SIZE: 1300m | ||
HEAP_NEWSIZE: 512m | ||
|
||
- image: scalarlabs/scalar-ledger:2.0.2 | ||
auth: | ||
username: $DOCKERHUB_USERNAME | ||
password: $DOCKERHUB_PASSWORD | ||
environment: | ||
SCALAR_CASSANDRA_HOST: 127.0.0.1 | ||
MAX_HEAP_SIZE: 500m | ||
HEAP_NEWSIZE: 512m | ||
image: ubuntu-2004:202101-01 | ||
|
||
working_directory: ~/scalardl-node-client-sdk | ||
|
||
|
@@ -36,35 +19,64 @@ jobs: | |
- dependency-cache-{{ checksum "package-lock.json" }} | ||
|
||
- run: | ||
name: Install cqlsh | ||
# We need to edit DEFAULT_CQLVER defined in the cqlsh script | ||
# to connect to the server without --cqlversion command line option | ||
name: Docker login | ||
command: | | ||
curl -O https://bootstrap.pypa.io/get-pip.py | ||
sudo python get-pip.py | ||
sudo pip install cqlsh | ||
sudo sed -i "s/^DEFAULT_CQLVER = .*/DEFAULT_CQLVER = '3.4.4'/" /usr/local/bin/cqlsh | ||
echo ${GHCR_PAT} | docker login https://ghcr.io -u ${GHCR_USERNAME} --password-stdin | ||
- run: | ||
name: Wait for Cassandra | ||
# dockerize command is included in circleci/openjdk:8-jdk image | ||
command: dockerize -wait tcp://127.0.0.1:9042 -timeout 1m | ||
name: Update docker and docker compose | ||
command: | | ||
sudo apt-get purge docker-ce containerd.io | ||
curl -fsSL https://get.docker.com -o get-docker.sh | ||
sudo sh get-docker.sh | ||
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | ||
sudo chmod +x /usr/local/bin/docker-compose | ||
- run: | ||
name: Install schema on Cassandra | ||
command: cqlsh --execute "$SCHEMA_CONTENT" 127.0.0.1 9042 | ||
name: checkout scalar-samples repository as it contains the script to spin up scalardl environment and easier for us to maintain the CI | ||
command: | | ||
git init | ||
git pull https://${GHCR_USERNAME}:${GITHUB_PASSWORD}@github.com/scalar-labs/scalar-samples.git | ||
working_directory: .circleci/ | ||
|
||
|
||
- run: | ||
name: Install schema for function purpose on Cassandra | ||
command: cqlsh -f .circleci/function_schema.cql 127.0.0.1 9042 | ||
name: Start Scalar DL environment | ||
command: docker-compose -f docker-compose.yml -f docker-compose-open-cassandra-port.yml up -d | ||
working_directory: .circleci/ | ||
|
||
- run: | ||
name: Wait for Scalardl | ||
command: dockerize -wait tcp://127.0.0.1:50051 -timeout 1m | ||
name: Install [email protected] # Update node for karma to work | ||
command: | | ||
export NVM_DIR="/opt/circleci/.nvm" | ||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | ||
nvm install v14.16.0 | ||
nvm alias default v14.16.0 | ||
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV | ||
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV | ||
- run: | ||
name: Install npm | ||
command: npm install | ||
|
||
- run: | ||
name: Wait for Cassandra to spin up to be able to update the Cassandra schema in the next step | ||
command: | | ||
echo -n "Wait for C* " | ||
until docker exec scalar-samples-cassandra-1 cqlsh 2> /dev/null ; do | ||
sleep 0.5 | ||
echo -n "#" | ||
done | ||
- run: | ||
name: Insert function table and wait | ||
command: | | ||
docker cp function_schema.cql \ | ||
scalar-samples-cassandra-1:function_schema.cql | ||
docker exec scalar-samples-cassandra-1 cqlsh -f function_schema.cql | ||
sleep 10 | ||
working_directory: .circleci/ | ||
|
||
- save_cache: | ||
key: v1-dependencies-{{ checksum "package-lock.json" }} | ||
paths: | ||
|
@@ -84,7 +96,8 @@ jobs: | |
path: ~/scalardl-node-client-sdk/mochawesome-report | ||
deploy: | ||
docker: | ||
- image: circleci/node | ||
#Node LTS 14.16 "fermium" | ||
- image: circleci/node:14.16 | ||
steps: | ||
- checkout | ||
- run: | ||
|
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,6 @@ | ||
version: "3.5" | ||
services: | ||
cassandra: | ||
ports: | ||
- "9042:9042" | ||
|
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 |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules/ | |
mochawesome-report/ | ||
.idea/ | ||
out/ | ||
.gradle |
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 @@ | ||
v14.16.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
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
Oops, something went wrong.