-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add minimal viable Anchor #602
Changes from 25 commits
a71917b
8d93d13
c4fdb03
24ac9f1
87deab3
2336c5c
96fe436
56a75ea
99bd393
1922aa2
8888d86
106eff2
2a6a9b0
c9c3876
c24b3ae
a99d549
780fa55
e4fbcf5
16fcfe7
a9213eb
83d610c
39733d6
57f74a7
4a958fd
4ed9598
b13eaef
84689ff
27c3201
393e9bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,53 +6,111 @@ jobs: | |
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node: [16] | ||
node: | ||
- 20 | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Use Node ${{ matrix.node }} | ||
- name: "Use Node ${{ matrix.node }}" | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: "yarn" | ||
node-version: "${{ matrix.node }}" | ||
cache: yarn | ||
- name: Setup Anchor & Build | ||
uses: metadaoproject/setup-anchor@v2 | ||
with: | ||
anchor-version: 0.30.1 | ||
solana-cli-version: 1.18.21 | ||
node-version: 20.17.0 | ||
- name: Create keypair | ||
run: solana-keygen new --no-bip39-passphrase | ||
shell: bash | ||
- name: Make Anchor.toml compatible with runner | ||
run: "sed -i 's:/user/:/runner/:' Anchor.toml" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see the string There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I might actually be able to delete this. it was trying to get anchor to detect the |
||
shell: bash | ||
- name: Install Cargo toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
components: rustc | ||
- name: Install packages | ||
run: yarn install --frozen-lockfile | ||
- name: Lint | ||
run: yarn lint | ||
- name: Lint js | ||
shell: bash | ||
run: yarn lint-js | ||
- name: Lint solidity | ||
shell: bash | ||
run: yarn lint-solidity | ||
- name: Lint rust | ||
shell: bash | ||
run: yarn lint-rust | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node: [16] | ||
node: | ||
- 20 | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Use Node ${{ matrix.node }} | ||
- name: "Use Node ${{ matrix.node }}" | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: "yarn" | ||
node-version: "${{ matrix.node }}" | ||
cache: yarn | ||
- name: Setup Anchor & Build | ||
uses: metadaoproject/setup-anchor@v2 | ||
with: | ||
anchor-version: 0.30.1 | ||
solana-cli-version: 1.18.21 | ||
node-version: 20.17.0 | ||
- name: Create keypair | ||
run: solana-keygen new --no-bip39-passphrase | ||
shell: bash | ||
- name: Make Anchor.toml compatible with runner | ||
run: "sed -i 's:/user/:/runner/:' Anchor.toml" | ||
shell: bash | ||
- name: Install Cargo toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
components: rustc | ||
- name: Cache Cargo dependencies | ||
uses: Swatinem/rust-cache@v2 | ||
- name: Install packages | ||
run: yarn install --frozen-lockfile | ||
- name: Build | ||
run: yarn build | ||
- name: Test | ||
run: yarn test | ||
- name: Test evm-hardhat | ||
shell: bash | ||
run: yarn test-evm | ||
- name: Test svm | ||
shell: bash | ||
run: yarn test-svm | ||
forge: | ||
name: Forge | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node: [16] | ||
node: | ||
- 20 | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Use Node ${{ matrix.node }} | ||
- name: "Use Node ${{ matrix.node }}" | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: "yarn" | ||
node-version: "${{ matrix.node }}" | ||
cache: yarn | ||
- name: Setup Anchor & Build | ||
uses: metadaoproject/setup-anchor@v2 | ||
with: | ||
anchor-version: 0.30.1 | ||
solana-cli-version: 1.18.21 | ||
node-version: 20.17.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this break if the node version varies (i.e. 20 resolves to 20.17.1)? Can we just specify 20 here or does it have to be specific? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it will work just fine? the version specified above in the config has There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test worked just fine with the node version simply being "20" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perfect |
||
- name: Install packages | ||
run: yarn install --frozen-lockfile | ||
- name: Install Foundry | ||
|
@@ -61,23 +119,5 @@ jobs: | |
run: forge install | ||
- name: Inspect storage layouts | ||
run: ./scripts/checkStorageLayout.sh | ||
- name: Run forge test | ||
run: forge test --match-path test/foundry/local/**/*.t.sol | ||
solhint: | ||
name: Solhint | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node: [16] | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Use Node ${{ matrix.node }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: "yarn" | ||
- name: Install packages | ||
run: yarn install --frozen-lockfile | ||
- name: Solhint | ||
run: yarn lint-contracts | ||
- name: Test evm-foundry | ||
run: forge test --match-path test/evm/foundry/local/**/*.t.sol |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,13 @@ jobs: | |
uses: manovotny/[email protected] | ||
|
||
# Setup .npmrc file to publish to npm | ||
- name: Setup Anchor & Build | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe move the comment above down to above npm? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yup, sorry. I messed that up. have fixed it. |
||
- uses: metadaoproject/setup-anchor@v2 | ||
with: | ||
anchor-version: "0.30.1" | ||
solana-cli-version: "1.18.21" | ||
node-version: "20.17.0" | ||
- run: anchor build | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16.x" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ dist | |
artifacts-zk | ||
cache-zk | ||
lib | ||
target |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[toolchain] | ||
|
||
[features] | ||
resolution = true | ||
skip-lint = false | ||
|
||
[programs.localnet] | ||
testacross = "E4dpZS9P24pscXvPngpeUhrR98uZYMfi3VMLnLaYDA6b" | ||
|
||
[registry] | ||
url = "https://api.apr.dev" | ||
|
||
[provider] | ||
cluster = "Localnet" | ||
wallet = "~/.config/solana/id.json" | ||
|
||
[scripts] | ||
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 test/svm/**/*.ts" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside: is github CI smart enough to only run certain tasks if certain files are changed? For example, we should only run anchor tasks if solana files are touched right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not easily. right now it will do all parts of the work flow on each run. we can improve this later. it's not too slow by comparison to how it was before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conditional runs are pretty hard, but I think there are easier ways to make it less imapctful.
Two things on this if it becomes a pain point: