Skip to content

feat(ci): uses rsksmart docker images #205

feat(ci): uses rsksmart docker images

feat(ci): uses rsksmart docker images #205

name: Build and Test
on:
push:
branches:
- '**'
pull_request:
types: [opened, reopened, ready_for_review]
branches:
- '**'
jobs:
# build:
# runs-on: ubuntu-latest
# container:
# image: openjdk:8-jdk
# env:
# _JAVA_OPTIONS: "-Xmx3G -Xms2G"
# defaults:
# run:
# working-directory: .
# steps:
# - uses: actions/checkout@v2
# - name: Setup System Tools
# run: |
# apt update -y
# apt install -y gnupg2 curl
# - name: Install Node.js
# run: |
# curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
# apt-get install -y nodejs
# - name: Check Node.js version
# run: node --version
# - name: Verify files
# run: |
# curl -sSL https://secchannel.rsk.co/SUPPORT.asc | gpg2 --import -
# gpg2 --verify SHA256SUMS.asc && sha256sum --check SHA256SUMS.asc
#
# - uses: actions/cache@v4
# name: Cache Gradle
# with:
# path: |
# .gradle/caches
# gradle/wrapper
# *************rskj-core/build
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
# restore-keys: |
# ${{ runner.os }}-gradle-
#
# - name: Build
# run: |
# ./configure.sh
# ./gradlew --no-daemon dependencies
# ./gradlew --no-daemon --stacktrace build -x test
# ls -la ./gradle/wrapper/gradle-wrapper.jar
sonarqube:
# needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Verify Java installation
run: java -version
- name: Build
run: |
./configure.sh
./gradlew --no-daemon dependencies
./gradlew --no-daemon --stacktrace build -x test
ls -la ./gradle/wrapper/gradle-wrapper.jar
- name: Run SonarQube analysis
run: |
sudo apt-get update && sudo apt-get install -yqq git
extra_flags=""
if [ -n "$CIRCLE_PULL_REQUEST" ]; then
# https://community.sonarsource.com/t/no-code-or-issue-found-in-pull-request-decorations-github-circleci/8496
git branch -f master origin/master
# extract PR number, as PR URLs are in the form
# https://github.com/$user/$repo/pull/$pr_number
pr_number==${{ github.event.pull_request.number }}
extra_flags="-Dsonar.pullrequest.base=master
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.key=$pr_number"
else
extra_flags="-Dsonar.branch.name=master"
fi
pwd
ls -al
./gradlew sonarqube --no-daemon -x build -x test \
$extra_flags \
-Dsonar.organization=rsksmart \
-Dsonar.host.url="https://sonarcloud.io" \
-Dsonar.login="${{ secrets.SONAR_TOKEN }}"
# tests:
# needs: build
# runs-on: ubuntu-latest
# container:
# image: openjdk:8-jdk
# defaults:
# run:
# working-directory: .
# steps:
# - uses: actions/checkout@v2
#
# - name: Setup System Tools
# run: |
# apt update -y
# apt install -y curl
# - name: Install Node.js
# run: |
# curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
# apt-get install -y nodejs
# - name: Check Node.js version
# run: node --version
#
# - uses: actions/cache@v4
# name: Restore gradle cache
# with:
# path: |
# .gradle/caches
# gradle/wrapper
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
# restore-keys: |
# ${{ runner.os }}-gradle-
#
# - name: Get Gradle jar
# run: |
# ./configure.sh
#
# - name: Unit tests
# run: |
# chmod +x ./gradlew
# ./gradlew --no-daemon --stacktrace test
# - name: Integration tests
# run: |
# chmod +x ./gradlew
# ./gradlew --no-daemon --stacktrace integrationTest
#
# - name: Save test results
# run: |
# mkdir -p ~/junit/
# find rskj-core/build/test-results -type f -name "*.xml" -exec cp {} ~/junit/ \;
# if: always()
# build-push-docker-images:
# runs-on: ubuntu-latest
# steps:
# - name: Check out the mining integration tests repository
# uses: actions/checkout@v4
# with:
# repository: jurajpiar/mining-integration-tests
## ref: 8bbfd75328344eeff567c93ad15db1e864ba6445
# token: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Log in to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
#
# - name: Build and push Docker images
# run: |
# docker build -t jurajpiar/mit_bitcoind1:latest -f bitcoind1.Dockerfile .
# docker push jurajpiar/mit_bitcoind1:latest
# docker build -t jurajpiar/mit_bitcoind2:latest -f bitcoind2.Dockerfile .
# docker push jurajpiar/mit_bitcoind2:latest
#
#
# mining-tests:
# needs:
# - build-push-docker-images
# - build
# runs-on: ubuntu-latest
# services:
# bitcoind1:
# image: jurajpiar/mit_bitcoind1:latest
# ports:
# - 8331:8331
# - 31591:31591
# - 32591:32591
# options: --name bitcoind1
# bitcoind2:
# image: jurajpiar/mit_bitcoind2:latest
# ports:
# - 8332:8332
# - 31592:31592
# - 32592:32592
# options: --name bitcoind2
# steps:
# - name: Checkout
# uses: actions/checkout@v4
#
# - name: Setup Node.js
# uses: actions/setup-node@v4
# with:
# node-version: '12.x'
# - name: Check Node.js version
# run: node --version
#
# - name: Checkout Mining Integration Tests Repository
# uses: actions/checkout@v4
# with:
# repository: rsksmart/mining-integration-tests
# ref: ${{ secrets.MINING_INTEGRATION_TESTS_REF }}
# token: ${{ secrets.GITHUB_TOKEN }}
# path: mining-integration-tests
#
# - name: Install Mining Integration Tests dependencies
# working-directory: mining-integration-tests
# run: |
# npm ci
#
# - name: Change mining-integration-tests bitcoind url in config.json to localhost
# working-directory: mining-integration-tests
# run: |
# sed -i 's/bitcoind01/localhost/g' config.json
#
# - name: Generate BTC blocks
# working-directory: mining-integration-tests
# run: |
# node --unhandled-rejections=strict generateBtcBlocks.js
#
# - name: Setup Java JDK
# uses: actions/setup-java@v3
# with:
# java-version: '17'
# distribution: 'temurin'
#
# - name: Verify Java installation
# run: java -version
#
# - uses: actions/cache@v4
# name: Restore gradle cache
# with:
# path: |
# .gradle/caches
# gradle/wrapper
# rsk-core/build
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
# restore-keys: |
# ${{ runner.os }}-gradle-
#
# - name: Build
# run: |
# if [ ! -d rskj-core/build ]; then # FIXME: remove this condition after the cache is fixed
# ./configure.sh
# ./gradlew --no-daemon dependencies
# ./gradlew --no-daemon --stacktrace build -x test
# fi
# - name: Start RSKj and Run Tests
# working-directory: mining-integration-tests
# run: |
# version=$(tr -d "'\"" < ../rskj-core/src/main/resources/version.properties \
# | cut -d = -f 2- | paste -sd - -)
# ls -la ../rskj-core/build/libs/rskj-core-"$version"-all.jar
# java -Drsk.conf.file=./rsk-integration-test.conf -cp ../rskj-core/build/libs/rskj-core-"$version"-all.jar co.rsk.Start --regtest & rskpid=$!
# until nc -z 127.0.0.1 4444
# do
# echo "Waiting for RskJ..."
# sleep 1
# done
# npm test
# kill $rskpid
#
# - name: Review test results
# working-directory: mining-integration-tests
# if: always()
# run: |
# cat ./Results/mocha/Test-Results.xml