feat: Add E2E Local Node Smart Contracts Workflow #2
Workflow file for this run
This file contains hidden or 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
# SPDX-License-Identifier: Apache-2.0 | |
name: "Local Node Test" | |
on: | |
push: | |
branches: | |
- main | |
- release/* | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
env: | |
GRADLE_EXEC: ./gradlew | |
permissions: | |
contents: read | |
jobs: | |
local-node-test: | |
name: "Local Node Integration Tests" | |
runs-on: hiero-block-node-linux-medium | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 | |
with: | |
egress-policy: audit | |
- name: Checkout Block Node | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Expand Shallow Clone for Spotless | |
run: | | |
if [ -f .git/shallow ]; then | |
git fetch --unshallow --no-recurse-submodules | |
else | |
echo "Repository is not shallow, no need to unshallow." | |
fi | |
- name: Set up JDK 21 | |
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0 | |
with: | |
distribution: "temurin" | |
java-version: "21.0.6" | |
- name: Cache Gradle packages | |
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Build Block Node Docker Image | |
run: ${{ env.GRADLE_EXEC }} :block-node-server:createDockerImage | |
- name: Checkout Local Node | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
repository: hiero-ledger/hiero-local-node | |
path: local-node | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "18" | |
cache: "npm" | |
- name: Install Local Node Dependencies | |
run: | | |
cd local-node | |
npm install | |
- name: Modify Docker Compose | |
run: | | |
cd local-node | |
# Get the current version from the block-node project | |
BLOCK_NODE_VERSION=$(cd .. && ./gradlew :block-node:server:properties | grep "version:" | awk '{print $2}') | |
# Replace the block-node image in docker-compose.yml | |
sed -i "s|image: \"\${BLOCK_NODE_IMAGE_PREFIX}hiero-block-node:\${BLOCK_NODE_IMAGE_TAG}\"|image: \"hiero-block-node:${BLOCK_NODE_VERSION}\"|" docker-compose.yml | |
- name: Start Local Node | |
run: | | |
cd local-node | |
npm run start:block-node | |
# Next steps | |
# 1. Run Hedera Smart Contracts tests | |
# 2. Check block-node container logs | |
# 3. Handle test results and failures |