feat: cicd #7
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 }}) | |
strategy: | |
matrix: | |
include: | |
- arch: amd64 | |
runner: ubuntu-24.04 | |
target: x86_64-unknown-linux-gnu | |
tarball: solana-release-x86_64-unknown-linux-gnu.tar.bz2 | |
- arch: arm64 | |
runner: ubuntu-24.04-arm | |
target: aarch64-unknown-linux-gnu | |
tarball: solana-release-aarch64-unknown-linux-gnu.tar.bz2 | |
runs-on: ${{ matrix.runner }} | |
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: Cache Build | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: "agave -> target" | |
key: ${{ matrix.target }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
build-essential \ | |
pkg-config \ | |
libudev-dev \ | |
llvm \ | |
libclang-dev \ | |
protobuf-compiler | |
- name: Build for production | |
run: | | |
cd agave/ | |
./scripts/cargo-install-all.sh solana-release/bin | |
- name: Create release tarball | |
run: | | |
cd agave | |
cat > solana-release/version.yml << EOF | |
channel: ${{ steps.get_ref.outputs.ref }} | |
commit: $(git rev-parse HEAD) | |
target: ${{ matrix.target }} | |
EOF | |
tar cjf ${{ matrix.tarball }} solana-release/ | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.tarball }} | |
path: agave/${{ matrix.tarball }} | |
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: | | |
*/*.tar.bz2 | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |