Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration tests for auction house with local validator #666

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
ead0f46
Try and run action
elo-siema Aug 9, 2022
8bc7fde
fix path
elo-siema Aug 9, 2022
36757e4
Add onchain / source integration test stub for AH
elo-siema Aug 9, 2022
be0a80b
Make ID unique
elo-siema Aug 9, 2022
e8effce
Unbound parameter fix
elo-siema Aug 9, 2022
6feb080
Another try
elo-siema Aug 9, 2022
a943b5f
path fix
elo-siema Aug 9, 2022
97b9a63
Fix test
elo-siema Aug 9, 2022
b568344
amman stop
elo-siema Aug 9, 2022
4d0c304
Hopes and prayers
elo-siema Aug 9, 2022
882355d
amman stop
elo-siema Aug 9, 2022
121ad23
fix
elo-siema Aug 9, 2022
fd73746
fix metaplex
elo-siema Aug 9, 2022
a737e16
Test anchor
Aug 9, 2022
1b66e15
Test aidrop
Aug 9, 2022
2d57f45
Implement AH transaction
Aug 10, 2022
143bac7
Dont skip preflight
Aug 10, 2022
56f2662
skip preflight set to false
Aug 10, 2022
e7c63b9
Nest test
Aug 10, 2022
df4e755
Add deposit test
Aug 10, 2022
09b408b
Assert wallet_sol_post_balance post deposit
elo-siema Aug 10, 2022
6e2693c
tslint
elo-siema Aug 10, 2022
f008b51
grrr tslint
elo-siema Aug 10, 2022
96458a8
airdrop fix
elo-siema Aug 10, 2022
906a631
lsol post balance
elo-siema Aug 10, 2022
5f192cd
withdraw asserts
elo-siema Aug 10, 2022
2dca4ec
Fix test
Aug 10, 2022
6e3b125
Fix
Aug 10, 2022
0305ed7
Refactor
Aug 10, 2022
c99785e
Fix
Aug 10, 2022
6172e0d
try tape command
elo-siema Aug 10, 2022
f66b36f
LOCALHOST from amman
elo-siema Aug 11, 2022
f851533
Merge branch 'master' into auction-house-integration-tests
elo-siema Aug 11, 2022
bb384f8
pkg.json fix
elo-siema Aug 11, 2022
7fa1762
Remove export
Aug 11, 2022
8841214
test multiple bundle
Aug 11, 2022
58347aa
Unify file
Aug 11, 2022
2aa251e
Use signoff
Aug 11, 2022
efa781c
Add auth signature
Aug 11, 2022
0f88fb4
Reference getAuctionHouse... fns from cli
elo-siema Aug 11, 2022
9641488
remove tsignore
elo-siema Aug 11, 2022
074e3f4
path fix
elo-siema Aug 11, 2022
3d8b751
remove utils
elo-siema Aug 11, 2022
066828a
Final cleanup
elo-siema Aug 11, 2022
73d61c8
build AH CLI in CI
elo-siema Aug 11, 2022
3e4cdb1
trigger
elo-siema Aug 11, 2022
6f5582a
Merge branch 'master' into auction-house-integration-tests
elo-siema Aug 11, 2022
55c914d
Merge remote-tracking branch 'origin/master' into auction-house-integ…
elo-siema Aug 18, 2022
835ada4
lockfile
elo-siema Aug 19, 2022
d6b01b8
Merge remote-tracking branch 'origin/master' into auction-house-integ…
elo-siema Aug 25, 2022
7e6ad86
Yarn lock after merge
elo-siema Aug 25, 2022
a7087ca
prettier
elo-siema Aug 25, 2022
91dc635
Merge remote-tracking branch 'upstream/master' into auction-house-int…
elo-siema Aug 25, 2022
a623eff
Merge branch 'master' of https://github.com/metaplex-foundation/metap…
elo-siema Sep 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .base-ammanrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,15 @@ const programs = {
programId: 'cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ',
deployPath: localDeployPath('mpl_candy_machine'),
},
auction_house: {
label: "Auction House",
programId: 'hausS13jsjafwWwGqZTUQRmWyvyxn9EQpqMwV1PBBmk',
deployPath: localDeployPath('mpl_auction_house'),
},
};

const validator = {
accountsCluster: 'https://api.metaplex.solana.com',
killRunningValidators: true,
programs,
commitment: 'singleGossip',
Expand Down
28 changes: 28 additions & 0 deletions .github/actions/yarn-install-and-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ inputs:
description: If true it will build the token_vault package
required: false
default: false
build_auction_house:
description: If true it will build the auction_house package
required: false
default: false
build_auction_house_cli:
description: If true it will build the auction_house CLI package
required: false
default: false

runs:
using: composite
Expand Down Expand Up @@ -83,6 +91,26 @@ runs:
working-directory: ./token-vault/js
shell: bash

- name: Install and Build auction-house
if: inputs.build_auction_house == 'true'
run: |
echo 'Install and Build auction_house: yarn install'
yarn install
echo 'Install and Build auction_house: yarn build'
yarn build
working-directory: ./auction-house/js
shell: bash

- name: Install and Build auction-house CLI
if: inputs.build_auction_house_cli == 'true'
run: |
echo 'Install and Build auction_house CLI: yarn install'
yarn install
echo 'Install and Build auction_house CLI: yarn build'
yarn build
working-directory: ./auction-house/cli
shell: bash

##############
# Build Contract
##############
Expand Down
104 changes: 104 additions & 0 deletions .github/workflows/integration-auction-house.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Integration Auction House

on:
push:
branches: [master]
pull_request:
branches: [master]

env:
CARGO_TERM_COLOR: always
SOLANA_VERSION: 1.9.14
RUST_TOOLCHAIN: stable

jobs:
changes:
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
core: ${{ steps.filter.outputs.core }}
package: ${{ steps.filter.outputs.package }}
steps:
- uses: actions/checkout@v2
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
core:
- 'core/**'
package:
- 'auction-house/**'
build-and-integration-test-auction-house:
runs-on: ubuntu-latest
env:
cache_id: program-auction-house
needs: changes
if: ${{ needs.changes.outputs.core == 'true' || needs.changes.outputs.package == 'true' }}
steps:
# Setup Deps
- uses: actions/checkout@v2
- uses: ./.github/actions/install-linux-build-deps
- uses: ./.github/actions/install-solana
with:
solana_version: ${{ env.SOLANA_VERSION }}
- uses: ./.github/actions/install-rust
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}

# Restore Cache from previous build/test
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./rust/target
key: ${{ env.cache_id }}-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUSTC_HASH }}

# Build Rust Programs
- uses: ./.github/actions/build-auction-house

# Install JS SDK deps
- uses: ./.github/actions/yarn-install-and-build
with:
cache_id: sdk-auction-house
working_dir: ./auction-house/js
build_auction_house: true

# Install CLI deps
- uses: ./.github/actions/yarn-install-and-build
with:
cache_id: sdk-auction-house
working_dir: ./auction-house/cli
build_auction_house_cli: true

# Run integration test
- name: start-local-test-validator
working-directory: ./auction-house/js
run: DEBUG=amman* yarn amman:start

- name: integration-test-auction-house-program
id: run_integration_test
working-directory: ./auction-house/js
run: DEBUG=mpl* yarn test

- name: stop-local-test-validator
working-directory: ./auction-house/js
run: DEBUG=amman* yarn amman:stop

# Run integration test - onchain program
- name: start-local-test-validator-onchain
working-directory: ./auction-house/js
run: DEBUG=amman* yarn amman:start-custom-ammanrc onchain.ammanrc.js

- name: integration-test-auction-house-program
id: run_integration_test_onchain
working-directory: ./auction-house/js
run: DEBUG=mpl* yarn test

- name: stop-local-test-validator
working-directory: ./auction-house/js
run: DEBUG=amman* yarn amman:stop

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ members=[
"token-vault/program",
"token-vault/test",
"nft-packs/program",
"fixed-price-sale/program"
"fixed-price-sale/program",
]
exclude = [
"fixed-price-sale/cli",
Expand Down
3 changes: 2 additions & 1 deletion auction-house/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"format:check": "prettier --loglevel warn --check \"**/*.{ts,js,json,yaml}\"",
"lint:eslint": "eslint '{src,test}/**/*.{ts,tsx}'",
"lint:fix": "prettier --write '{src,test}/**/*.{ts,tsx}' && eslint --fix '{src,test}/**/*.{ts,tsx}'",
"test": "jest"
"test": "jest",
"build": "yarn tsc -p ./src"
},
"pkg": {
"scripts": "./build/**/*.{js|json}"
Expand Down
3 changes: 3 additions & 0 deletions auction-house/cli/src/helpers/accounts.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @ts-nocheck
// Errors from this file broke the build for
// auction-house/js which references it in tests
import {
Keypair,
PublicKey,
Expand Down
3 changes: 3 additions & 0 deletions auction-house/cli/src/helpers/instructions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @ts-nocheck
// Errors from this file broke the build for
// auction-house/js which references it in tests
import {
PublicKey,
SystemProgram,
Expand Down
3 changes: 3 additions & 0 deletions auction-house/cli/src/helpers/various.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @ts-nocheck
// Errors from this file broke the build for
// auction-house/js which references it in tests
import {
LAMPORTS_PER_SOL,
AccountInfo,
Expand Down
3 changes: 2 additions & 1 deletion auction-house/cli/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"suppressImplicitAnyIndexErrors": true,
"resolveJsonModule": true,
"lib": ["dom", "es2019"],
"types": ["jest", "node", "webgl2"]
"types": ["jest", "node", "webgl2"],
"skipLibCheck": true
},
"exclude": ["node_modules", "typings/browser", "typings/browser.d.ts"],
"atom": {
Expand Down
2 changes: 1 addition & 1 deletion auction-house/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noImplicitAny": true,
"noImplicitAny": false,
"typeRoots": ["types", "node_modules/@types"]
},
"include": ["src/**/*"]
Expand Down
11 changes: 11 additions & 0 deletions auction-house/js/.ammanrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';
// @ts-check
const base = require('../../.base-ammanrc.js');

const validator = {
...base.validator,
programs: [
base.programs.auction_house,
],
};
module.exports = { validator };
1 change: 1 addition & 0 deletions auction-house/js/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.amman
19 changes: 19 additions & 0 deletions auction-house/js/onchain.ammanrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';
// @ts-check
const base = require('../../.base-ammanrc.js');

const accounts = [
{
label: "Auction House",
accountId: 'hausS13jsjafwWwGqZTUQRmWyvyxn9EQpqMwV1PBBmk',
executable: true,
},
]

const validator = {
...base.validator,
programs: [],
accounts: accounts
};

module.exports = { validator };
9 changes: 8 additions & 1 deletion auction-house/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
"build:docs": "typedoc",
"build": "rimraf dist && tsc -p tsconfig.json",
"build:watch": "rimraf dist && tsc -p tsconfig.json --watch",
"test": "esr ./test/*.test.ts",
"amman:start": "DEBUG=\"amman*\" amman start",
"amman:start-custom-ammanrc": "DEBUG=\"amman*\" amman start --config ${0}",
"amman:stop": "DEBUG=\"amman*\" amman stop",
"test:all": "yarn build && yarn amman:start && yarn test",
"test:all-custom-ammanrc": "yarn build && yarn amman:start-custom-ammanrc ${0} && yarn test",
"test": "esr ./test/**/*.ts",
"api:gen": "DEBUG='(solita|rustbin):(info|error)' solita",
"lint": "eslint \"{src,test}/**/*.ts\" --format stylish",
"fix:lint": "yarn lint --fix",
Expand Down Expand Up @@ -46,8 +51,10 @@
"bn.js": "^5.2.0"
},
"devDependencies": {
"@metaplex-foundation/amman": "^0.10.0",
"@metaplex-foundation/solita": "^0.5.0",
"@types/tape": "^4.13.2",
"esbuild-runner": "^2.2.1",
"eslint": "^8.3.0",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
Expand Down
Loading