Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Commit

Permalink
build: Bootstrap project (#1)
Browse files Browse the repository at this point in the history
Bootstrap project with Gradle. Add Github workflows.
  • Loading branch information
usmansaleem authored Jul 25, 2024
1 parent 446f1f3 commit 4379313
Show file tree
Hide file tree
Showing 20 changed files with 865 additions and 2 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2024, Consensys Software Inc.
# SPDX-License-Identifier: Apache-2.0

# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow
# execution time. For more information see:
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

# Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2

- name: Build
run: ./gradlew clean build
24 changes: 24 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2024, Consensys Software Inc.
# SPDX-License-Identifier: Apache-2.0

# This workflow scans pull requests for dependency changes, and will raise an error if any vulnerabilities or
# invalid licenses are being introduced.
# See https://github.com/actions/dependency-review-action

name: dependency-review

on:
pull_request:

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Dependency Review'
uses: actions/dependency-review-action@0c155c5e8556a497adf53f2c18edabf945ed8e70 #4.3.2
with:
retry-on-snapshot-warnings: true
retry-on-snapshot-warnings-timeout: 600
24 changes: 24 additions & 0 deletions .github/workflows/download-dependency-graph.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2024, Consensys Software Inc.
# SPDX-License-Identifier: Apache-2.0

# This workflow downloads the saved dependency graph and submits it to GitHub, enabling Dependabot Alerts for all
# project dependencies. See upload-dependency-graph.yml which will run before this workflow.
name: download-submit-dependency-graph

on:
workflow_run:
workflows: ['upload-dependency-graph']
types: [completed]

permissions:
contents: write

jobs:
submit-dependency-graph:
runs-on: ubuntu-latest
steps:
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
- name: Download and submit dependency graph
uses: gradle/actions/dependency-submission@d211a39090cba0cdce485f2a0b1f28f39ccda0c9 # v3.3.2
with:
dependency-graph: download-and-submit # Download saved dependency-graph and submit
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2024, Consensys Software Inc.
# SPDX-License-Identifier: Apache-2.0

# This workflow will perform release of this project when a tag is pushed.

name: release

on:
push:
tags: [ "v*" ]

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --tags --force origin #workaround https://github.com/actions/checkout/issues/882
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

# Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2

- name: Clean
run: ./gradlew clean printVersion

- name: Assemble
run: ./gradlew assemble

- name: Release
run: ./gradlew jreleaserFullRelease
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_GITHUB_USERNAME: ${{ github.actor }}
JRELEASER_GITHUB_EMAIL: ${{ github.actor }}@users.noreply.github.com

# Persist jreleaser logs
- name: JReleaser logs
if: always()
uses: actions/upload-artifact@v4
with:
name: jreleaser-release
path: |
build/jreleaser/trace.log
build/jreleaser/output.properties
27 changes: 27 additions & 0 deletions .github/workflows/upload-dependency-graph.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2024, Consensys Software Inc.
# SPDX-License-Identifier: Apache-2.0

name: upload-dependency-graph

on:
pull_request:

# 'write' permission is not available on pull-request events.
# See download-dependency-graph.yml which will run after this workflow.
permissions:
contents: read

jobs:
dependency-submission:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
- name: Generate and save dependency graph
uses: gradle/actions/dependency-submission@d211a39090cba0cdce485f2a0b1f28f39ccda0c9 # v3.3.2
with:
dependency-graph: generate-and-upload
16 changes: 16 additions & 0 deletions .github/workflows/wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024, Consensys Software Inc.
# SPDX-License-Identifier: Apache-2.0

name: "Validate Gradle Wrapper"

on: [push, pull_request]

jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@d211a39090cba0cdce485f2a0b1f28f39ccda0c9
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2024, Consensys Software Inc.
# SPDX-License-Identifier: Apache-2.0

.gradle
**/build/
!src/**/build/
Expand All @@ -19,3 +22,9 @@ gradle-app.setting
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

# IntelliJ IDEA
.idea/

# Mac
.DS_Store
40 changes: 40 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Contribution guidelines

Thank you for considering contributing to Consensys finalization-updater-besu-plugin.

If your contribution is not straightforward, please first discuss the change you
wish to make by creating a new issue before making the change.

## Reporting issues

Before reporting an issue on the
[issue tracker](https://github.com/Consensys/finalization-updater-besu-plugin/issues),
please check that it has not already been reported by searching for some related
keywords.

## Pull requests

Try to do one pull request per change.

### Commit Messages

When creating pull request or squash commit message, please follow
[conventional commits specifications](https://www.conventionalcommits.org/en/v1.0.0/).


## Developing

### Set up

This is a standard gradle based Java project. You can import the project in your favorite IDE.

```shell
git clone https://github.com/Consensys/finalization-updater-besu-plugin.git
cd finalization-updater-besu-plugin
./gradlew clean build
```

---
`SPDX-License-Identifier: Apache-2.0`


56 changes: 54 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,54 @@
# finalization_updater_besu_plugin
A Linea-Besu plugin that update finalized block
# Finalization Updater Besu Plugin

A [Besu plugin][1] that provides an RPC method to record and update the finalized block that can be utilized by L2.

![GitHub Actions Workflow Status](https://github.com/Consensys/finalization-updater-besu-plugin/actions/workflows/ci.yml/badge.svg?branch=main)

## Build Instructions
You can either use pre-built jar from Assets section in [releases][2] or build it yourself.

> [!NOTE]
> This project requires Java 21 or later. If it is not available, the gradle build will attempt to download one and use it.
- Checkout the project:
```shell
git clone https://github.com/Consensys/finalization-updater-besu-plugin.git
```

- Check [Besu releases][3] for latest stable version and update it in [`gradle/libs.versions.toml`](gradle/libs.versions.toml). For example:

```toml
[versions]
besu = "24.6.0"
```

- Build the plugin:

```shell
./gradlew clean build
```

The plugin jar will be available at `build/libs/finalization-updater-besu-plugin-<version>.jar`.

## Usage

Drop the `finalization-updater-besu-plugin-<version>.jar` in the `/plugins` folder under Besu installation. This plugin
will expose following RPC methods:
```shell
linea_updateFinalizedBlockV1(finalizedBlockNumber: Long): Boolean
```

## License
`SPDX-License-Identifier: Apache-2.0`
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE) or <http://www.apache.org/licenses/LICENSE-2.0>)

### Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as
defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.

See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.

[1]: <https://besu.hyperledger.org/private-networks/reference/plugin-api-interfaces>
[2]: <https://github.com/Consensys/finalization-updater/releases>
[3]: <https://github.com/hyperledger/besu/releases>
11 changes: 11 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Project release process

This project can be released by creating and pushing an annotated tag to the repository.
The tag should be named `vX.Y.Z` where `X.Y.Z` is the version number of the release.

```shell
git tag -a v1.0.0 -m "Release v1.0.0"
git push origin v1.0.0
```
---
`SPDX-License-Identifier: Apache-2.0`
Loading

0 comments on commit 4379313

Please sign in to comment.