difftreelog
Adding CI
in: master
6 files changed
Dockerfile-testsdiffbeforeafterboth--- /dev/null
+++ b/Dockerfile-tests
@@ -0,0 +1,30 @@
+# ===== Integration Tests ======
+
+
+FROM ubuntu:18.04
+LABEL maintainer="UniqueNetwork.io"
+
+RUN apt-get -y update; apt-get -y upgrade; apt-get -y install curl
+
+
+RUN mkdir nft_parachain
+WORKDIR /nft_parachain
+
+COPY . .
+
+RUN apt-get -y update && \
+ apt-get -y upgrade && \
+ apt-get -y install curl && \
+ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash && \
+ export NVM_DIR="$HOME/.nvm" && \
+ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
+ nvm install v15.0.1 && \
+ nvm use v15.0.1 && \
+ npm install --save @polkadot/api
+
+CMD export NVM_DIR="$HOME/.nvm" && \
+ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
+ cd tests && \
+ npm install --global yarn && \
+ yarn install && \
+ yarn test
Dockerfile-unitdiffbeforeafterbothno changes
ci_node.shdiffbeforeafterboth--- /dev/null
+++ b/ci_node.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+docker-compose -f docker-compose-tests.yml up -d --build --force-recreate --no-deps
+
+# validate if testing container finished
+while [ "$(docker ps | grep unit_test | wc -l)" -ge 1 ]; do echo "Unit test in process" && date && sleep 60; done && docker logs unit_test &> /home/polkadot/unit_test.log & \
+while [ "$(docker ps | grep integration_test | wc -l)" -ge 1 ]; do echo "Integration test in process" && sleep 60; done && docker logs integration_test &> /home/polkadot/integration_test.log
+docker-compose -f docker-compose-tests.yml down -v
+echo "Wrokflow finished"
+docker system prune --force
\ No newline at end of file
docker-compose-tests.ymldiffbeforeafterboth--- /dev/null
+++ b/docker-compose-tests.yml
@@ -0,0 +1,44 @@
+version: "3.5"
+
+services:
+ node_validator1:
+ image: nft_node_test
+ container_name: validator1_test
+ ports:
+ - 9944:9944
+ build:
+ context: ./
+ dockerfile: Dockerfile
+# volumes:
+# - ./chain-data:/chain-data
+ networks:
+ - node_test_network
+ command: bash -c "/usr/local/bin/nft --dev --tmp --ws-external --rpc-external"
+
+ integration_tests:
+ container_name: integration_test
+ image: int_test
+ build:
+ context: ./
+ dockerfile: Dockerfile-tests
+ networks:
+ - node_test_network
+ depends_on:
+ - node_validator1
+
+ unit_tests:
+ container_name: unit_test
+ image: nft_unit_test
+ build:
+ context: ./
+ dockerfile: Dockerfile-unit
+ container_name: unit_test
+ networks:
+ - node_test_network
+ # command: bash -c 'while true; do sleep 20; df -h; done'
+ command: bash -c 'cargo test'
+
+networks:
+ node_test_network:
+ name: node_test_network
+ driver: bridge
\ No newline at end of file
node_build_test.ymldiffbeforeafterboth--- /dev/null
+++ b/node_build_test.yml
@@ -0,0 +1,42 @@
+name: Build & test
+
+# Controls when the action will run.
+on:
+ # Triggers the workflow on push or pull request events but only for the master branch
+ # push:
+ # branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+
+# A workflow run is made up of one or more jobs that can run sequentially or in parallel
+jobs:
+ build:
+ # The type of runner that the job will run on
+ runs-on: ubuntu-20.04
+
+ # Steps represent a sequence of tasks that will be executed as part of the job
+ steps:
+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
+ - uses: actions/checkout@v2
+
+ #runs ssh connection
+ - name: Go to server
+ uses: appleboy/ssh-action@master
+ with:
+ host: ${{ secrets.SERVER_IP }}
+ username: ${{ secrets.SERVER_USERNAME }}
+ key: ${{ secrets.KEY }}
+ port: ${{ secrets.SERVER_PORT }}
+ # command_timeout: 200m
+ script: |
+ eval $(ssh-agent -s)
+ ssh-add /home/devops/.ssh/git_hub
+ git clone git@github.com:usetech-llc/nft_private.git
+ cd nft_private
+ git checkout develop
+ # git pull --all
+ chmod +x ci_node.sh
+ ./ci_node.sh
\ No newline at end of file
tests/src/config.tsdiffbeforeafterboth--- a/tests/src/config.ts
+++ b/tests/src/config.ts
@@ -6,7 +6,7 @@
import process from 'process';
const config = {
- substrateUrl: process.env.substrateUrl || 'ws://127.0.0.1:9944'
+ substrateUrl: process.env.substrateUrl || 'ws://172.17.0.1:9944'
}
export default config;
\ No newline at end of file