Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Mindov <antonio.mindov@limechain.tech>
  • Loading branch information
rokn committed Dec 20, 2023
2 parents 0e52435 + b86ee46 commit 04f55bf
Show file tree
Hide file tree
Showing 103 changed files with 1,001 additions and 552 deletions.
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ updates:
interval: weekly
open-pull-requests-limit: 10

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
158 changes: 107 additions & 51 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,61 +12,72 @@ on:
- develop
- release/*

defaults:
run:
shell: bash

permissions:
contents: read

env:
LC_ALL: C.UTF-8
GRADLE_CACHE_USERNAME: ${{ secrets.GRADLE_CACHE_USERNAME }}
GRADLE_CACHE_PASSWORD: ${{ secrets.GRADLE_CACHE_PASSWORD }}

jobs:
compile:
runs-on: ubuntu-latest

name: Code Compiles
runs-on: [ self-hosted, Linux, medium, ephemeral ]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v2
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Setup Java
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
java-version: '17'
distribution: 'adopt'
- name: Cache Gradle packages
uses: actions/cache@v2
distribution: temurin
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Compile SDK
run: ./gradlew compileJava
- name: Compile Tests
run: ./gradlew compileTestJava
- name: Compile Integration Tests
run: ./gradlew compileIntegrationTestJava
- name: Compile Examples
run: ./gradlew :examples:compileJava
- name: Generate Javadoc
run: ./gradlew sdk:javadoc
test:
runs-on: ubuntu-latest
cache-read-only: false

- name: Compile SDK & Javadoc
run: ./gradlew assemble :sdk:javadoc -Dfile.encoding=UTF-8 --scan

unit-tests:
name: Unit Tests
runs-on: [ self-hosted, Linux, medium, ephemeral ]
needs:
- compile
steps:
- uses: actions/checkout@v2
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v2

- name: Setup NodeJS
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
java-version: '17'
distribution: 'adopt'
- name: Cache Gradle packages
uses: actions/cache@v2
node-version: 18

- name: Setup Java
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
distribution: temurin
java-version: 17

- name: Start the local node
- name: Setup Gradle
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0

- name: Install Local Node
run: npm install @hashgraph/hedera-local@2.13.0

- name: Compile Code
run: ./gradlew assemble --scan

- name: Start Local Node
run: npx @hashgraph/hedera-local start -d --network local

- name: Run Tests
Expand All @@ -75,17 +86,62 @@ jobs:
OPERATOR_ID: '0.0.1022'
HEDERA_NETWORK: 'localhost'
run: |
./gradlew -POPERATOR_ID=$OPERATOR_ID -POPERATOR_KEY=$OPERATOR_KEY -PHEDERA_NETWORK=$HEDERA_NETWORK jacocoTestReport
./gradlew -POPERATOR_ID=$OPERATOR_ID -POPERATOR_KEY=$OPERATOR_KEY -PHEDERA_NETWORK=$HEDERA_NETWORK jacocoTestReport --scan
- name: Build with Sonar
if: github.event_name == 'push' || (github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')
- name: Sonar Scan
if: ${{ github.event_name == 'push' || (github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonarqube --info
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonarqube --info --scan

- name: Publish To Codecov
if: always()
uses: codecov/codecov-action@v3
if: ${{ github.event_name == 'push' || (github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]') }}
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4

- name: Stop the local node
run: npx @hashgraph/hedera-local stop

example-tests:
name: Example Code Tests
runs-on: [ self-hosted, Linux, medium, ephemeral ]
needs:
- compile
steps:
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Setup NodeJS
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: 18

- name: Setup Java
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
distribution: temurin
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0

- name: Install Local Node
run: npm install @hashgraph/hedera-local@2.13.0

- name: Compile Code
run: ./gradlew assemble --scan

- name: Start the local node
run: npx @hashgraph/hedera-local start -d --network local

- name: Prepare .env for Examples
run: |
echo "OPERATOR_KEY=0xa608e2130a0a3cb34f86e757303c862bee353d9ab77ba4387ec084f881d420d4" > examples/.env
echo "OPERATOR_ID=0.0.1022" >> examples/.env
echo "HEDERA_NETWORK=localhost" >> examples/.env
- name: Run Examples
run: ./gradlew :examples:runAllExamples --scan

- name: Stop the local node
run: npx @hashgraph/hedera-local stop
File renamed without changes.
File renamed without changes.
File renamed without changes.
86 changes: 47 additions & 39 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
name: Upload Github Pages

on:
push:
branches:
- main
push:
branches:
- main

defaults:
run:
shell: bash

permissions:
id-token: write
pages: write

env:
LC_ALL: C.UTF-8

jobs:
upload-pages:
runs-on: ubuntu-latest
permissions:
pages: 'write'
id-token: 'write'
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Compile SDK
run: ./gradlew compileJava
- name: Generate Javadoc
run: ./gradlew sdk:javadoc
- name: Pages
uses: actions/upload-pages-artifact@v1
with:
path: './sdk/build/docs/javadoc'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
publish:
name: Publish
runs-on: [ self-hosted, Linux, medium, ephemeral ]
steps:
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Setup Java
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
distribution: temurin
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0

- name: Compile SDK
run: ./gradlew compileJava --scan

- name: Generate Javadoc
run: ./gradlew sdk:javadoc -Dfile.encoding=UTF-8 --scan

- name: Pages
uses: actions/upload-pages-artifact@a753861a5debcf57bf8b404356158c8e1e33150c # v2.0.0
with:
path: ./sdk/build/docs/javadoc

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@13b55b33dd8996121833dbc1db458c793a334630 # v3.0.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
101 changes: 101 additions & 0 deletions .github/workflows/release-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Release Artifacts

on:
push:
tags:
- 'v*.*.*'

defaults:
run:
shell: bash

permissions:
contents: read

env:
LC_ALL: C.UTF-8
GRADLE_CACHE_USERNAME: ${{ secrets.GRADLE_CACHE_USERNAME }}
GRADLE_CACHE_PASSWORD: ${{ secrets.GRADLE_CACHE_PASSWORD }}

jobs:
validate-release:
name: Validate Release
runs-on: [ self-hosted, Linux, medium, ephemeral ]
steps:
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Retrieve Tag Version
id: tag
run: echo "version=${GITHUB_REF#refs/tags/v}" >> "${GITHUB_OUTPUT}"

- name: Setup Java
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
distribution: temurin
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0
with:
cache-read-only: false

- name: Determine Project Version
id: project
run: echo "version=$(./gradlew -q showVersion | tr -d '[:space:]')" >> "${GITHUB_OUTPUT}"

- name: Validate Release
run: |
if [[ "${{ steps.tag.outputs.version }}" != "${{ steps.project.outputs.version }}" ]]; then
echo "::error file=version.gradle,line=5,title=Version Mismatch::Tag version '${{ steps.tag.outputs.version }}' does not match the Gradle project version '${{ steps.project.outputs.version }}'. Please update the 'version.gradle' file before tagging."
exit 1
fi
maven-central:
name: Publish to Maven Central
runs-on: [ self-hosted, Linux, medium, ephemeral ]
needs:
- validate-release
steps:
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Install GnuPG Tools
if: ${{ inputs.dry-run-enabled != true }}
run: |
if ! command -v gpg2 >/dev/null 2>&1; then
echo "::group::Updating APT Repository Indices"
sudo apt update
echo "::endgroup::"
echo "::group::Installing GnuPG Tools"
sudo apt install -y gnupg2
echo "::endgroup::"
fi
- name: Import GPG key
id: gpg_key
uses: crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # v6.0.0
with:
gpg_private_key: ${{ secrets.GPG_KEY_CONTENTS }}
passphrase: ${{ secrets.GPG_KEY_PASSPHRASE }}
git_config_global: true
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true

- name: Setup Java
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
distribution: temurin
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0
with:
cache-read-only: false

- name: Compile SDK & Javadoc
run: ./gradlew assemble :sdk:javadoc -Dfile.encoding=UTF-8 --scan

- name: Nexus Release
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository --no-parallel -Dfile.encoding=UTF-8 --scan -PsonatypeUsername=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }}
Loading

0 comments on commit 04f55bf

Please sign in to comment.