|
@@ -1,108 +1,64 @@
|
|
|
-name: Anchor Programs
|
|
|
+name: Anchor Build
|
|
|
|
|
|
on:
|
|
|
- push:
|
|
|
- branches: ["main"]
|
|
|
pull_request:
|
|
|
- branches: ["main"]
|
|
|
-
|
|
|
-env:
|
|
|
- CARGO_TERM_COLOR: always
|
|
|
+ branches:
|
|
|
+ - main
|
|
|
|
|
|
jobs:
|
|
|
- setup:
|
|
|
+ build:
|
|
|
runs-on: ubuntu-latest
|
|
|
- steps:
|
|
|
- - name: Checkout code
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
- - name: Cache cargo registry
|
|
|
- uses: actions/cache@v2
|
|
|
+ steps:
|
|
|
+ - uses: actions/checkout@v2
|
|
|
+
|
|
|
+ - name: Setup Node.js environment
|
|
|
+ uses: actions/setup-node@v2.4.1
|
|
|
with:
|
|
|
- path: ~/.cargo/registry
|
|
|
- key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
|
|
+ node-version: '14.x'
|
|
|
|
|
|
- - name: Cache target
|
|
|
+ - name: Cache Node.js modules
|
|
|
uses: actions/cache@v2
|
|
|
with:
|
|
|
- path: target
|
|
|
- key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }}
|
|
|
-
|
|
|
-
|
|
|
+ path: ~/.npm
|
|
|
+ key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
|
+ restore-keys: |
|
|
|
+ ${{ runner.OS }}-node-
|
|
|
+
|
|
|
- name: Install dependencies
|
|
|
run: |
|
|
|
- sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
|
|
|
- cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
|
|
|
- sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y pkg-config build-essential libudev-dev libssl-dev
|
|
|
- avm install latest
|
|
|
- avm use latest
|
|
|
- shell: bash
|
|
|
-
|
|
|
-
|
|
|
- build:
|
|
|
- needs: setup
|
|
|
- runs-on: ubuntu-latest
|
|
|
- strategy:
|
|
|
- matrix:
|
|
|
- dir:
|
|
|
- [
|
|
|
- "basics/account-data/anchor",
|
|
|
- "basics/checking-accounts/anchor",
|
|
|
- "basics/close-account/anchor",
|
|
|
- "basics/counter/anchor",
|
|
|
- "basics/create-account/anchor",
|
|
|
- "basics/cross-program-invocation/anchor",
|
|
|
- "basics/hello-solana/anchor",
|
|
|
- "basics/pda-rent-payer/anchor",
|
|
|
- "basics/processing-instructions/anchor",
|
|
|
- "basics/program-derived-addresses/anchor",
|
|
|
- "basics/realloc/anchor",
|
|
|
- "basics/rent/anchor",
|
|
|
- "basics/repository-layout/anchor",
|
|
|
- "basics/transfer-sol/anchor",
|
|
|
- "compression/cnft-vault/anchor",
|
|
|
- "oracles/pyth/anchor",
|
|
|
- "tokens/create-token/anchor",
|
|
|
- "tokens/nft-minter/anchor",
|
|
|
- "tokens/pda-mint-authority/anchor",
|
|
|
- "tokens/spl-token-minter/anchor",
|
|
|
- "tokens/token-2022/basics/anchor",
|
|
|
- "tokens/transfer-tokens/anchor",
|
|
|
- ]
|
|
|
- steps:
|
|
|
- - name: Checkout code
|
|
|
- uses: actions/checkout@v3
|
|
|
+ npm ci
|
|
|
+ npm install -g @project-serum/anchor
|
|
|
|
|
|
- - name: Cache cargo registry
|
|
|
- uses: actions/cache@v2
|
|
|
- with:
|
|
|
- path: ~/.cargo/registry
|
|
|
- key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
|
|
-
|
|
|
- - name: Cache target
|
|
|
- uses: actions/cache@v2
|
|
|
- with:
|
|
|
- path: target
|
|
|
- key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }}
|
|
|
-
|
|
|
- - name: Set environment variables
|
|
|
- run: |
|
|
|
- echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
|
|
- echo "/home/runner/.cargo/bin" >> $GITHUB_PATH
|
|
|
- echo "/home/runner/.avm/bin" >> $GITHUB_PATH
|
|
|
- shell: bash
|
|
|
-
|
|
|
- - name: Set up Node.js environment
|
|
|
- uses: actions/setup-node@v2
|
|
|
- with:
|
|
|
- node-version: '16'
|
|
|
-
|
|
|
- - name: Install Anchor
|
|
|
+ - name: Build Solana Programs
|
|
|
run: |
|
|
|
- npm install -g @coral-xyz/anchor
|
|
|
- shell: bash
|
|
|
-
|
|
|
-
|
|
|
- - name: Build program
|
|
|
- working-directory: ${{ matrix.dir }}
|
|
|
- run: anchor build
|
|
|
+ declare -a StringArray=(
|
|
|
+ "basics/account-data/anchor"
|
|
|
+ "basics/checking-accounts/anchor"
|
|
|
+ "basics/close-account/anchor"
|
|
|
+ "basics/counter/anchor"
|
|
|
+ "basics/create-account/anchor"
|
|
|
+ "basics/cross-program-invocation/anchor"
|
|
|
+ "basics/hello-solana/anchor"
|
|
|
+ "basics/pda-rent-payer/anchor"
|
|
|
+ "basics/processing-instructions/anchor"
|
|
|
+ "basics/program-derived-addresses/anchor"
|
|
|
+ "basics/realloc/anchor"
|
|
|
+ "basics/rent/anchor"
|
|
|
+ "basics/repository-layout/anchor"
|
|
|
+ "basics/transfer-sol/anchor"
|
|
|
+ "compression/cnft-vault/anchor"
|
|
|
+ "oracles/pyth/anchor"
|
|
|
+ "tokens/create-token/anchor"
|
|
|
+ "tokens/nft-minter/anchor"
|
|
|
+ "tokens/pda-mint-authority/anchor"
|
|
|
+ "tokens/spl-token-minter/anchor"
|
|
|
+ "tokens/token-2022/basics/anchor"
|
|
|
+ "tokens/transfer-tokens/anchor"
|
|
|
+ )
|
|
|
+ for val in "${StringArray[@]}"; do
|
|
|
+ echo "Building $val..."
|
|
|
+ cd $val
|
|
|
+ anchor build
|
|
|
+ cd - > /dev/null
|
|
|
+ done
|