Skip to content

Commit

Permalink
feat: add an install anchor action
Browse files Browse the repository at this point in the history
  • Loading branch information
metaproph3t committed Apr 27, 2023
1 parent 9c48512 commit b513f3f
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Anchor Test

A fast, easy, and secure action for testing [Anchor](https://www.anchor-lang.com/) projects. Completes in ~1 minute.

# Usage

Here's an example workflow:

```yaml
name: example-workflow
on: [push]
jobs:
run-anchor-test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: metadaoproject/[email protected]
```
This will use the default versions of Anchor, Node.js, and the Solana CLI tools, which are 0.27.0, 16.15.1, and 1.15.2 respectively. You can also configure these versions like do:
```yaml
steps:
- uses: actions/checkout@v3
- uses: metadaoproject/[email protected]
with:
anchor-version: '0.24.2'
solana-cli-version: '1.10.32'
node-version: '16.15.1'
```
# License
The scripts and documentation in this project are released under the [MIT License](LICENSE).
41 changes: 41 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: 'Install Anchor'
description: 'Install Anchor & Solana CLI tools.'
branding:
icon: anchor
color: blue
inputs:
node-version:
description: 'Version of node.js to use'
required: false
default: '16.15.1' # LTS
solana-cli-version:
description: 'Version of Solana CLI to use'
required: false
default: '1.15.2' # stable
anchor-version:
description: 'Version of Anchor to use'
required: false
default: '0.27.0' # latest
runs:
using: 'composite'
steps:
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
- name: Cache Solana CLI tools
uses: actions/cache@v3
with:
path: |
~/.cache/solana/
~/.local/share/solana/
key: solana-cli-${{ runner.os }}-build-${{ inputs.solana-cli-version }}
- name: Install Solana CLI tools
run: sh -c "$(curl -sSfL https://release.solana.com/v${{ inputs.solana-cli-version }}/install)"
shell: bash
- name: Update PATH
run: echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
shell: bash
- name: Install Anchor
run: npm i -g @project-serum/anchor-cli@${{ inputs.anchor-version }}
shell: bash

0 comments on commit b513f3f

Please sign in to comment.