Skip to content

Commit

Permalink
Merge pull request #173 from thinkAfCod/remove_bin
Browse files Browse the repository at this point in the history
build: remove build binary task
  • Loading branch information
thinkAfCod authored Jul 3, 2024
2 parents 3b10955 + a2d71aa commit 7d633ad
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 11,255 deletions.
203 changes: 3 additions & 200 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,170 +21,6 @@ env:
IMAGE_NAME: ${{ github.repository }}

jobs:
native-build-osx:
name: GraalVM latest ${{ matrix.java-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
java-version: [ '21' ]
os: [ macos-latest ]

outputs:
version: ${{ github.ref_name }}

steps:
- name: 🛎️ Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: ☕ Setup GraalVM Build
uses: graalvm/setup-graalvm@v1
with:
java-version: ${{ matrix.java-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
distribution: 'graalvm'
cache: 'gradle'
set-java-home: 'true'
native-image-job-reports: 'true'

- name: 🏗️ Native Image Build & Test
id: native-build
run: |
./gradlew buildBinary
mv hildr-node/build/binary/hildr-node hildr-node/build/binary/hildr-node-osx
ls -ltrh hildr-node/build/binary/hildr-node-osx
- name: 📤 Upload ${{ matrix.os }} native image
uses: actions/upload-artifact@v3
with:
name: hildr-node-osx
path: |
hildr-node/build/binary/hildr-node-osx
if-no-files-found: error

native-build-windows:
name: GraalVM latest ${{ matrix.java-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
java-version: [ '21' ]
os: [ windows-latest ]

outputs:
version: ${{ github.ref_name }}

steps:
- name: 🛎️ Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: ☕ Setup GraalVM Build
uses: graalvm/setup-graalvm@v1
with:
java-version: ${{ matrix.java-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
distribution: 'graalvm'
cache: 'gradle'
set-java-home: 'true'
native-image-job-reports: 'true'

- name: 🏗️ Native Image Build & Test
id: native-build
run: |
./gradlew buildBinaryOnWindows
ls -ltrh hildr-node/build/binary/hildr-node.exe
- name: 📤 Upload ${{ matrix.os }} native image
uses: actions/upload-artifact@v3
with:
name: hildr-node-windows
path: |
hildr-node/build/binary/hildr-node.exe
if-no-files-found: error

native-build-linux:
name: GraalVM latest ${{ matrix.java-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
java-version: [ '21' ]
os: [ ubuntu-latest ]

outputs:
version: ${{ github.ref_name }}

steps:
- name: 🛎️ Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: ☕ Setup GraalVM Build
uses: graalvm/setup-graalvm@v1
with:
java-version: ${{ matrix.java-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
distribution: 'graalvm'
cache: 'gradle'
set-java-home: 'true'
native-image-job-reports: 'true'

- name: 🏗️ Native Image Build & Test
id: native-build
run: |
./gradlew buildBinary
ls -ltrh hildr-node/build/binary/hildr-node
- name: 📤 Upload ${{ matrix.os }} native image
uses: actions/upload-artifact@v3
with:
name: hildr-node-linux
path: |
hildr-node/build/binary/hildr-node
hildr-node/build/binary/hildr-node.jar
if-no-files-found: error

# native-build-musl:
# name: GraalVM + musl static image
# runs-on: ubuntu-latest
#
# steps:
# - name: 🛎️ Check out repository
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
#
# - name: ☕ Setup GraalVM Build
# uses: graalvm/setup-graalvm@v1
# with:
# java-version: '21'
# distribution: 'graalvm'
# github-token: ${{ secrets.GITHUB_TOKEN }}
# cache: 'gradle'
# native-image-musl: 'true'
# native-image-job-reports: 'true'
# set-java-home: 'true'
#
# - name: 🏗️ Build static image with musl libc
# id: native-build
# run: |
# ./gradlew buildBinaryStatic
# mv hildr-node/build/binary/hildr-node hildr-node/build/binary/hildr-node-static
# ls -ltrh hildr-node/build/binary/hildr-node-static
#
# - name: 📤 Upload static binary
# uses: actions/upload-artifact@v3
# with:
# name: hildr-node-static
# path: |
# hildr-node/build/binary/hildr-node-static
# if-no-files-found: error

push_image_to_github:
name: Push Docker image to Github
runs-on: ubuntu-latest
Expand All @@ -211,48 +47,15 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/jvm.dock
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

push_native_image_to_github:
name: Push Docker Native image to Github
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
flavor: |
suffix=-native,onlatest=true
images: ${{ env.REGISTRY }}/${{ github.repository }}
tags: |
type=semver,pattern={{raw}}
- name: Build and push graalvm native Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
file: ./docker/node.dock
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


release:
name: 🚰 Release new version.
needs: [ native-build-osx, native-build-linux, native-build-windows, push_image_to_github, push_native_image_to_github ]
needs: [ push_image_to_github ]
runs-on: ubuntu-latest

steps:
Expand All @@ -277,7 +80,7 @@ jobs:
with:
path: release-artifacts

- name: ✨Github Release (version = ${{ needs.native-build-osx.outputs.version }})
- name: ✨Github Release (version = ${{ needs.push_image_to_github.outputs.version }})
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.github_release.outputs.changelog }}
Expand Down
13 changes: 0 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,6 @@ You also can run a hildr-node on [devnet](./docs/devnet.md)
./gradlew build
```

### Build native

```shell
# use graalvm native plugin
./gradlew nativeCompile

# use native-image directly
./gradlew buildBinary

# build static binary
./gradlew buildBinaryStatic
```

## Javadoc

For the latest javadocs for the `main` branch, run `./gradlew javadoc` and open
Expand Down
52 changes: 0 additions & 52 deletions docker/Dockerfile

This file was deleted.

30 changes: 3 additions & 27 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,12 @@ services:
# image: ghcr.io/optimism-java/hildr:latest
container_name: hildr-node
build:
dockerfile: ./docker/jvm.dock
dockerfile: ./docker/node.dock
context: ../
profiles:
- hildr-node
restart: unless-stopped
stop_grace_period: 3m
entrypoint: /scripts/start-hildr-node-java.sh
depends_on:
- op-geth
env_file:
- .env
ports:
- "9200:9200"
- "${ROLLUP_RPC_PORT}:${ROLLUP_RPC_PORT}"
volumes:
- ./:/scripts
- data:/data
- ${OP_ROLLUP_JSON_FILEPATH:-.}:/rollup.json
<<: *logging

hildr-node-native:
# image: ghcr.io/optimism-java/hildr:latest
container_name: hildr-node
build:
dockerfile: ./docker/Dockerfile
context: ../
profiles:
- hildr-node-native
restart: unless-stopped
stop_grace_period: 3m
entrypoint: /scripts/start-hildr-node.sh
depends_on:
- op-geth
Expand All @@ -65,7 +41,7 @@ services:
- hildr-batcher
restart: unless-stopped
stop_grace_period: 3m
entrypoint: /scripts/start-hildr-batcher-java.sh
entrypoint: /scripts/start-hildr-batcher.sh
depends_on:
- op-geth
env_file:
Expand All @@ -85,7 +61,7 @@ services:
- hildr-proposer
restart: unless-stopped
stop_grace_period: 3m
entrypoint: /scripts/start-hildr-batcher-java.sh
entrypoint: /scripts/start-hildr-batcher.sh
depends_on:
- op-geth
env_file:
Expand Down
2 changes: 1 addition & 1 deletion docker/jvm.dock → docker/node.dock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ FROM ghcr.io/graalvm/graalvm-community:21

WORKDIR /usr/local/bin
COPY --from=builder /root/hildr/hildr-node/build/docker/hildr-node.jar .
COPY --from=builder /root/hildr/docker/start-hildr-node-java.sh .
COPY --from=builder /root/hildr/docker/start-hildr-node.sh .
ENV HILDR_JAR /usr/local/bin/hildr-node.jar
ENV HILDR_MAIN_CLASS io.optimism.Hildr

Expand Down
File renamed without changes.
Loading

0 comments on commit 7d633ad

Please sign in to comment.