chore: sync ink-node with latest polkadot-sdk main branch #40
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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
# common variable is defined in the workflow | |
# repo env variable doesn't work for PR from forks | |
env: | |
CI_IMAGE: "paritytech/ci-unified:bullseye-1.84.1-2025-01-28-v202502131220" | |
jobs: | |
set-image: | |
# This workaround sets the container image for each job using 'set-image' job output. | |
# env variables don't work for PR from forks, so we need to use outputs. | |
runs-on: ubuntu-latest | |
outputs: | |
CI_IMAGE: ${{ steps.set_image.outputs.CI_IMAGE }} | |
steps: | |
- id: set_image | |
run: echo "CI_IMAGE=${{ env.CI_IMAGE }}" >> $GITHUB_OUTPUT | |
fmt: | |
name: Cargo fmt | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
needs: [set-image] | |
container: | |
image: ${{ needs.set-image.outputs.CI_IMAGE }} | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | |
with: | |
cache-on-failure: true | |
cache-all-crates: true | |
- name: cargo info | |
run: | | |
echo "######## rustup show ########" | |
rustup show | |
echo "######## cargo --version ########" | |
cargo --version | |
- name: Cargo fmt | |
run: cargo +nightly fmt --all -- --check | |
build-test-linux: | |
name: Build Linux | |
runs-on: ubuntu-latest | |
timeout-minutes: 240 | |
needs: [set-image, fmt] | |
container: | |
image: ${{ needs.set-image.outputs.CI_IMAGE }} | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Clone polkadot-sdk | |
run: | | |
git clone --depth 1 --branch polkadot-stable2503 https://github.com/paritytech/polkadot-sdk.git | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | |
with: | |
cache-on-failure: true | |
cache-all-crates: true | |
- name: cargo info | |
run: | | |
echo "######## rustup show ########" | |
rustup show | |
echo "######## cargo --version ########" | |
cargo --version | |
- name: Build and Test Linux | |
run: | | |
echo "######## cargo build ########" | |
cargo build --release | |
echo "######## cargo test ########" | |
cargo test --release --all | |
echo "######## Building eth-rpc ########" | |
cd polkadot-sdk | |
cargo build --locked --profile production -p pallet-revive-eth-rpc --bin eth-rpc | |
cd .. | |
echo "######## Packing artifacts ########" | |
mkdir -p ./artifacts/ink-node-linux/ | |
cp target/release/ink-node ./artifacts/ink-node-linux/ink-node | |
cp polkadot-sdk/target/production/eth-rpc ./artifacts/ink-node-linux/eth-rpc | |
ls -la ./artifacts/ink-node-linux/ | |
- name: Upload artifacts | |
uses: actions/[email protected] | |
with: | |
name: build-linux | |
path: ./artifacts | |
build-linux-arm64: | |
name: Build Linux ARM64 | |
runs-on: ubuntu-latest | |
timeout-minutes: 240 | |
needs: [ set-image, fmt ] | |
container: | |
image: ${{ needs.set-image.outputs.CI_IMAGE }} | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Install ARM64 toolchain | |
run: | | |
rustup target add aarch64-unknown-linux-gnu | |
apt update | |
apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
- name: Clone polkadot-sdk | |
run: | | |
git clone --depth 1 --branch polkadot-stable2503 https://github.com/paritytech/polkadot-sdk.git | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | |
with: | |
cache-on-failure: true | |
cache-all-crates: true | |
- name: cargo info | |
run: | | |
echo "######## rustup show ########" | |
rustup show | |
echo "######## cargo --version ########" | |
cargo --version | |
- name: Build and Test Linux ARM64 | |
env: | |
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | |
run: | | |
echo "######## cargo build ########" | |
cargo build --release --target aarch64-unknown-linux-gnu | |
echo "######## Building eth-rpc ########" | |
cd polkadot-sdk | |
cargo build --locked --profile production -p pallet-revive-eth-rpc --bin eth-rpc --target aarch64-unknown-linux-gnu | |
cd .. | |
echo "######## Packing artifacts ########" | |
mkdir -p ./artifacts/ink-node-linux-arm64/ | |
cp target/aarch64-unknown-linux-gnu/release/ink-node ./artifacts/ink-node-linux-arm64/ink-node | |
cp polkadot-sdk/target/aarch64-unknown-linux-gnu/production/eth-rpc ./artifacts/ink-node-linux-arm64/eth-rpc | |
ls -la ./artifacts/ink-node-linux-arm64/ | |
- name: Upload artifacts | |
uses: actions/[email protected] | |
with: | |
name: build-linux-arm64 | |
path: ./artifacts | |
build-macos: | |
timeout-minutes: 240 | |
runs-on: macos-latest | |
needs: [fmt] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["macos-latest"] | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Clone polkadot-sdk | |
run: | | |
git clone --depth 1 --branch polkadot-stable2503 https://github.com/paritytech/polkadot-sdk.git | |
- name: Set rust version from env file | |
run: | | |
echo $CI_IMAGE | |
RUST_VERSION=$(echo $CI_IMAGE | sed -E 's/.*ci-unified:([^-]+)-([^-]+).*/\2/') | |
echo $RUST_VERSION | |
echo "RUST_VERSION=${RUST_VERSION}" >> $GITHUB_ENV | |
- name: Set up Homebrew | |
uses: Homebrew/actions/setup-homebrew@1ccc07ccd54b6048295516a3eb89b192c35057dc # master from 12.09.2024 | |
- name: Install protobuf | |
run: brew install protobuf | |
- name: Install rust ${{ env.RUST_VERSION }} | |
uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0 | |
with: | |
cache: false | |
toolchain: ${{ env.RUST_VERSION }} | |
target: wasm32-unknown-unknown, aarch64-apple-darwin, x86_64-apple-darwin | |
components: cargo, clippy, rust-docs, rust-src, rustfmt, rustc, rust-std | |
- name: cargo info | |
run: | | |
echo "######## rustup show ########" | |
rustup show | |
echo "######## cargo --version ########" | |
cargo --version | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | |
with: | |
cache-on-failure: true | |
cache-all-crates: true | |
- name: Run cargo build | |
run: | | |
echo "######## cargo build aarch64-apple-darwin ########" | |
cargo build --release --target aarch64-apple-darwin | |
echo "######## cargo build x86_64-apple-darwin ########" | |
cargo build --release --target x86_64-apple-darwin | |
echo "######## cargo build aarch64-apple-darwin eth-rpc ########" | |
cd polkadot-sdk | |
cargo build --locked --profile production -p pallet-revive-eth-rpc --bin eth-rpc --target aarch64-apple-darwin | |
echo "######## cargo build x86_64-apple-darwin eth-rpc ########" | |
cargo build --locked --profile production -p pallet-revive-eth-rpc --bin eth-rpc --target x86_64-apple-darwin | |
cd .. | |
echo "######## Packing artifacts ########" | |
mkdir -p ./artifacts/ink-node-mac/ | |
lipo ./target/x86_64-apple-darwin/release/ink-node \ | |
./target/aarch64-apple-darwin/release/ink-node \ | |
-create -output ./artifacts/ink-node-mac/ink-node | |
lipo ./polkadot-sdk/target/x86_64-apple-darwin/production/eth-rpc \ | |
./polkadot-sdk/target/aarch64-apple-darwin/production/eth-rpc \ | |
-create -output ./artifacts/ink-node-mac/eth-rpc | |
ls -la ./artifacts/ink-node-mac/ | |
- name: Upload artifacts | |
uses: actions/[email protected] | |
with: | |
name: build-macos | |
path: ./artifacts | |
publish: | |
name: Publish release | |
runs-on: ubuntu-latest | |
needs: [ build-test-linux, build-macos, build-linux-arm64 ] | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: build-linux | |
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: build-macos | |
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: build-linux-arm64 | |
- name: Pack artifacts | |
run: | | |
tar -czvf ./ink-node-linux.tar.gz ./ink-node-linux | |
tar -czvf ./ink-node-mac-universal.tar.gz ./ink-node-mac | |
tar -czvf ./ink-node-linux-arm64.tar.gz ./ink-node-linux-arm64 | |
ls -la | |
- name: Publish release | |
uses: ghalactic/github-release-from-tag@cebdacac0ccd08933b8e7f278f4123723ad978eb # v5.4.0 | |
if: github.ref_type == 'tag' | |
with: | |
prerelease: false | |
draft: true | |
assets: | | |
- path: ink-node-linux.tar.gz | |
- path: ink-node-mac-universal.tar.gz | |
- path: ink-node-linux-arm64.tar.gz |