Skip to content

Releaser updates (#702) #39

Releaser updates (#702)

Releaser updates (#702) #39

name: Avail Light Client Release
on:
push:
branches-ignore:
- '**'
tags:
- 'avail-light-client-v*.*.*'
- 'avail-light-client-v*.*.*-*'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-20.04
workspace: avail-light-client
rust_target: x86_64-unknown-linux-gnu
output_name: avail-light-linux-amd64
extra_setup: |
rustup target add x86_64-unknown-linux-gnu
- os: ubuntu-20.04
workspace: avail-light-client
rust_target: aarch64-unknown-linux-gnu
output_name: avail-light-linux-arm64
extra_setup: |
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
rustup target add aarch64-unknown-linux-gnu
export BINDGEN_EXTRA_CLANG_ARGS='--sysroot /usr/aarch64-linux-gnu'
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc
- os: macos-14
workspace: avail-light-client
rust_target: aarch64-apple-darwin
output_name: avail-light-apple-arm64
extra_setup: |
rustup target add aarch64-apple-darwin
- os: macos-13
workspace: avail-light-client
rust_target: x86_64-apple-darwin
output_name: avail-light-apple-x86_64
extra_setup: |
rustup target add x86_64-apple-darwin
- os: windows-latest
workspace: avail-light-client
rust_target: x86_64-pc-windows-msvc
output_name: avail-light-x86_64-pc-windows-msvc.exe
extra_setup: |
Invoke-WebRequest -Uri https://win.rustup.rs -OutFile rustup-init.exe
.\rustup-init.exe -y --default-toolchain stable
$env:Path += ";$env:USERPROFILE\.cargo\bin"
rustup target add x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v4
- name: Install cargo and setup
if: runner.os != 'Windows'
shell: bash
run: |
sudo apt-get update && sudo apt-get install -y librust-openssl-dev build-essential protobuf-compiler musl-tools clang libc6-dev libc6-dev-arm64-cross libssl-dev pkg-config
curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
- name: Build on linux/mac ${{ matrix.output_name }}
if: runner.os != 'Windows'
shell: bash
run: |
${{ matrix.extra_setup }}
cargo build --profile maxperf --target=${{ matrix.rust_target }} -p ${{ matrix.workspace }}
mv target/${{ matrix.rust_target }}/maxperf/${{ matrix.workspace }} target/${{ matrix.rust_target }}/maxperf/${{ matrix.output_name }}
pushd target/${{ matrix.rust_target }}/maxperf/
tar czf ${{ matrix.output_name }}.tar.gz ${{ matrix.output_name }}
- name: Build on windows ${{ matrix.output_name }}
if: runner.os == 'Windows'
shell: pwsh
run: |
${{ matrix.extra_setup }}
cargo build --profile maxperf --target=${{ matrix.rust_target }} -p ${{ matrix.workspace }}
Move-Item -Path "target\${{ matrix.rust_target }}\maxperf\${{ matrix.workspace }}.exe" -Destination "target\${{ matrix.rust_target }}\maxperf\${{ matrix.output_name }}"
Push-Location -Path "target\${{ matrix.rust_target }}\maxperf\"
Compress-Archive -Path "${{ matrix.output_name }}" -DestinationPath "${{ matrix.output_name }}.tar.gz"
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.output_name }}
path: target/${{ matrix.rust_target }}/maxperf/${{ matrix.output_name }}.tar.gz
compatibility_tests:
runs-on: self-hosted
steps:
- run: docker-compose --version
- name: Checkout avail-test repository with submodules
uses: actions/checkout@v2
with:
repository: availproject/avail-test
path: avail-test
token: ${{ secrets.PAT_TOKEN }}
submodules: true
ref: main
fetch-depth: 0
- name: Run e2e tests
working-directory: avail-test
run: |
set -eo pipefail
export PATH="/root/.cargo/bin:$PATH"
./run_tests_ci.sh
- name: Run compat tests
working-directory: avail-test
run: |
set -eo pipefail
export PATH="/root/.cargo/bin:$PATH"
cargo run --package compat-test-tool --bin compat-test-tool
env:
RUST_BACKTRACE: 1
binary_publish:
needs: [compatibility_tests]
runs-on: ubuntu-20.04
steps:
- uses: actions/download-artifact@v4
with:
path: binaries
pattern: avail-light*
merge-multiple: true
- name: publish binaries
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.PAT_TOKEN }}
file: /home/runner/work/avail-light/avail-light/binaries/avail-light*
release_name: ${{ github.ref_name }}
tag: ${{ github.ref_name }}
overwrite: true
file_glob: true
trigger_deploy_workflow:
needs: [compatibility_tests]
runs-on: ubuntu-20.04
steps:
- name: Trigger repository_dispatch for release
shell: bash
run: |
curl -s -o /dev/null -w "%{http_code}" \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.PAT_TOKEN }}" \
https://api.github.com/repos/availproject/avail-light-infra/dispatches \
-d '{"event_type": "binary_release", "client_payload": {"avail_light_version": "${{ github.ref_name }}" }}'
# build avail image and publish to dockerhub
docker_build_push:
needs: [compatibility_tests]
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push images
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile.release
platforms: linux/amd64
push: true
tags: availj/avail-light:${{ github.ref_name }}
build-args: |
AVAIL_TAG=${{ github.ref_name }}