-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f4b5b4e
commit 9ed5bf5
Showing
1 changed file
with
79 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Build Anchor CLI | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
rust_version: | ||
description: 'Rust version' | ||
required: false | ||
default: 'stable' | ||
rev: | ||
description: 'Anchor revision to build' | ||
required: false | ||
anchor_version: | ||
description: 'Anchor version to build' | ||
required: false | ||
default: '0.30.1' | ||
target: | ||
description: 'Build target' | ||
required: false | ||
default: 'x86_64-unknown-linux-musl' | ||
type: choice | ||
options: | ||
- x86_64-unknown-linux-musl | ||
- aarch64-unknown-linux-musl | ||
|
||
env: | ||
CARGO_NET_GIT_FETCH_WITH_CLI: true | ||
SCCACHE_BUCKET: gh-runner-cache-rust | ||
SCCACHE_REGION: eu-central-1 | ||
AWS_ACCESS_KEY_ID: ${{ secrets.RUST_S3_AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.RUST_S3_AWS_SECRET_ACCESS_KEY }} | ||
SCCACHE_GHA_ENABLED: "true" | ||
RUSTC_WRAPPER: "sccache" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ github.event.inputs.rust_version }} | ||
targets: ${{ github.event.inputs.target }} | ||
|
||
- name: Run sccache-cache | ||
uses: mozilla-actions/[email protected] | ||
|
||
- name: Set version or rev | ||
id: set_version | ||
run: | | ||
if [ -n "${{ github.event.inputs.rev }}" ]; then | ||
echo "version_or_rev=${{ github.event.inputs.rev }}" >> $GITHUB_OUTPUT | ||
else | ||
echo "version_or_rev=${{ github.event.inputs.anchor_version }}" >> $GITHUB_OUTPUT | ||
fi | ||
|
||
- name: Build Anchor CLI | ||
run: | | ||
if [ -n "${{ github.event.inputs.rev }}" ]; then | ||
RUSTFLAGS='-C target-feature=+crt-static' cargo install anchor-cli --rev ${{ github.event.inputs.rev }} --target ${{ github.event.inputs.target }} | ||
else | ||
VERSION="${{ github.event.inputs.anchor_version }}" | ||
RUSTFLAGS='-C target-feature=+crt-static' cargo install anchor-cli --version ${VERSION} --target ${{ github.event.inputs.target }} | ||
fi | ||
mv ~/.cargo/bin/anchor ~/.cargo/bin/anchor-${{ steps.set_version.outputs.version_or_rev }}-${{ github.event.inputs.target }} | ||
|
||
- name: Upload Anchor CLI binary | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: anchor-${{ steps.set_version.outputs.version_or_rev }}-${{ github.event.inputs.target }} | ||
path: ~/.cargo/bin/anchor-${{ steps.set_version.outputs.version_or_rev }}-${{ github.event.inputs.target }} | ||
|
||
- name: Get artifact URL | ||
run: | | ||
echo "Artifact URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
echo "Binary name: anchor-${{ steps.set_version.outputs.version_or_rev }}-${{ github.event.inputs.target }}" | ||
|