build(deps): bump github/codeql-action from 3.26.12 to 3.27.5 #2005
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test | |
on: | |
push: | |
branches: | |
- "master" | |
- "*-rc" | |
pull_request: | |
types: [opened, reopened, synchronize] | |
branches: | |
- "**" | |
# Declare default permissions as read only. | |
permissions: read-all | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 #v4.2.1 | |
- name: Setup Java & Gradle | |
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 #v4.4.0 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'gradle' | |
- 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@3624ceb22c1c5a301c8db4169662070a689d9ea8 #v4.1.1 | |
name: Cache Gradle Wrapper | |
id: cache-gradle-wrapper | |
with: | |
path: | | |
gradle/wrapper/gradle-wrapper.jar | |
key: gradle-wrapper-v1 | |
- name: Get Gradle wrapper | |
if: steps.cache-gradle-wrapper.outputs.cache-hit != 'true' | |
run: | | |
./configure.sh | |
- name: Build | |
run: | | |
./gradlew --no-daemon --stacktrace build -x test -x checkstyleMain -x checkstyleTest -x checkstyleJmh -x checkstyleIntegrationTest -x spotlessApply -x spotlessJavaCheck | |
- name: Archive build artifacts | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3 | |
with: | |
name: build-files | |
path: | | |
rskj-core/build | |
smell-test: | |
needs: unit-tests-java17 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 #v4.2.1 | |
with: | |
fetch-depth: 0 | |
- name: Setup Java & Gradle | |
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 #v4.4.0 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'gradle' | |
- uses: actions/cache/restore@3624ceb22c1c5a301c8db4169662070a689d9ea8 #v4.1.1 | |
name: Restore Gradle Wrapper | |
with: | |
path: | | |
gradle/wrapper/gradle-wrapper.jar | |
key: gradle-wrapper-v1 | |
fail-on-cache-miss: true | |
- name: Download build artifacts | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 #v4.1.8 | |
with: | |
name: build-files | |
path: | | |
rskj-core/build | |
- name: Download test results | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 #v4.1.8 | |
with: | |
name: test-results | |
path: | | |
rskj-core/build/test-results/ | |
- name: Download test reports | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 #v4.1.8 | |
with: | |
name: test-reports | |
path: | | |
rskj-core/build/reports/ | |
- name: Run SonarQube analysis | |
env: | |
GH_EVENT: ${{ github.event_name }} | |
GH_PR_NUMBER: ${{ github.event.pull_request.number }} | |
GH_PR_BASE_REF: ${{ github.base_ref }} | |
GH_PR_HEAD_REF: ${{ github.head_ref }} | |
GH_REF: ${{ github.ref }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
if [ "$GH_EVENT" = "pull_request" ]; then | |
if [ "$SONAR_TOKEN" != "" ]; then | |
./gradlew -Dorg.gradle.jvmargs=-Xmx5g sonar --no-daemon -x build -x test \ | |
-Dsonar.pullrequest.base="$GH_PR_BASE_REF" \ | |
-Dsonar.pullrequest.branch="$GH_PR_HEAD_REF" \ | |
-Dsonar.pullrequest.key="$GH_PR_NUMBER" \ | |
-Dsonar.token="$SONAR_TOKEN" | |
else | |
echo "Skipping SonarQube analysis." | |
fi | |
else | |
./gradlew -Dorg.gradle.jvmargs=-Xmx5g sonar --no-daemon -x build -x test \ | |
-Dsonar.branch.name="$GH_REF" \ | |
-Dsonar.token="$SONAR_TOKEN" | |
fi | |
mining-tests: | |
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 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 #v4.2.1 | |
- name: Setup Node.js | |
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 #v4.0.4 | |
with: | |
node-version: '12.x' | |
- name: Check Node.js version | |
run: node --version | |
- name: Checkout Mining Integration Tests Repository | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 #v4.2.1 | |
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: | | |
jq 'if .bitcoind.url? then .bitcoind.url = "localhost" else error(".bitcoind.url not found") end' config.json > config.json.tmp && mv config.json.tmp config.json | |
- name: Generate BTC blocks | |
working-directory: mining-integration-tests | |
run: | | |
node --unhandled-rejections=strict generateBtcBlocks.js | |
- name: Setup Java & Gradle | |
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 #v4.4.0 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'gradle' | |
- uses: actions/cache/restore@3624ceb22c1c5a301c8db4169662070a689d9ea8 #v4.1.1 | |
name: Restore Gradle Wrapper | |
with: | |
path: | | |
gradle/wrapper/gradle-wrapper.jar | |
key: gradle-wrapper-v1 | |
fail-on-cache-miss: true | |
- name: Download build artifacts | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 #v4.1.8 | |
with: | |
name: build-files | |
path: | | |
rskj-core/build | |
- 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 - -) | |
echo "Using RskJ version $version at ../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=$! | |
tries=0 | |
MAX_TRIES=10 | |
while [ $tries -lt $MAX_TRIES ]; do | |
nc -z 127.0.0.1 4444 && break | |
echo "Waiting for RskJ..." | |
tries=$((tries+1)) | |
sleep 1 | |
done | |
if [ $tries -eq $MAX_TRIES ]; then | |
echo "RskJ unreachable after $MAX_TRIES attempts. Aborting." >&2 | |
exit 1 | |
fi | |
npm test | |
kill $rskpid | |
unit-tests-java17: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 #v4.2.1 | |
- name: Setup Java & Gradle | |
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 #v4.4.0 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'gradle' | |
- uses: actions/cache/restore@3624ceb22c1c5a301c8db4169662070a689d9ea8 #v4.1.1 | |
name: Restore Gradle Wrapper | |
with: | |
path: | | |
gradle/wrapper/gradle-wrapper.jar | |
key: gradle-wrapper-v1 | |
fail-on-cache-miss: true | |
- name: Run tests | |
run: | | |
./gradlew --no-daemon --stacktrace test | |
- name: Persist test results for sonar | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3 | |
with: | |
name: test-results | |
path: | | |
rskj-core/build/test-results/ | |
- name: Persist test reports for sonar | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #v4.4.3 | |
with: | |
name: test-reports | |
path: | | |
rskj-core/build/reports/ | |
unit-tests-java21: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 #v4.2.1 | |
- name: Setup Java & Gradle | |
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 #v4.4.0 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: 'gradle' | |
- uses: actions/cache/restore@3624ceb22c1c5a301c8db4169662070a689d9ea8 #v4.1.1 | |
name: Restore Gradle Wrapper | |
with: | |
path: | | |
gradle/wrapper/gradle-wrapper.jar | |
key: gradle-wrapper-v1 | |
fail-on-cache-miss: true | |
- name: Run tests | |
run: | | |
./gradlew --no-daemon --stacktrace test | |
integration-tests: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 #v4.2.1 | |
- name: Setup Java & Gradle | |
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 #v4.4.0 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'gradle' | |
- uses: actions/cache/restore@3624ceb22c1c5a301c8db4169662070a689d9ea8 #v4.1.1 | |
name: Restore Gradle Wrapper | |
with: | |
path: | | |
gradle/wrapper/gradle-wrapper.jar | |
key: gradle-wrapper-v1 | |
fail-on-cache-miss: true | |
- name: Run tests | |
run: | | |
./gradlew --no-daemon --stacktrace integrationTest |