Skip to content

Commit

Permalink
Avail, runtimes (#4)
Browse files Browse the repository at this point in the history
enabled runtime building, avail was added
  • Loading branch information
kogeler authored May 19, 2024
1 parent ca3706e commit 5d23090
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 8 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/avail.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Build Avail binaries

on:
push:
branches:
paths:
- .github/workflows/avail.yml
- avail-release-version.txt
pull_request:
paths:
- .github/workflows/avail.yml
- avail-release-version.txt

env:
RELEASE_REF: refs/heads/main
jobs:
build-binaries:
runs-on: ubuntu-latest
permissions:
contents: write
container:
image: ghcr.io/kogeler/substrate-cross-compiler-env:debian-${{ matrix.debian-versions }}-rust-${{ matrix.rust-versions }}-clang-${{ matrix.clang-versions }}
env:
RUSTFLAGS: "-C target-cpu=${{ matrix.rustc-targets }}"
GH_TOKEN: ${{ github.token }}
options: --user 0:0
strategy:
fail-fast: false
matrix:
debian-versions: [bookworm]
rust-versions: [1.78.0]
clang-versions: [17]
rustc-targets: ["x86-64-v2", "x86-64-v3"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set environmental variables
run: |
NODE_GIT_REF=$(cat avail-release-version.txt | tr -d '\n')
echo "NODE_GIT_REF=${NODE_GIT_REF}" >> $GITHUB_ENV
ENV_VERSION="debian-${{ matrix.debian-versions }}-rust-${{ matrix.rust-versions }}-clang-${{ matrix.clang-versions }}-${{ matrix.rustc-targets }}"
echo "BINARY_FILE_NAME=${NODE_GIT_REF}-${ENV_VERSION}" >> $GITHUB_ENV
echo "EXECUTE_WORKER_BINARY_FILE_NAME=${NODE_GIT_REF}-execute-worker-${ENV_VERSION}" >> $GITHUB_ENV
echo "PREPARE_WORKER_BINARY_FILE_NAME=${NODE_GIT_REF}-prepare-worker-${ENV_VERSION}" >> $GITHUB_ENV
git config --global --add safe.directory $(pwd)
- name: Checkout polkadot-sdk repository
uses: actions/checkout@v4
with:
repository: availproject/avail
path: git-content
ref: ${{ env.NODE_GIT_REF }}
- name: Build binaries
run: |
cd git-content
cargo build --release --locked --target x86_64-unknown-linux-gnu
ls /opt/cargo_target/x86_64-unknown-linux-gnu/release
- name: "Create release"
if: ${{ github.ref == env.RELEASE_REF }}
uses: "actions/github-script@v6"
with:
script: |
try {
const response = await github.rest.repos.createRelease({
draft: false,
generate_release_notes: true,
name: 'avail-' + process.env.NODE_GIT_REF,
owner: context.repo.owner,
prerelease: false,
repo: context.repo.repo,
tag_name: 'avail-' + process.env.NODE_GIT_REF,
});
} catch (error) {
core.notice(error.message);
}
- name: Upload binaries
if: ${{ github.ref == env.RELEASE_REF }}
run: |
BINARIES_DIR=${CARGO_TARGET_DIR}/x86_64-unknown-linux-gnu/release
mv ${BINARIES_DIR}/avail-node ${BINARIES_DIR}/avail-${BINARY_FILE_NAME}
ls ${BINARIES_DIR}
gh release upload avail-${{ env.NODE_GIT_REF }} ${BINARIES_DIR}/avail-${BINARY_FILE_NAME}
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
name: Build and push Docker image
name: Build Docker images and Polkadot binaries

on:
push:
branches:
paths:
- .github/workflows/polkadot.yml
- dockerfiles/*
- release-version.txt
pull_request:
paths:
- .github/workflows/polkadot.yml
- dockerfiles/*
- release-version.txt

env:
REGISTRY: ghcr.io
Expand All @@ -21,7 +29,7 @@ jobs:
fail-fast: false
matrix:
debian-versions: [bullseye, bookworm]
rust-versions: [1.77.2]
rust-versions: [1.78.0]
clang-versions: [17, 18]
steps:
- name: Checkout repository
Expand Down Expand Up @@ -91,7 +99,7 @@ jobs:
fail-fast: false
matrix:
debian-versions: [bullseye, bookworm]
rust-versions: [1.77.2]
rust-versions: [1.78.0]
clang-versions: [17, 18]
rustc-targets: ["x86-64-v2", "x86-64-v3", "x86-64-v4"]
steps:
Expand Down
1 change: 1 addition & 0 deletions avail-release-version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v2.2.2.0-rc1
2 changes: 1 addition & 1 deletion build-env.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

cd dockerfiles
docker build --load --pull --no-cache --file Dockerfile.${2} --build-arg "DEBIAN_VERSION=${1}" -t "rust-env-debian-${1}-${2}" .
docker build --pull --no-cache --file Dockerfile.${2} --build-arg "DEBIAN_VERSION=${1}" -t "rust-env-debian-${1}-${2}" .
12 changes: 8 additions & 4 deletions dockerfiles/Dockerfile.amd64
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ ARG DEBIAN_VERSION=bullseye
FROM debian:${DEBIAN_VERSION}-slim

ARG DEBIAN_VERSION=bullseye
ARG RUST_STABLE_VERSION="1.72.0"
ARG CLANG_VERSION="15"
ARG RUST_STABLE_VERSION="1.78.0"
ARG CLANG_VERSION="17"

# Set environment variables
ENV SHELL="/bin/bash"
Expand All @@ -18,7 +18,7 @@ ENV PATH="$PATH:$CARGO_HOME/bin"
ENV CC="clang-$CLANG_VERSION"
ENV CXX="clang-$CLANG_VERSION"

ENV SKIP_WASM_BUILD=1
#ENV SKIP_WASM_BUILD=1
ENV RUST_BACKTRACE=1

# Install dependencies
Expand Down Expand Up @@ -46,7 +46,11 @@ RUN mkdir ${RUSTUP_HOME} ${CARGO_HOME} ${CARGO_TARGET_DIR}
run chown -R rust:rust ${RUSTUP_HOME} ${CARGO_HOME} ${CARGO_TARGET_DIR}
USER rust
# Install rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path --default-toolchain ${RUST_STABLE_VERSION}
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path --default-toolchain ${RUST_STABLE_VERSION} && \
rustup component add rust-src --toolchain ${RUST_STABLE_VERSION}-x86_64-unknown-linux-gnu && \
rustup target add wasm32-unknown-unknown --toolchain ${RUST_STABLE_VERSION}
RUN command -v wasm-gc || \
cargo +${RUST_STABLE_VERSION} install --git https://github.com/alexcrichton/wasm-gc --force
WORKDIR /home/rust

ENTRYPOINT ["/bin/bash"]

0 comments on commit 5d23090

Please sign in to comment.