feat: cicd #2
This file contains 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: Build Agave | |
on: | |
push: | |
branches: | |
- "**" | |
tags: | |
- "v*" | |
jobs: | |
build-agave: | |
name: Build Agave (${{ matrix.arch }}) | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
matrix: | |
include: | |
- arch: amd64 | |
runner: ubuntu-24.04 | |
target: x86_64-unknown-linux-gnu | |
- arch: arm64 | |
runner: ubuntu-24.04-arm | |
target: aarch64-unknown-linux-gnu | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get source ref | |
id: get_ref | |
run: | | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
echo "ref=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
else | |
echo "ref=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT | |
fi | |
- name: Checkout Agave | |
uses: actions/checkout@v4 | |
with: | |
repository: anza-xyz/agave | |
ref: ${{ steps.get_ref.outputs.ref }} | |
path: agave | |
fetch-depth: 0 | |
- name: Install Rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
target: ${{ matrix.target }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
libssl-dev \ | |
libudev-dev \ | |
pkg-config \ | |
zlib1g-dev \ | |
llvm \ | |
clang \ | |
cmake \ | |
make \ | |
libprotobuf-dev \ | |
protobuf-compiler | |
- name: Build for production | |
run: | | |
cd agave | |
RUSTFLAGS="-C target-feature=+crt-static" \ | |
cargo build --release --target ${{ matrix.target }} \ | |
--features production | |
- name: Create tarball | |
run: | | |
cd agave | |
mkdir -p release/bin | |
cp target/${{ matrix.target }}/release/solana* release/bin/ | |
cp target/${{ matrix.target }}/release/agave* release/bin/ | |
tar -cjf "solana-release-${{ matrix.target }}.tar.bz2" -C release . | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: solana-release-${{ matrix.target }} | |
path: agave/solana-release-${{ matrix.target }}.tar.bz2 | |
if-no-files-found: error | |
create-release: | |
needs: build-agave | |
runs-on: ubuntu-24.04 | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
*/solana-release-*.tar.bz2 | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |