Skip to content

Commit

Permalink
squash me
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajpiar committed May 16, 2024
1 parent b977942 commit 48a3466
Showing 1 changed file with 43 additions and 74 deletions.
117 changes: 43 additions & 74 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 -
Expand Down Expand Up @@ -58,18 +51,13 @@ jobs:
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

- uses: actions/cache@v4
name: Restore Gradle cache
with:
Expand All @@ -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 }}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -233,30 +206,26 @@ 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: |
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
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

0 comments on commit 48a3466

Please sign in to comment.