solana connect chains (#1289) #432
This file contains hidden or 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: Solana Verified Build | |
on: | |
workflow_dispatch: | |
inputs: | |
sha: | |
description: 'SHA to build (can be short)' | |
required: true | |
type: string | |
push: | |
branches: | |
- main | |
jobs: | |
changes: | |
name: Detect changes | |
runs-on: ubuntu-latest | |
outputs: | |
solana_changes: ${{ steps.changes.outputs.solana_changes }} | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Detect changes | |
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
id: changes | |
with: | |
list-files: "shell" | |
filters: | | |
solana_changes: | |
- 'chains/solana/**' | |
- '.github/workflows/solana*.yml' | |
build: | |
needs: [ changes ] | |
if: ${{ needs.changes.outputs.solana_changes == 'true' }} | |
runs-on: ubuntu-latest-8cores-32GB | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get Long and Short SHAs | |
id: get_sha | |
run: | | |
FULL_SHA=$(git rev-parse ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.sha || github.sha }}) | |
echo "short_sha=${FULL_SHA:0:12}" >> $GITHUB_OUTPUT | |
echo "full_sha=$FULL_SHA" >> $GITHUB_OUTPUT | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ steps.get_sha.outputs.full_sha }} | |
fetch-depth: 0 | |
- uses: actions-rust-lang/setup-rust-toolchain@9399c7bb15d4c7d47b27263d024f0a4978346ba4 # v1 | |
- name: Install Solana Verify | |
run: | | |
cargo install [email protected] | |
- name: Cache cargo target dir | |
id: cache-target | |
uses: actions/cache@v4 # v4 | |
with: | |
path: chains/solana/contracts/target/deploy/*.so | |
key: ${{ runner.os }}-solana-contract-verified-${{ hashFiles('chains/solana/contracts/**/*.rs', 'chains/solana/contracts/**/Cargo.lock') }} | |
- name: Build Verified Artifacts | |
if: steps.cache-target.outputs.cache-hit != 'true' | |
run: | | |
cd chains/solana/contracts | |
solana-verify build | |
- name: Generate release files | |
run: | | |
cd chains/solana/contracts | |
tar cfvz artifacts.tar.gz target/deploy/*.so target/idl/* | |
- name: Publish Release | |
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: solana-artifacts-localtest-${{ steps.get_sha.outputs.short_sha }} | |
target_commitish: ${{ steps.get_sha.outputs.full_sha }} | |
files: | | |
chains/solana/contracts/artifacts.tar.gz |