Skip to content

Commit

Permalink
cargo dist
Browse files Browse the repository at this point in the history
  • Loading branch information
seunlanlege committed May 14, 2024
1 parent 3e68bda commit 22acd57
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/hyperbridge-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:

jobs:
build_and_publish:
runs-on: arc-runner-set
runs-on: release-runner
steps:
- name: Checkout sources
uses: actions/checkout@v3
Expand Down
83 changes: 45 additions & 38 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright 2022-2023, axodotdev
# Copyright 2022-2024, axodotdev
# SPDX-License-Identifier: MIT or Apache-2.0
#
# CI that:
#
# * checks for a Git Tag that looks like a release
# * builds artifacts with cargo-dist (archives, installers, hashes)
# * uploads those artifacts to temporary workflow zip
# * on success, uploads the artifacts to a Github Release
# * on success, uploads the artifacts to a GitHub Release
#
# Note that the Github Release will be created with a generated
# Note that the GitHub Release will be created with a generated
# title/body based on your changelogs.

name: Release
Expand All @@ -31,7 +31,7 @@ permissions:
# packages versioned/released in lockstep).
#
# If you push multiple tags at once, separate instances of this workflow will
# spin up, creating an independent announcement for each one. However Github
# spin up, creating an independent announcement for each one. However, GitHub
# will hard limit this to 3 tags per commit, as it will assume more tags is a
# mistake.
#
Expand Down Expand Up @@ -76,15 +76,15 @@ jobs:
# but also really annoying to build CI around when it needs secrets to work right.)
- id: plan
run: |
cargo dist ${{ !github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name) || (github.event.pull_request.head.repo.fork && 'plan' || 'host --steps=check') }} --output-format=json > dist-manifest.json
cargo dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
echo "cargo dist ran successfully"
cat dist-manifest.json
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
cat plan-dist-manifest.json
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
- name: "Upload dist-manifest.json"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: artifacts
path: dist-manifest.json
name: artifacts-plan-dist-manifest
path: plan-dist-manifest.json

# Build and packages all the platform-specific things
build-local-artifacts:
Expand All @@ -106,23 +106,24 @@ jobs:
# - 1 "global" task that builds universal installers
# - N "local" tasks that build each platform's binaries and platform-specific installers
matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
# runs-on: ${{ matrix.runner }}
runs-on: arc-runner-set
# runs-on: ${{ matrix.runner }}
runs-on: release-runner
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
steps:
- name: enable windows longpaths
run: |
git config --global core.longpaths true
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
- uses: swatinem/rust-cache@v2
with:
toolchain: stable
key: ${{ join(matrix.targets, '-') }}

- uses: Swatinem/rust-cache@v2
- run: |
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --assume-yes jq pkg-config git clang curl libssl-dev llvm libudev-dev make protobuf-compiler
rustup install nightly
Expand All @@ -134,10 +135,11 @@ jobs:
run: ${{ matrix.install_dist }}
# Get the dist-manifest
- name: Fetch local artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: artifacts
pattern: artifacts-*
path: target/distrib/
merge-multiple: true
- name: Install dependencies
run: |
${{ matrix.packages_install }}
Expand All @@ -155,14 +157,14 @@ jobs:
run: |
# Parse out what we just built and upload it to scratch storage
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json >> "$GITHUB_OUTPUT"
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
- name: "Upload artifacts"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: artifacts
name: artifacts-build-local-${{ join(matrix.targets, '_') }}
path: |
${{ steps.cargo-dist.outputs.paths }}
${{ env.BUILD_MANIFEST_NAME }}
Expand All @@ -181,13 +183,15 @@ jobs:
with:
submodules: recursive
- name: Install cargo-dist
shell: bash
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh"
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
- name: Fetch local artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: artifacts
pattern: artifacts-*
path: target/distrib/
merge-multiple: true
- id: cargo-dist
shell: bash
run: |
Expand All @@ -196,14 +200,14 @@ jobs:
# Parse out what we just built and upload it to scratch storage
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json >> "$GITHUB_OUTPUT"
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
- name: "Upload artifacts"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: artifacts
name: artifacts-build-global
path: |
${{ steps.cargo-dist.outputs.paths }}
${{ env.BUILD_MANIFEST_NAME }}
Expand All @@ -228,11 +232,12 @@ jobs:
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh"
# Fetch artifacts from scratch-storage
- name: Fetch artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: artifacts
pattern: artifacts-*
path: target/distrib/
# This is a harmless no-op for Github Releases, hosting for that happens in "announce"
merge-multiple: true
# This is a harmless no-op for GitHub Releases, hosting for that happens in "announce"
- id: host
shell: bash
run: |
Expand All @@ -241,12 +246,13 @@ jobs:
cat dist-manifest.json
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
- name: "Upload dist-manifest.json"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: artifacts
# Overwrite the previous copy
name: artifacts-dist-manifest
path: dist-manifest.json

# Create a Github Release while uploading all files to it
# Create a GitHub Release while uploading all files to it
announce:
needs:
- plan
Expand All @@ -262,16 +268,17 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: "Download Github Artifacts"
uses: actions/download-artifact@v3
- name: "Download GitHub Artifacts"
uses: actions/download-artifact@v4
with:
name: artifacts
pattern: artifacts-*
path: artifacts
merge-multiple: true
- name: Cleanup
run: |
# Remove the granular manifests
rm -f artifacts/*-dist-manifest.json
- name: Create Github Release
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.plan.outputs.tag }}
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ unix-archive = ".tar.gz"
# Publish jobs to run in CI
pr-run-mode = "upload"
# Skip checking whether the specified configuration files are up to date
allow-dirty = ["ci"]
# allow-dirty = ["ci"]
# Whether to install an updater program
install-updater = true
install-updater = false

# The profile that 'cargo dist' will build with
[profile.dist]
Expand Down
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
# Hyperbridge
Hyperbridge is a hyper-scalable coprocessor for cryptographically secure, cross-chain interoperability.

Hyperbridge is a hyper-scalable coprocessor for cryptographically secure, cross-chain interoperability. Join the network.

## Docker

Hyperbridge is available at the official docker repository [`polytopelabs/hyperbridge`](https://hub.docker.com/r/polytopelabs/hyperbridge)

```bash
docker run polytopelabs/hyperbridge:latest --chain=messier
docker run -d \
--name=hyperbridge \
--network=host \
--restart=always \
--volume=/$HOME:/home/root \
polytopelabs/hyperbridge:latest \
--base-path=/home/root/.nexus \
--pruning=archive \
--name="${YOUR_NODE_NAME_HERE}" \
--rpc-cors=all \
--rpc-methods=unsafe \
--chain=nexus \
--out-peers=32 \
```

## Prebuilt Binaries
Expand All @@ -30,7 +43,6 @@ curl --proto '=https' --tlsv1.2 -LsSf https://github.com/polytope-labs/hyperbrid

You can follow the steps below if you'd prefer to build the hyperbridge node from source:


### Install Dependencies

Building the hyperbridge node requires some dependencies
Expand Down Expand Up @@ -84,7 +96,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Download a local copy of the repo and checkout the latest release tag

```bash
export LATEST_TAG=v0.4.0
export LATEST_TAG=v0.4.5
git clone https://github.com/polytope-labs/hyperbridge.git
cd ./hyperbridge
git checkout ${LATEST_TAG}
Expand All @@ -110,19 +122,21 @@ cargo build --release -p hyperbridge
## Running the node

```bash
hyperbridge --chain=messier --base-path=$HOME/.hyperbridge --pruning-archive
hyperbridge --chain=nexus --base-path=$HOME/.hyperbridge --pruning-archive
```

> Note: `--enable-offchain-indexing` is enabled by default
## Running a local testnet with zombienet

Download the zombienet binary for your operating system [here](https://github.com/paritytech/zombienet).

```bash
zombienet spawn --provider native ./scripts/zombienet/local-testnet.toml
```

## Running a local testnet with docker

Build and run the hyperbridge docker image locally by running

```bash
Expand All @@ -132,7 +146,9 @@ docker compose up
```

## Building HyperClient Javascript SDK

To build hyperclient

```bash
cargo install wasm-pack
cd client
Expand Down
8 changes: 4 additions & 4 deletions docs/pages/network/node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ docker run polytopelabs/hyperbridge:latest --chain={messier|gargantua|nexus}
You can install a prebuilt binary for the hyperbridge node with the following bash script

```bash
wget -q --show-progress https://github.com/polytope-labs/hyperbridge/releases/download/v0.4.1/hyperbridge-x86_64-unknown-linux-gnu.tar.gz
wget -q --show-progress https://github.com/polytope-labs/hyperbridge/releases/download/v0.4.5/hyperbridge-x86_64-unknown-linux-gnu.tar.gz
tar -xvzf hyperbridge-x86_64-unknown-linux-gnu.tar.gz
# copy to $PATH
cp hyperbridge-x86_64-unknown-linux-gnu/hyperbridge $HOME/.local/bin/
Expand Down Expand Up @@ -91,7 +91,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Download a local copy of the repo and checkout the latest release tag

```bash
export LATEST_TAG=v0.4.1
export LATEST_TAG=v0.4.5
git clone https://github.com/polytope-labs/hyperbridge.git
cd ./hyperbridge
git checkout ${LATEST_TAG}
Expand Down Expand Up @@ -185,7 +185,7 @@ hyperbridge \

## Running the node (Kusama)

Hyperbridge is live on Kusama with a chainId of `messier` and ParaId of `3340`
Hyperbridge is live on Kusama with a chainId of `messier` and ParaId of `3340`. We don't reccomend joining the kusama network at this time.

```bash
export PUBLIC_IP_ADDRESS=<your-node-public-ip-address>
Expand All @@ -207,7 +207,7 @@ hyperbridge \

## Running the node (Polkadot)

Hyperbridge is also live on Polkadot with a chainId of `nexus` and ParaId of `3367`
Hyperbridge is also live on Polkadot with a chainId of `nexus` and ParaId of `3367`.

```bash
export PUBLIC_IP_ADDRESS=<your-node-public-ip-address>
Expand Down
Loading

0 comments on commit 22acd57

Please sign in to comment.