ci: Split out test-bpf into separate workflows for each program (#1893)
* ci: Split token, token-swap, and token-lending out * Remove token lending js in main runner * token-swap: Update proptest to trigger build * Remove unused Cargo.lock file * lending: Update proptest to trigger lending build * Fix lending test * Try re-using action * binary-oracle-pair: Bump token version to trigger build * Reference action differently * Add checkout step before local action * Move out cargo test bpf step * Add more programs * Update example file to trigger job * Update library file to trigger build * Update name-service file to trigger build * Update record file to trigger build * Update shared memory file to trigger build * Add pull request runners for each probram / library * Fix pull-request yml file referencing unknown step
This commit is contained in:
parent
e2d018526f
commit
de8433e815
|
@ -0,0 +1,59 @@
|
|||
name: Binary Oracle Pair Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'binary-oracle-pair/**'
|
||||
- 'token/**'
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- 'binary-oracle-pair/**'
|
||||
- 'token/**'
|
||||
|
||||
jobs:
|
||||
cargo-test-bpf:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set env vars
|
||||
run: |
|
||||
source ci/rust-version.sh
|
||||
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
|
||||
source ci/solana-version.sh
|
||||
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.RUST_STABLE }}
|
||||
override: true
|
||||
profile: minimal
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/rustfilt
|
||||
key: cargo-bpf-bins-${{ runner.os }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache
|
||||
key: solana-${{ env.SOLANA_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
./ci/install-build-deps.sh
|
||||
./ci/install-program-deps.sh
|
||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build and test
|
||||
run: ./ci/cargo-test-bpf.sh binary-oracle-pair
|
|
@ -0,0 +1,57 @@
|
|||
name: Examples Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'examples/rust/**'
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- 'examples/rust/**'
|
||||
|
||||
jobs:
|
||||
cargo-test-bpf:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set env vars
|
||||
run: |
|
||||
source ci/rust-version.sh
|
||||
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
|
||||
source ci/solana-version.sh
|
||||
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.RUST_STABLE }}
|
||||
override: true
|
||||
profile: minimal
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/rustfilt
|
||||
key: cargo-bpf-bins-${{ runner.os }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache
|
||||
key: solana-${{ env.SOLANA_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
./ci/install-build-deps.sh
|
||||
./ci/install-program-deps.sh
|
||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build and test
|
||||
run: ./ci/cargo-test-bpf.sh examples/rust
|
|
@ -0,0 +1,59 @@
|
|||
name: Feature Proposal Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'feature-proposal/**'
|
||||
- 'token/**'
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- 'feature-proposal/**'
|
||||
- 'token/**'
|
||||
|
||||
jobs:
|
||||
cargo-test-bpf:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set env vars
|
||||
run: |
|
||||
source ci/rust-version.sh
|
||||
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
|
||||
source ci/solana-version.sh
|
||||
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.RUST_STABLE }}
|
||||
override: true
|
||||
profile: minimal
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/rustfilt
|
||||
key: cargo-bpf-bins-${{ runner.os }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache
|
||||
key: solana-${{ env.SOLANA_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
./ci/install-build-deps.sh
|
||||
./ci/install-program-deps.sh
|
||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build and test
|
||||
run: ./ci/cargo-test-bpf.sh feature-proposal
|
|
@ -0,0 +1,59 @@
|
|||
name: Governance Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'governance/**'
|
||||
- 'token/**'
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- 'governance/**'
|
||||
- 'token/**'
|
||||
|
||||
jobs:
|
||||
cargo-test-bpf:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set env vars
|
||||
run: |
|
||||
source ci/rust-version.sh
|
||||
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
|
||||
source ci/solana-version.sh
|
||||
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.RUST_STABLE }}
|
||||
override: true
|
||||
profile: minimal
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/rustfilt
|
||||
key: cargo-bpf-bins-${{ runner.os }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache
|
||||
key: solana-${{ env.SOLANA_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
./ci/install-build-deps.sh
|
||||
./ci/install-program-deps.sh
|
||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build and test
|
||||
run: ./ci/cargo-test-bpf.sh governance
|
|
@ -0,0 +1,57 @@
|
|||
name: Libraries Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'libraries/**'
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- 'libraries/**'
|
||||
|
||||
jobs:
|
||||
cargo-test-bpf:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set env vars
|
||||
run: |
|
||||
source ci/rust-version.sh
|
||||
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
|
||||
source ci/solana-version.sh
|
||||
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.RUST_STABLE }}
|
||||
override: true
|
||||
profile: minimal
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/rustfilt
|
||||
key: cargo-bpf-bins-${{ runner.os }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache
|
||||
key: solana-${{ env.SOLANA_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
./ci/install-build-deps.sh
|
||||
./ci/install-program-deps.sh
|
||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build and test
|
||||
run: ./ci/cargo-test-bpf.sh libraries
|
|
@ -0,0 +1,57 @@
|
|||
name: Memo Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'memo/**'
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- 'memo/**'
|
||||
|
||||
jobs:
|
||||
cargo-test-bpf:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set env vars
|
||||
run: |
|
||||
source ci/rust-version.sh
|
||||
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
|
||||
source ci/solana-version.sh
|
||||
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.RUST_STABLE }}
|
||||
override: true
|
||||
profile: minimal
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/rustfilt
|
||||
key: cargo-bpf-bins-${{ runner.os }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache
|
||||
key: solana-${{ env.SOLANA_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
./ci/install-build-deps.sh
|
||||
./ci/install-program-deps.sh
|
||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build and test
|
||||
run: ./ci/cargo-test-bpf.sh memo
|
|
@ -0,0 +1,57 @@
|
|||
name: Name Service Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'name-service/**'
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- 'name-service/**'
|
||||
|
||||
jobs:
|
||||
cargo-test-bpf:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set env vars
|
||||
run: |
|
||||
source ci/rust-version.sh
|
||||
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
|
||||
source ci/solana-version.sh
|
||||
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.RUST_STABLE }}
|
||||
override: true
|
||||
profile: minimal
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/rustfilt
|
||||
key: cargo-bpf-bins-${{ runner.os }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache
|
||||
key: solana-${{ env.SOLANA_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
./ci/install-build-deps.sh
|
||||
./ci/install-program-deps.sh
|
||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build and test
|
||||
run: ./ci/cargo-test-bpf.sh name-service
|
|
@ -0,0 +1,57 @@
|
|||
name: Record Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'record/**'
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- 'record/**'
|
||||
|
||||
jobs:
|
||||
cargo-test-bpf:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set env vars
|
||||
run: |
|
||||
source ci/rust-version.sh
|
||||
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
|
||||
source ci/solana-version.sh
|
||||
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.RUST_STABLE }}
|
||||
override: true
|
||||
profile: minimal
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/rustfilt
|
||||
key: cargo-bpf-bins-${{ runner.os }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache
|
||||
key: solana-${{ env.SOLANA_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
./ci/install-build-deps.sh
|
||||
./ci/install-program-deps.sh
|
||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build and test
|
||||
run: ./ci/cargo-test-bpf.sh record
|
|
@ -0,0 +1,57 @@
|
|||
name: Shared Memory Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'shared-memory/**'
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- 'shared-memory/**'
|
||||
|
||||
jobs:
|
||||
cargo-test-bpf:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set env vars
|
||||
run: |
|
||||
source ci/rust-version.sh
|
||||
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
|
||||
source ci/solana-version.sh
|
||||
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.RUST_STABLE }}
|
||||
override: true
|
||||
profile: minimal
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/rustfilt
|
||||
key: cargo-bpf-bins-${{ runner.os }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache
|
||||
key: solana-${{ env.SOLANA_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
./ci/install-build-deps.sh
|
||||
./ci/install-program-deps.sh
|
||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build and test
|
||||
run: ./ci/cargo-test-bpf.sh shared-memory
|
|
@ -0,0 +1,59 @@
|
|||
name: Stake Pool Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'stake-pool/**'
|
||||
- 'token/**'
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- 'stake-pool/**'
|
||||
- 'token/**'
|
||||
|
||||
jobs:
|
||||
cargo-test-bpf:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set env vars
|
||||
run: |
|
||||
source ci/rust-version.sh
|
||||
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
|
||||
source ci/solana-version.sh
|
||||
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.RUST_STABLE }}
|
||||
override: true
|
||||
profile: minimal
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/rustfilt
|
||||
key: cargo-bpf-bins-${{ runner.os }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache
|
||||
key: solana-${{ env.SOLANA_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
./ci/install-build-deps.sh
|
||||
./ci/install-program-deps.sh
|
||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build and test
|
||||
run: ./ci/cargo-test-bpf.sh stake-pool
|
|
@ -0,0 +1,90 @@
|
|||
name: Token Lending Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'token-lending/**'
|
||||
- 'token/**'
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- 'token-lending/**'
|
||||
- 'token/**'
|
||||
|
||||
jobs:
|
||||
cargo-test-bpf:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set env vars
|
||||
run: |
|
||||
source ci/rust-version.sh
|
||||
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
|
||||
source ci/solana-version.sh
|
||||
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.RUST_STABLE }}
|
||||
override: true
|
||||
profile: minimal
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/rustfilt
|
||||
key: cargo-bpf-bins-${{ runner.os }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache
|
||||
key: solana-${{ env.SOLANA_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
./ci/install-build-deps.sh
|
||||
./ci/install-program-deps.sh
|
||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build and test
|
||||
run: ./ci/cargo-test-bpf.sh token-lending
|
||||
|
||||
- name: Upload programs
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: token-lending-programs
|
||||
path: "target/deploy/*.so"
|
||||
if-no-files-found: error
|
||||
|
||||
js-test:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
NODE_VERSION: 12.x
|
||||
needs: cargo-test-bpf
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: node-${{ hashFiles('token-lending/js/package-lock.json') }}
|
||||
restore-keys: |
|
||||
node-
|
||||
- name: Download programs
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: token-lending-programs
|
||||
path: target/deploy
|
||||
- run: ./ci/js-test-token-lending.sh
|
|
@ -0,0 +1,154 @@
|
|||
name: Token Swap Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'token-swap/**'
|
||||
- 'token/**'
|
||||
- 'libraries/math/**'
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- 'token-swap/**'
|
||||
- 'token/**'
|
||||
- 'libraries/math/**'
|
||||
|
||||
jobs:
|
||||
cargo-test-bpf:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set env vars
|
||||
run: |
|
||||
source ci/rust-version.sh
|
||||
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
|
||||
source ci/solana-version.sh
|
||||
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.RUST_STABLE }}
|
||||
override: true
|
||||
profile: minimal
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/rustfilt
|
||||
key: cargo-bpf-bins-${{ runner.os }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache
|
||||
key: solana-${{ env.SOLANA_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
./ci/install-build-deps.sh
|
||||
./ci/install-program-deps.sh
|
||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build and test
|
||||
run: ./ci/cargo-test-bpf.sh token-swap
|
||||
|
||||
- name: Build production version
|
||||
run: |
|
||||
cargo +"$RUST_STABLE" build-bpf \
|
||||
--manifest-path=token-swap/program/Cargo.toml \
|
||||
--features production \
|
||||
--bpf-out-dir target/deploy-production
|
||||
env:
|
||||
SWAP_PROGRAM_OWNER_FEE_ADDRESS: HfoTxFR1Tm6kGmWgYWD6J7YHVy1UwqSULUGVLXkJqaKN
|
||||
|
||||
- name: Move production version for upload
|
||||
run: |
|
||||
mv target/deploy-production/spl_token_swap.so target/deploy/spl_token_swap_production.so
|
||||
|
||||
- name: Upload programs
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: token-swap-programs
|
||||
path: "target/deploy/*.so"
|
||||
if-no-files-found: error
|
||||
|
||||
js-test:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
NODE_VERSION: 12.x
|
||||
needs: cargo-test-bpf
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: node-${{ hashFiles('token-swap/js/package-lock.json') }}
|
||||
restore-keys: |
|
||||
node-
|
||||
- name: Download programs
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: token-swap-programs
|
||||
path: target/deploy
|
||||
- run: ./ci/js-test-token-swap.sh
|
||||
|
||||
fuzz:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set env vars
|
||||
run: |
|
||||
source ci/rust-version.sh
|
||||
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
|
||||
source ci/solana-version.sh
|
||||
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.RUST_STABLE }}
|
||||
override: true
|
||||
profile: minimal
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: token-swap-fuzz-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/cargo-hfuzz
|
||||
~/.cargo/bin/cargo-honggfuzz
|
||||
key: cargo-fuzz-bins-${{ runner.os }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache
|
||||
key: solana-${{ env.SOLANA_VERSION }}
|
||||
restore-keys: |
|
||||
solana-
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
./ci/install-build-deps.sh
|
||||
./ci/install-program-deps.sh
|
||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Run fuzz target
|
||||
run: ./ci/fuzz.sh token-swap-instructions 30 # 30 seconds, just to check everything is ok
|
|
@ -0,0 +1,93 @@
|
|||
name: Token Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'associated-token-account/**'
|
||||
- 'token/**'
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- 'associated-token-account/**'
|
||||
- 'token/**'
|
||||
|
||||
jobs:
|
||||
cargo-test-bpf:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set env vars
|
||||
run: |
|
||||
source ci/rust-version.sh
|
||||
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
|
||||
source ci/solana-version.sh
|
||||
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.RUST_STABLE }}
|
||||
override: true
|
||||
profile: minimal
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/rustfilt
|
||||
key: cargo-bpf-bins-${{ runner.os }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache
|
||||
key: solana-${{ env.SOLANA_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
./ci/install-build-deps.sh
|
||||
./ci/install-program-deps.sh
|
||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build and test
|
||||
run: ./ci/cargo-test-bpf.sh token
|
||||
|
||||
- name: Build and test
|
||||
run: ./ci/cargo-test-bpf.sh associated-token-account
|
||||
|
||||
- name: Upload programs
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: token-programs
|
||||
path: "target/deploy/*.so"
|
||||
if-no-files-found: error
|
||||
|
||||
js-test:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
NODE_VERSION: 12.x
|
||||
needs: cargo-test-bpf
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: node-${{ hashFiles('token/js/package-lock.json') }}
|
||||
restore-keys: |
|
||||
node-
|
||||
- name: Download programs
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: token-programs
|
||||
path: target/deploy
|
||||
- run: ./ci/js-test-token.sh
|
|
@ -16,10 +16,6 @@ jobs:
|
|||
- rustfmt
|
||||
- clippy
|
||||
- cargo-build-test
|
||||
- js-test-token
|
||||
- js-test-token-swap
|
||||
- js-test-token-lending
|
||||
- fuzz
|
||||
steps:
|
||||
- run: echo "Done"
|
||||
|
||||
|
@ -128,135 +124,3 @@ jobs:
|
|||
|
||||
- name: Build and test
|
||||
run: ./ci/cargo-build-test.sh
|
||||
|
||||
- name: Upload programs
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: programs
|
||||
path: "target/deploy/*.so"
|
||||
if-no-files-found: error
|
||||
|
||||
js-test-token:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
NODE_VERSION: 12.x
|
||||
needs: cargo-build-test
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: node-token-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
node-token-
|
||||
- name: Download programs
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: programs
|
||||
path: target/bpfel-unknown-unknown/release
|
||||
- run: ./ci/js-test-token.sh
|
||||
|
||||
js-test-token-swap:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
NODE_VERSION: 12.x
|
||||
needs: cargo-build-test
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: node-token-swap-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
node-token-swap-
|
||||
- name: Download programs
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: programs
|
||||
path: target/deploy
|
||||
- run: ./ci/js-test-token-swap.sh
|
||||
|
||||
js-test-token-lending:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
NODE_VERSION: 12.x
|
||||
needs: cargo-build-test
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: node-token-lending-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
node-token-lending-
|
||||
- name: Download programs
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: programs
|
||||
path: target/deploy
|
||||
- run: ./ci/js-test-token-lending.sh
|
||||
|
||||
fuzz:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
fuzz_target: [token-swap-instructions]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set env vars
|
||||
run: |
|
||||
source ci/rust-version.sh
|
||||
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
|
||||
source ci/solana-version.sh
|
||||
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.RUST_STABLE }}
|
||||
override: true
|
||||
profile: minimal
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: cargo-fuzz-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/cargo-hfuzz
|
||||
~/.cargo/bin/cargo-honggfuzz
|
||||
key: cargo-fuzz-bins-${{ runner.os }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache
|
||||
key: solana-${{ env.SOLANA_VERSION }}
|
||||
restore-keys: |
|
||||
solana-
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
./ci/install-build-deps.sh
|
||||
./ci/install-program-deps.sh
|
||||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Run fuzz target
|
||||
run: ./ci/fuzz.sh ${{ matrix.fuzz_target }} 30 # 30 seconds, just to check everything is ok
|
||||
|
|
|
@ -2310,10 +2310,30 @@ dependencies = [
|
|||
"byteorder",
|
||||
"lazy_static",
|
||||
"num-traits",
|
||||
"quick-error",
|
||||
"quick-error 1.2.3",
|
||||
"rand 0.7.3",
|
||||
"rand_chacha 0.2.2",
|
||||
"rand_xorshift",
|
||||
"rand_xorshift 0.2.0",
|
||||
"regex-syntax",
|
||||
"rusty-fork",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proptest"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e0d9cc07f18492d879586c92b485def06bc850da3118075cd45d50e9c95b0e5"
|
||||
dependencies = [
|
||||
"bit-set",
|
||||
"bitflags",
|
||||
"byteorder",
|
||||
"lazy_static",
|
||||
"num-traits",
|
||||
"quick-error 2.0.1",
|
||||
"rand 0.8.3",
|
||||
"rand_chacha 0.3.0",
|
||||
"rand_xorshift 0.3.0",
|
||||
"regex-syntax",
|
||||
"rusty-fork",
|
||||
"tempfile",
|
||||
|
@ -2372,6 +2392,12 @@ version = "1.2.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.6.13"
|
||||
|
@ -2490,6 +2516,15 @@ dependencies = [
|
|||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_xorshift"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f"
|
||||
dependencies = [
|
||||
"rand_core 0.6.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.5.0"
|
||||
|
@ -2686,7 +2721,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"quick-error",
|
||||
"quick-error 1.2.3",
|
||||
"tempfile",
|
||||
"wait-timeout",
|
||||
]
|
||||
|
@ -3766,7 +3801,7 @@ dependencies = [
|
|||
"borsh",
|
||||
"num-derive",
|
||||
"num-traits",
|
||||
"proptest",
|
||||
"proptest 0.10.1",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"solana-program",
|
||||
|
@ -3784,7 +3819,7 @@ dependencies = [
|
|||
"borsh-derive",
|
||||
"num-derive",
|
||||
"num-traits",
|
||||
"proptest",
|
||||
"proptest 0.10.1",
|
||||
"solana-program",
|
||||
"solana-program-test",
|
||||
"solana-sdk",
|
||||
|
@ -3857,7 +3892,7 @@ dependencies = [
|
|||
"num-derive",
|
||||
"num-traits",
|
||||
"num_enum",
|
||||
"proptest",
|
||||
"proptest 0.10.1",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"solana-program",
|
||||
|
@ -3949,7 +3984,7 @@ dependencies = [
|
|||
"log",
|
||||
"num-derive",
|
||||
"num-traits",
|
||||
"proptest",
|
||||
"proptest 1.0.0",
|
||||
"serde",
|
||||
"serde_yaml",
|
||||
"solana-program",
|
||||
|
@ -3969,7 +4004,7 @@ dependencies = [
|
|||
"enum_dispatch",
|
||||
"num-derive",
|
||||
"num-traits",
|
||||
"proptest",
|
||||
"proptest 1.0.0",
|
||||
"roots",
|
||||
"sim",
|
||||
"solana-program",
|
||||
|
|
|
@ -14,7 +14,7 @@ test-bpf = []
|
|||
num-derive = "0.3"
|
||||
num-traits = "0.2"
|
||||
solana-program = "1.6.7"
|
||||
spl-token = { version = "3.0", path = "../../token/program", features = [ "no-entrypoint" ] }
|
||||
spl-token = { version = "3.1", path = "../../token/program", features = [ "no-entrypoint" ] }
|
||||
thiserror = "1.0"
|
||||
uint = "0.8"
|
||||
arbitrary = { version = "0.4", features = ["derive"], optional = true }
|
||||
|
|
|
@ -14,10 +14,6 @@ set -x
|
|||
# Build all C examples
|
||||
make -C examples/c
|
||||
|
||||
# Build/test all BPF programs
|
||||
cargo +"$rust_stable" test-bpf -- --nocapture
|
||||
rm -rf target/debug # Prevents running out of space on github action runners
|
||||
|
||||
# Build/test all host crates
|
||||
cargo +"$rust_stable" build
|
||||
cargo +"$rust_stable" test -- --nocapture
|
||||
|
@ -29,13 +25,6 @@ cargo +"$rust_stable" run --manifest-path=utils/test-client/Cargo.toml
|
|||
# client_ristretto disabled because it requires RpcBanksService, which is no longer supported.
|
||||
#cargo +"$rust_stable" test --manifest-path=themis/client_ristretto/Cargo.toml -- --nocapture
|
||||
|
||||
SWAP_PROGRAM_OWNER_FEE_ADDRESS="HfoTxFR1Tm6kGmWgYWD6J7YHVy1UwqSULUGVLXkJqaKN" \
|
||||
cargo +"$rust_stable" build-bpf \
|
||||
--manifest-path=token-swap/program/Cargo.toml \
|
||||
--features production \
|
||||
--bpf-out-dir target/deploy-production
|
||||
mv target/deploy-production/spl_token_swap.so target/deploy/spl_token_swap_production.so
|
||||
|
||||
# # Check generated C headers
|
||||
# cargo run --manifest-path=utils/cgen/Cargo.toml
|
||||
#
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
source ./ci/rust-version.sh stable
|
||||
source ./ci/solana-version.sh
|
||||
|
||||
export RUSTFLAGS="-D warnings"
|
||||
export RUSTBACKTRACE=1
|
||||
|
||||
usage() {
|
||||
exitcode=0
|
||||
if [[ -n "$1" ]]; then
|
||||
exitcode=1
|
||||
echo "Error: $*"
|
||||
fi
|
||||
echo "Usage: $0 [program-directory]"
|
||||
exit $exitcode
|
||||
}
|
||||
|
||||
program_directory=$1
|
||||
if [[ -z $program_directory ]]; then
|
||||
usage "No program directory provided"
|
||||
fi
|
||||
|
||||
set -x
|
||||
|
||||
cd $program_directory
|
||||
run_dir=$(pwd)
|
||||
|
||||
if [[ -d $run_dir/program ]]; then
|
||||
# Build/test just one BPF program
|
||||
cd $run_dir/program
|
||||
cargo +"$rust_stable" test-bpf -- --nocapture
|
||||
else
|
||||
# Build/test all BPF programs
|
||||
for directory in $(ls -d $run_dir/*/); do
|
||||
cd $directory
|
||||
cargo +"$rust_stable" test-bpf -- --nocapture
|
||||
done
|
||||
fi
|
|
@ -18,7 +18,6 @@ else
|
|||
fi
|
||||
|
||||
export solana_version="$solana_version"
|
||||
export solana_docker_image=solanalabs/solana:"$solana_version"
|
||||
export PATH="$HOME"/.local/share/solana/install/active_release/bin:"$PATH"
|
||||
|
||||
if [[ -n $1 ]]; then
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Program examples written in Rust
|
||||
|
||||
The examples in this directory demonstrate various Solana program mechanisms.
|
||||
|
|
|
@ -21,7 +21,7 @@ thiserror = "1.0"
|
|||
uint = "0.8"
|
||||
|
||||
[dev-dependencies]
|
||||
proptest = "0.10"
|
||||
proptest = "1.0.0"
|
||||
solana-program-test = "1.6.7"
|
||||
solana-sdk = "1.6.7"
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
cd "$(dirname "$0")"
|
||||
cargo fmt -- --check
|
||||
cargo clippy
|
||||
cargo build
|
||||
cargo build-bpf
|
||||
|
||||
if [[ $1 = -v ]]; then
|
||||
export RUST_LOG=solana=debug
|
||||
fi
|
||||
|
||||
cargo test
|
||||
cargo test-bpf
|
|
@ -24,6 +24,5 @@ thiserror = "1.0.24"
|
|||
solana-program-test = "1.6.7"
|
||||
solana-sdk = "1.6.7"
|
||||
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "lib"]
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// Mark this test as BPF-only due to current `ProgramTest` limitations when CPIing into the system program
|
||||
#![cfg(feature = "test-bpf")]
|
||||
|
||||
use {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Shared memory program
|
||||
|
||||
A shared-memory program on the Solana blockchain, usable for for sharing data
|
||||
A shared-memory program on the Solana blockchain, usable for sharing data
|
||||
between programs or within cross-program invocations.
|
||||
|
||||
Full documentation is available at https://spl.solana.com/shared-memory
|
||||
|
|
|
@ -38,6 +38,7 @@ export async function createLendingMarket(): Promise<void> {
|
|||
TOKEN_PROGRAM_ID
|
||||
);
|
||||
|
||||
console.log("creating lending market");
|
||||
const lendingMarketAccount = new Account();
|
||||
await LendingMarket.create({
|
||||
connection,
|
||||
|
|
|
@ -30,6 +30,7 @@ export const LendingMarketLayout: typeof BufferLayout.Structure = BufferLayout.s
|
|||
Layout.publicKey("owner"),
|
||||
Layout.publicKey("quoteTokenMint"),
|
||||
Layout.publicKey("tokenProgramId"),
|
||||
Layout.publicKey("oracleProgramId"),
|
||||
BufferLayout.blob(128, "padding"),
|
||||
]
|
||||
);
|
||||
|
@ -118,22 +119,23 @@ export class LendingMarket {
|
|||
isSigner: false,
|
||||
isWritable: true,
|
||||
},
|
||||
{
|
||||
pubkey: lendingMarket.quoteTokenMint,
|
||||
isSigner: false,
|
||||
isWritable: false,
|
||||
},
|
||||
{ pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },
|
||||
{
|
||||
pubkey: lendingMarket.tokenProgramId,
|
||||
isSigner: false,
|
||||
isWritable: false,
|
||||
},
|
||||
{
|
||||
pubkey: new Account().publicKey, // TODO use the oracle program id
|
||||
isSigner: false,
|
||||
isWritable: false,
|
||||
},
|
||||
];
|
||||
|
||||
const commandDataLayout = BufferLayout.struct([
|
||||
BufferLayout.u8("instruction"),
|
||||
Layout.publicKey("owner"),
|
||||
Layout.publicKey("quoteCurrency"),
|
||||
]);
|
||||
let data = Buffer.alloc(1024);
|
||||
{
|
||||
|
@ -141,6 +143,7 @@ export class LendingMarket {
|
|||
{
|
||||
instruction: 0, // InitLendingMarket instruction
|
||||
owner: lendingMarket.owner.toBuffer(),
|
||||
quoteCurrency: lendingMarket.quoteTokenMint.toBuffer(),
|
||||
},
|
||||
data
|
||||
);
|
||||
|
|
|
@ -25,7 +25,7 @@ uint = "0.8"
|
|||
assert_matches = "1.5.0"
|
||||
base64 = "0.13"
|
||||
log = "0.4.14"
|
||||
proptest = "0.10"
|
||||
proptest = "1.0"
|
||||
solana-program-test = "1.6.7"
|
||||
solana-sdk = "1.6.7"
|
||||
serde = "1.0"
|
||||
|
|
|
@ -26,7 +26,7 @@ roots = { version = "0.0.6", optional = true }
|
|||
|
||||
[dev-dependencies]
|
||||
solana-sdk = "1.6.7"
|
||||
proptest = "0.10"
|
||||
proptest = "1.0"
|
||||
sim = { path = "./sim" }
|
||||
roots = "0.0.6"
|
||||
|
||||
|
|
|
@ -1,289 +0,0 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
|
||||
[[package]]
|
||||
name = "cloudabi"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ctor"
|
||||
version = "0.1.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fbaabec2c953050352311293be5c6aba8e141ba19d6811862b232d6fd020484"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ghost"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a5bcf1bbeab73aa4cf2fde60a846858dc036163c7c33bec309f8d17de785479"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indoc"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47741a8bc60fb26eb8d6e0238bbb26d8575ff623fdc97b1a2c00c050b9684ed8"
|
||||
dependencies = [
|
||||
"indoc-impl",
|
||||
"proc-macro-hack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indoc-impl"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce046d161f000fffde5f432a0d034d0341dc152643b2598ed5bfce44c4f3a8f0"
|
||||
dependencies = [
|
||||
"proc-macro-hack",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"unindent",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "instant"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63312a18f7ea8760cdd0a7c5aac1a619752a246b833545e3e36d1f81f7cd9e66"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inventory"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fedd49de24d8c263613701406611410687148ae8c37cd6452650b250f753a0dd"
|
||||
dependencies = [
|
||||
"ctor",
|
||||
"ghost",
|
||||
"inventory-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inventory-impl"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ddead8880bc50f57fcd3b5869a7f6ff92570bb4e8f6870c22e2483272f2256da"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c"
|
||||
dependencies = [
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733"
|
||||
dependencies = [
|
||||
"instant",
|
||||
"lock_api",
|
||||
"parking_lot_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cloudabi",
|
||||
"instant",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "0.1.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880"
|
||||
dependencies = [
|
||||
"paste-impl",
|
||||
"proc-macro-hack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste-impl"
|
||||
version = "0.1.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6"
|
||||
dependencies = [
|
||||
"proc-macro-hack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-hack"
|
||||
version = "0.5.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pyo3"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9b90d637542bbf29b140fdd38fa308424073fd2cdf641a5680aed8020145e3c"
|
||||
dependencies = [
|
||||
"ctor",
|
||||
"indoc",
|
||||
"inventory",
|
||||
"libc",
|
||||
"parking_lot",
|
||||
"paste",
|
||||
"pyo3cls",
|
||||
"unindent",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pyo3-derive-backend"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cee2c9fb095acb885ab7e85acc7c8e95da8c4bc7cc4b4ea64b566dfc8c91046a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pyo3cls"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f12fdd8a2f217d003c93f9819e3db1717b2e89530171edea4c0deadd90206f50"
|
||||
dependencies = [
|
||||
"pyo3-derive-backend",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.1.57"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
|
||||
[[package]]
|
||||
name = "sim"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"pyo3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e03e57e4fcbfe7749842d53e24ccb9aa12b7252dbe5e91d2acad31834c8b8fdd"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
|
||||
[[package]]
|
||||
name = "unindent"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|
@ -121,11 +121,11 @@ async function GetPrograms(connection: Connection): Promise<void> {
|
|||
|
||||
programId = await loadProgram(
|
||||
connection,
|
||||
'../../target/bpfel-unknown-unknown/release/spl_token.so',
|
||||
'../../target/deploy/spl_token.so',
|
||||
);
|
||||
associatedProgramId = await loadProgram(
|
||||
connection,
|
||||
'../../target/bpfel-unknown-unknown/release/spl_associated_token_account.so',
|
||||
'../../target/deploy/spl_associated_token_account.so',
|
||||
);
|
||||
await store.save('config.json', {
|
||||
tokenProgramId: programId.toString(),
|
||||
|
|
Loading…
Reference in New Issue