Skip to content

Commit

Permalink
Merge pull request #1 from availproject/ob-whitelabel-ci
Browse files Browse the repository at this point in the history
Whitelabel Releaser
  • Loading branch information
obrienalaribe authored Sep 25, 2024
2 parents d2499f4 + 59e9021 commit 6325c97
Showing 1 changed file with 112 additions and 0 deletions.
112 changes: 112 additions & 0 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Avail Light Whitelabel Release
on:
push:
branches-ignore:
- '**'
tags:
- 'avail-light-whitelabel-v*.*.*'
- 'avail-light-whitelabel-v*.*.*-*'

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-20.04
workspace: light-client-whitelabel
rust_target: x86_64-unknown-linux-gnu
output_name: avail-light-whitelabel-linux-amd64
extra_setup: |
rustup target add x86_64-unknown-linux-gnu
- os: ubuntu-20.04
workspace: light-client-whitelabel
rust_target: aarch64-unknown-linux-gnu
output_name: avail-light-whitelabel-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: light-client-whitelabel
rust_target: aarch64-apple-darwin
output_name: avail-light-whitelabel-apple-arm64
extra_setup: |
rustup target add aarch64-apple-darwin
- os: macos-13
workspace: light-client-whitelabel
rust_target: x86_64-apple-darwin
output_name: avail-light-whitelabel-apple-x86_64
extra_setup: |
rustup target add x86_64-apple-darwin
- os: windows-latest
workspace: light-client-whitelabel
rust_target: x86_64-pc-windows-msvc
output_name: avail-light-whitelabel-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


binary_publish:
needs: [build]
runs-on: ubuntu-20.04
steps:
- uses: actions/download-artifact@v4
with:
path: binaries
pattern: avail-light-whitelabel*
merge-multiple: true

- name: publish binaries
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.PAT_TOKEN }}
file: /home/runner/work/light-client-whitelabel/light-client-whitelabel/binaries/avail-light-whitelabel*
release_name: ${{ github.ref_name }}
tag: ${{ github.ref_name }}
overwrite: true
file_glob: true

0 comments on commit 6325c97

Please sign in to comment.