diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 421a05e5770..ae0477d8374 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -14,23 +14,16 @@ jobs: runs-on: ubuntu-latest container: image: openjdk:8-jdk - env: - _JAVA_OPTIONS: "-Xmx3G -Xms2G" defaults: run: working-directory: . steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - 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 - @@ -58,8 +51,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Setup Java JDK uses: actions/setup-java@v3 @@ -67,9 +58,6 @@ jobs: java-version: '17' distribution: 'temurin' - - name: Verify Java installation - run: java -version - - uses: actions/cache@v4 name: Restore Gradle cache with: @@ -81,21 +69,17 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - - name: Get Gradle jar - run: | - if [ ! -f ./gradle/wrapper/gradle-wrapper.jar ]; then - ./configure.sh - fi +# - name: Get Gradle jar +# run: | +# if [ ! -f ./gradle/wrapper/gradle-wrapper.jar ]; then +# ./configure.sh +# fi - 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 + if [[ "${{ github.event_name }}" == "pull_request" ]]; then 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 }} @@ -118,18 +102,12 @@ jobs: run: working-directory: . steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - 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 @@ -141,19 +119,17 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - - name: Get Gradle jar - run: | - if [ ! -f ./gradle/wrapper/gradle-wrapper.jar ]; then - ./configure.sh - fi +# - name: Get Gradle jar +# run: | +# if [ ! -f ./gradle/wrapper/gradle-wrapper.jar ]; then +# ./configure.sh +# fi - 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 @@ -166,20 +142,20 @@ jobs: needs: build runs-on: ubuntu-latest services: - bitcoind1: - image: ghcr.io/rsksmart/rskj/mit_bitcoind1:latest - ports: - - 8331:8331 - - 31591:31591 - - 32591:32591 - options: --name bitcoind1 - bitcoind2: - image: ghcr.io/rsksmart/rskj/mit_bitcoind2:latest - ports: - - 8332:8332 - - 31592:31592 - - 32592:32592 - options: --name bitcoind2 + bitcoind1: + image: ghcr.io/rsksmart/rskj/mit_bitcoind1:latest + ports: + - 8331:8331 + - 31591:31591 + - 32591:32591 + options: --name bitcoind1 + bitcoind2: + image: ghcr.io/rsksmart/rskj/mit_bitcoind2:latest + ports: + - 8332:8332 + - 31592:31592 + - 32592:32592 + options: --name bitcoind2 steps: - name: Checkout uses: actions/checkout@v4 @@ -220,9 +196,6 @@ jobs: java-version: '17' distribution: 'temurin' - - name: Verify Java installation - run: java -version - - uses: actions/cache@v4 name: Restore gradle cache with: @@ -233,13 +206,13 @@ jobs: key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} restore-keys: | ${{ runner.os }}-gradle- +# +# - name: Get Gradle jar +# run: | +# if [ ! -f ./gradle/wrapper/gradle-wrapper.jar ]; then +# ./configure.sh +# fi - - name: Get Gradle jar - run: | - if [ ! -f ./gradle/wrapper/gradle-wrapper.jar ]; then - ./configure.sh - fi - - name: Start RSKj and Run Tests working-directory: mining-integration-tests run: | @@ -247,16 +220,12 @@ jobs: | 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 + export tries=0 + export MAX_TRIES=10 + until nc -z 127.0.0.1 4444 || [ $tries -eq $MAX_TRIES ]; do + echo "Waiting for RskJ..." + export tries=$((tries+1)) + sleep 1 + done + npm test + kill -9 $rskpid