From 215e29bb69e49ff6ddf9f587d32d284c332e4679 Mon Sep 17 00:00:00 2001 From: fmacleal Date: Fri, 14 Jun 2024 13:39:23 +0200 Subject: [PATCH] After internal discussions, we decided to change approach and create an action - For better use of the RIT execution, we want to create an action to be called by powpeg and rskj. Due that, we are starting creating a Dockerfile with everything necessary to run this integration test. --- .github/images/Dockerfile | 61 ++++++++++++++++ .../configure_gradle_federator.sh | 0 .github/images/entrypoint_bitcoind.sh | 3 + .github/workflows/build_and_test.yml | 73 ------------------- .gitignore | 1 + 5 files changed, 65 insertions(+), 73 deletions(-) create mode 100644 .github/images/Dockerfile rename .github/{scripts => images}/configure_gradle_federator.sh (100%) create mode 100644 .github/images/entrypoint_bitcoind.sh delete mode 100644 .github/workflows/build_and_test.yml diff --git a/.github/images/Dockerfile b/.github/images/Dockerfile new file mode 100644 index 00000000..7832d07b --- /dev/null +++ b/.github/images/Dockerfile @@ -0,0 +1,61 @@ +FROM kylemanna/bitcoind:latest AS builder + +RUN apt-get update \ + && apt-get install -y wget gnupg2 curl git + +# -- nodeJs --------------------------------------------------------- +ENV NODE_VERSION v20.14.0 +RUN mkdir -p /usr/local/nvm +ENV NVM_DIR /usr/local/nvm + +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + +ENV NODE_PATH $NVM_DIR/$NODE_VERSION/lib/node_modules +ENV PATH $NVM_DIR/versions/node/$NODE_VERSION/bin:$PATH + +# -- java --------------------------------------------------------- +ENV JAVA_VERSION 11 + +RUN apt-get -y install "openjdk-$JAVA_VERSION-jdk" + +ENV JAVA_HOME=/opt/java/openjdk \ + PATH="/opt/java/openjdk/bin:$PATH" + +# -- python --------------------------------------------------------- +ENV PYTHON_VERSION=2.7.16 + +# Install dependencies +RUN apt-get update \ + && apt-get install -y gcc make openssl libffi-dev libgdbm-dev libsqlite3-dev libssl-dev zlib1g-dev \ + && apt-get clean + +RUN export PREVIOUS_PATH=$(pwd) +RUN cd /tmp + +# Build Python from source +RUN wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz \ + && tar --extract -f Python-$PYTHON_VERSION.tgz \ + && cd ./Python-$PYTHON_VERSION/ \ + && ./configure --with-ensurepip=install --enable-optimizations --prefix=/usr/local \ + && make && make install \ + && cd ../ \ + && rm -r ./Python-$PYTHON_VERSION* + +RUN python --version \ + && pip --version + +RUN cd $PREVIOUS_PATH + +# -- bitcoind --------------------------------------------------------- +COPY entrypoint_bitcoind.sh /usr/local/bin/entrypoint.sh +RUN chmod +x /usr/local/bin/entrypoint.sh +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] +CMD ["31591", "http://localhost:31592", "0.0.0.0:32591", "0.0.0.0/0", "admin", "admin"] + +FROM builder AS rit-tests +LABEL Description="Custom RSK node image to execute Rootstock Integration Tests" + diff --git a/.github/scripts/configure_gradle_federator.sh b/.github/images/configure_gradle_federator.sh similarity index 100% rename from .github/scripts/configure_gradle_federator.sh rename to .github/images/configure_gradle_federator.sh diff --git a/.github/images/entrypoint_bitcoind.sh b/.github/images/entrypoint_bitcoind.sh new file mode 100644 index 00000000..0a262917 --- /dev/null +++ b/.github/images/entrypoint_bitcoind.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +/usr/local/bin/bitcoind -printtoconsole -regtest -debug -server -listen -port=$1 -connect=$2 -rpcbind=$3 -rpcallowip=$4 -rpcuser=$5 -rpcpassword=$6 \ No newline at end of file diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml deleted file mode 100644 index b68c215a..00000000 --- a/.github/workflows/build_and_test.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Build and Test - -on: - push: - branches: - - '**' - workflow_dispatch: - inputs: - RSKJ_BRANCH: - description: 'The rskj branch to checkout' - required: true - default: 'master' - FEDERATOR_BRANCH: - description: 'The federate-node branch to checkout' - required: true - default: 'master' - HSM_BRANCH: - description: 'The hsm branch to checkout' - required: true - default: 'master' - UTILITIES_BRANCH: - description: 'The utilities branch to checkout' - required: true - default: 'master' - RIT_BRANCH: - description: 'The rootstock-integration-tests branch to checkout' - required: true - default: 'main' - RIT_LOG_LEVEL: - description: 'Log level for the rootstock-integration-tests' - required: true - default: 'info' - -jobs: - building-dependencies: - runs-on: ubuntu-latest - container: - image: openjdk:8-jdk - steps: - - uses: actions/checkout@v4 - - name: Pull rskj - run: | - git clone https://github.com/rsksmart/rskj.git rskj - cd rskj && git checkout ${{ github.event.inputs.RSKJ_BRANCH }} - ./configure.sh && chmod +x gradlew - ./gradlew --no-daemon clean build -x test - - - uses: actions/checkout@v4 - - name: Pull powpeg-node - run: | - git clone https://github.com/rsksmart/powpeg-node.git powpeg-node - cd powpeg-node && git checkout ${{ github.event.inputs.FEDERATOR_BRANCH }} - cp ../.github/scripts/configure_gradle_federator.sh . - ./configure.sh && chmod +x ./gradlew && chmod +x configure_gradle_federator.sh - ./configure_gradle_federator.sh - ./gradlew --no-daemon clean build - - - uses: actions/checkout@v4 - - name: Pull hsm - run: | - git clone https://github.com/rootstock/hsm.git hsm - cd hsm && git checkout ${{ github.event.inputs.HSM_BRANCH }} - - testing: - needs: building-dependencies - runs-on: ubuntu-latest - steps: - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20.x' - - name: Check Node.js version - run: node --version diff --git a/.gitignore b/.gitignore index a33923ed..791c6718 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ config/*.js logs .env .DS_Store +.secrets \ No newline at end of file