git.delta.rocks / unique-network / refs/commits / 5904c9a198aa

difftreelog

Adding CI

akaryaginUSETECH2021-03-11parent: #447a9ec.patch.diff
in: master

6 files changed

addedDockerfile-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
addedDockerfile-unitdiffbeforeafterboth
--- /dev/null
+++ b/Dockerfile-unit
@@ -0,0 +1,39 @@
+# ===== Unit Tests ======
+
+FROM phusion/baseimage:18.04-1.0.0
+LABEL maintainer="UniqueNetwork.io"
+
+ENV WASM_TOOLCHAIN=nightly-2021-03-01
+# ENV NATIVE_TOOLCHAIN=1.50.0
+
+ARG PROFILE=release
+
+RUN apt-get update && \
+        apt-get dist-upgrade -y -o Dpkg::Options::="--force-confold" && \
+        apt-get install -y cmake pkg-config libssl-dev git clang
+
+# Get project and run it
+#RUN git clone https://github.com/usetech-llc/nft_parachain /nft_parachain
+RUN mkdir nft_parachain
+WORKDIR /nft_parachain
+COPY . .
+
+RUN export CARGO_HOME="/cargo-home" && curl https://sh.rustup.rs -sSf | sh -s -- -y
+RUN export PATH="/cargo-home/bin:$PATH" && \
+    export CARGO_HOME="/cargo-home" && \
+        cargo fetch
+RUN export PATH="/cargo-home/bin:$PATH" && \
+    export CARGO_HOME="/cargo-home" && \
+        rustup toolchain uninstall $(rustup toolchain list) && \
+        # rustup toolchain install $NATIVE_TOOLCHAIN && \
+        rustup toolchain install $WASM_TOOLCHAIN && \
+        rustup target add wasm32-unknown-unknown --toolchain $WASM_TOOLCHAIN && \
+        rustup default $WASM_TOOLCHAIN && \
+    rustup target list --installed && \
+    rustup show
+
+RUN export PATH="/cargo-home/bin:$PATH" && \
+    export CARGO_HOME="/cargo-home" && \
+        cargo build "--$PROFILE"
+        #cargo test
+ENV PATH "$PATH:/cargo-home/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
addedci_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
addeddocker-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
addednode_build_test.ymldiffbeforeafterboth

no changes

modifiedtests/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