simplified gh actions
This commit is contained in:
parent
05f3c573c8
commit
9642afee20
|
@ -1,12 +0,0 @@
|
||||||
name: 'Anchor Publish'
|
|
||||||
description: 'Perform a verifiable build for a Solana program in a given directory'
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: 'composite'
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: ./.github/actions/install-anchor/
|
|
||||||
with:
|
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
|
||||||
- run: ~/.cargo/bin/anchor build --verifiable
|
|
||||||
shell: bash
|
|
|
@ -1,35 +0,0 @@
|
||||||
# Implicit dependencies
|
|
||||||
# - actions/checkout@v3
|
|
||||||
# - ./.github/actions/install-linux-build-deps
|
|
||||||
# - ./.github/actions/install-solana
|
|
||||||
# - ./.github/actions/install-rust
|
|
||||||
|
|
||||||
name: Build Program
|
|
||||||
description: Builds the specified Rust program based on the `name` input
|
|
||||||
inputs:
|
|
||||||
name:
|
|
||||||
description: The name of the program to build
|
|
||||||
required: true
|
|
||||||
runs:
|
|
||||||
using: 'composite'
|
|
||||||
steps:
|
|
||||||
# - name: "Cache: ${{ inputs.name }}"
|
|
||||||
# uses: actions/cache@v3
|
|
||||||
# with:
|
|
||||||
# path: |
|
|
||||||
# ~/.cargo/bin/
|
|
||||||
# ~/.cargo/registry/index/
|
|
||||||
# ~/.cargo/registry/cache/
|
|
||||||
# ~/.cargo/git/db/
|
|
||||||
# ./${{ inputs.name }}/program/target/
|
|
||||||
# key:
|
|
||||||
# program-${{ inputs.name }}-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
# id: cache-program
|
|
||||||
- name: "Build: ${{ inputs.name }}"
|
|
||||||
working-directory: ./${{ inputs.name }}/program
|
|
||||||
run: |
|
|
||||||
mkdir -p ../../test-programs
|
|
||||||
cargo +${{ env.RUST_STABLE }} build-bpf --version
|
|
||||||
cargo +${{ env.RUST_STABLE }} build-bpf --bpf-out-dir ../../test-programs/
|
|
||||||
shell: bash
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
# if referencing from a workflow, ANCHOR_VERSION environment variable must be defined
|
|
||||||
name: Setup Anchor CLI
|
|
||||||
description: 'Setup Anchor CLI'
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: 'composite'
|
|
||||||
steps:
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
name: Cache Anchor CLI
|
|
||||||
id: cache-anchor-cli
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cargo/bin/
|
|
||||||
~/.cargo/registry/index/
|
|
||||||
~/.cargo/registry/cache/
|
|
||||||
~/.cargo/git/db/
|
|
||||||
./target/
|
|
||||||
key: anchor-cli-${{ runner.os }}-v0000-${{ env.ANCHOR_VERSION }}
|
|
||||||
- run:
|
|
||||||
cargo install --git https://github.com/project-serum/anchor --tag "v$ANCHOR_VERSION" anchor-cli --locked
|
|
||||||
shell: bash
|
|
||||||
if: steps.cache-anchor-cli.outputs.cache-hit != 'true'
|
|
|
@ -1,43 +0,0 @@
|
||||||
name: Install common build deps
|
|
||||||
description: Install common build tools
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
linux:
|
|
||||||
description: Install or restore Linux dependencies from cache
|
|
||||||
required: false
|
|
||||||
default: "true"
|
|
||||||
rust:
|
|
||||||
description: Install or restore Rust from cache
|
|
||||||
required: false
|
|
||||||
default: "true"
|
|
||||||
rust-version:
|
|
||||||
description: Version for Rust, default to stable
|
|
||||||
required: false
|
|
||||||
default: "stable"
|
|
||||||
solana:
|
|
||||||
description: Install or restore Solana from cache
|
|
||||||
required: false
|
|
||||||
default: "true"
|
|
||||||
anchor:
|
|
||||||
description: Install or restore Anchor CLI from cache
|
|
||||||
required: false
|
|
||||||
default: "true"
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
- uses: ./.github/actions/install-linux-build-deps
|
|
||||||
if: inputs.linux == 'true'
|
|
||||||
|
|
||||||
- uses: ./.github/actions/install-rust
|
|
||||||
if: inputs.rust == 'true'
|
|
||||||
with:
|
|
||||||
toolchain: ${{ inputs.rust-version }}
|
|
||||||
|
|
||||||
- uses: ./.github/actions/install-solana
|
|
||||||
if: inputs.solana == 'true'
|
|
||||||
with:
|
|
||||||
solana_version: ${{ env.SOLANA_VERSION }}
|
|
||||||
|
|
||||||
- uses: ./.github/actions/install-anchor
|
|
||||||
if: inputs.anchor == 'true'
|
|
|
@ -1,8 +0,0 @@
|
||||||
name: Install Linux Build Deps
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
sudo apt-get update && sudo apt-get install -y pkg-config
|
|
||||||
build-essential libudev-dev
|
|
||||||
shell: bash
|
|
|
@ -1,37 +0,0 @@
|
||||||
name: Install Rust
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
toolchain:
|
|
||||||
description: The Rust version to use, default env.RUST_TOOLCHAIN
|
|
||||||
required: true
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- name: Install Rust Stable
|
|
||||||
id: rust_toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: ${{ inputs.toolchain }}
|
|
||||||
override: true
|
|
||||||
profile: minimal
|
|
||||||
components: rustfmt, clippy
|
|
||||||
|
|
||||||
- name: Add Cargo bin to Path
|
|
||||||
run: |
|
|
||||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Verify Rust install
|
|
||||||
run: |
|
|
||||||
echo "Verifying rust '${{ inputs.toolchain }}' ..."
|
|
||||||
rustc --version
|
|
||||||
cargo --version
|
|
||||||
cargo clippy --version
|
|
||||||
rustfmt --version
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Share rustc hash
|
|
||||||
run: |
|
|
||||||
echo 'RUSTC_HASH=${{ steps.rust_toolchain.outputs.rustc_hash }}' >> $GITHUB_ENV
|
|
||||||
shell: bash
|
|
|
@ -1,32 +0,0 @@
|
||||||
name: Install Solana
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
solana_version:
|
|
||||||
description: Version of Solana to install
|
|
||||||
required: true
|
|
||||||
default: 1.10.40
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
# - name: Cache Solana Install
|
|
||||||
# id: cache-solana-install
|
|
||||||
# uses: actions/cache@v3
|
|
||||||
# with:
|
|
||||||
# path: |
|
|
||||||
# ~/.cache/solana/
|
|
||||||
# ~/.local/share/solana/
|
|
||||||
# key: ${{ runner.os }}-Solana-v${{ inputs.solana_version }}
|
|
||||||
|
|
||||||
- run: sh -c "$(curl -sSfL https://release.solana.com/v${{ inputs.solana_version }}/install)"
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Add Solana bin to Path
|
|
||||||
run: |
|
|
||||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Verify Solana install
|
|
||||||
run: |
|
|
||||||
solana --version
|
|
||||||
shell: bash
|
|
|
@ -1,21 +0,0 @@
|
||||||
name: Verify Rust
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
working-directory:
|
|
||||||
description: The program directory you're trying to verify
|
|
||||||
required: true
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- name: Run cargo fmt
|
|
||||||
uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: fmt
|
|
||||||
args: --manifest-path ${{ inputs.working-directory }}/Cargo.toml -- --check
|
|
||||||
|
|
||||||
- name: Run cargo clippy
|
|
||||||
uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: clippy
|
|
||||||
args: --all-targets --all-features --no-deps --manifest-path ${{ inputs.working-directory }}/Cargo.toml
|
|
|
@ -16,20 +16,13 @@ env:
|
||||||
SOLANA_VERSION: 1.13.5
|
SOLANA_VERSION: 1.13.5
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
solana_js_test:
|
solana_js_devnet_test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
steps:
|
steps:
|
||||||
# Setup Deps
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Setup Linux Build Deps
|
|
||||||
uses: ./.github/actions/install-linux-build-deps
|
|
||||||
- name: Install Solana
|
|
||||||
uses: ./.github/actions/install-solana
|
|
||||||
with:
|
|
||||||
solana_version: ${{ env.SOLANA_VERSION }}
|
|
||||||
- name: Use Node.js
|
- name: Use Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
@ -39,10 +32,19 @@ jobs:
|
||||||
- name: Build solana.js
|
- name: Build solana.js
|
||||||
working-directory: javascript/solana.js
|
working-directory: javascript/solana.js
|
||||||
run: npm install && npm run build
|
run: npm install && npm run build
|
||||||
- name: Start Local Validator & Run Tests
|
- name: Start Local Validator
|
||||||
|
uses: switchboard-xyz/solana-local-validator@v1
|
||||||
|
with:
|
||||||
|
solana-version: v1.14.10
|
||||||
|
anchor-version: v0.25.2
|
||||||
|
cluster: devnet
|
||||||
|
args:
|
||||||
|
"--url https://api.devnet.solana.com --clone
|
||||||
|
2TfB33aLaneQb5TNVwyDz3jSZXS6jdW2ARw1Dgf84XCG --clone
|
||||||
|
J4CArpsbrZqu1axqQ4AnrqREs3jwoyA1M5LMiQQmAzB9 --clone
|
||||||
|
CKwZcshn4XDvhaWVH9EXnk3iu19t6t5xP2Sy2pD6TRDp --clone
|
||||||
|
BYM81n8HvTJuqZU1PmTVcwZ9G8uoji7FKM6EaPkwphPt --clone
|
||||||
|
FVLfR6C2ckZhbSwBzZY4CX7YBcddUSge5BNeGQv5eKhy"
|
||||||
|
- name: Run Tests
|
||||||
working-directory: javascript/solana.js
|
working-directory: javascript/solana.js
|
||||||
run: |
|
run: npm run test:localnet
|
||||||
solana-keygen new --no-bip39-passphrase --outfile ~/.config/solana/id.json --silent
|
|
||||||
mkdir -p .anchor/test-ledger
|
|
||||||
npm run localnet:up
|
|
||||||
npm run localnet:down
|
|
||||||
|
|
Loading…
Reference in New Issue