no-cashing-tests.yaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. name: No Cashing Tests
  2. on:
  3. push:
  4. branches:
  5. - master
  6. env:
  7. SOLANA_CLI_VERSION: 1.14.7
  8. NODE_VERSION: 17.0.1
  9. jobs:
  10. test-core:
  11. name: Core Tests
  12. runs-on: ubuntu-latest
  13. timeout-minutes: 30
  14. steps:
  15. - uses: actions/checkout@v3
  16. - uses: ./.github/actions/setup/
  17. - uses: actions/setup-node@v3
  18. with:
  19. node-version: ${{ env.NODE_VERSION }}
  20. - run: cargo build
  21. - run: cargo fmt -- --check
  22. - run: cargo clippy --all-targets -- -D warnings
  23. - run: cargo test
  24. # using singlethreaded testing for avm so that tests that change files do not conflict with each other
  25. - run: cd avm && cargo fmt -- --check && cargo clippy --all-targets -- -D warnings && cargo test -- --test-threads=1
  26. - run: cd ts/packages/anchor && yarn --frozen-lockfile
  27. - run: cd ts/packages/anchor && yarn test
  28. - run: cd ts/packages/anchor && yarn lint
  29. - run: cd examples/tutorial && yarn --frozen-lockfile
  30. - run: cd examples/tutorial && yarn lint
  31. - run: cd tests && yarn --frozen-lockfile
  32. - run: cd tests && yarn lint
  33. - uses: ./.github/actions/git-diff/
  34. setup-anchor-cli:
  35. name: Setup Anchor cli
  36. runs-on: ubuntu-latest
  37. timeout-minutes: 30
  38. steps:
  39. - uses: actions/checkout@v3
  40. - uses: ./.github/actions/setup/
  41. - run: cargo install --path cli anchor-cli --locked --force
  42. - run: chmod +x ~/.cargo/bin/anchor
  43. - uses: actions/upload-artifact@v3
  44. with:
  45. name: anchor-binary-no-caching
  46. path: ~/.cargo/bin/anchor
  47. - uses: ./.github/actions/git-diff/
  48. test-examples:
  49. needs: setup-anchor-cli
  50. name: Examples Test
  51. runs-on: ubuntu-latest
  52. timeout-minutes: 30
  53. steps:
  54. - uses: actions/checkout@v3
  55. - uses: actions/download-artifact@v3
  56. with:
  57. name: anchor-binary-no-caching
  58. path: ~/.cargo/bin/
  59. - run: chmod +rwx ~/.cargo/bin/anchor
  60. - uses: ./.github/actions/setup/
  61. - uses: ./.github/actions/setup-solana/
  62. - uses: ./.github/actions/setup-ts/
  63. - run: cd examples/tutorial && yarn workspaces run test
  64. - uses: ./.github/actions/git-diff/
  65. setup-client-example:
  66. needs: setup-anchor-cli
  67. name: Setup Client Example Test
  68. runs-on: ubuntu-latest
  69. timeout-minutes: 30
  70. strategy:
  71. fail-fast: false
  72. matrix:
  73. node:
  74. - path: tests/events/
  75. name: events.so
  76. - path: examples/tutorial/basic-4/
  77. name: basic_4.so
  78. - path: examples/tutorial/basic-2/
  79. name: basic_2.so
  80. - path: tests/composite/
  81. name: composite.so
  82. steps:
  83. - uses: actions/checkout@v3
  84. - uses: ./.github/actions/setup/
  85. - uses: ./.github/actions/setup-solana/
  86. - uses: actions/download-artifact@v3
  87. with:
  88. name: anchor-binary-no-caching
  89. path: ~/.cargo/bin/
  90. - run: chmod +rwx ~/.cargo/bin/anchor
  91. - run: cd ${{ matrix.node.path }} && anchor build --skip-lint
  92. - uses: actions/upload-artifact@v3
  93. with:
  94. name: ${{ matrix.node.name }}
  95. path: ${{ matrix.node.path }}target/deploy/${{ matrix.node.name }}
  96. - uses: ./.github/actions/git-diff/
  97. test-client-example:
  98. needs: setup-client-example
  99. name: Client Example Test
  100. runs-on: ubuntu-latest
  101. timeout-minutes: 30
  102. steps:
  103. - uses: actions/checkout@v3
  104. - uses: ./.github/actions/setup/
  105. - uses: ./.github/actions/setup-ts/
  106. - uses: actions/download-artifact@v3
  107. with:
  108. name: anchor-binary-no-caching
  109. path: ~/.cargo/bin/
  110. - run: chmod +x ~/.cargo/bin/anchor
  111. - uses: actions/download-artifact@v3
  112. with:
  113. name: events.so
  114. path: tests/events/target/deploy/
  115. - uses: actions/download-artifact@v3
  116. with:
  117. name: basic_4.so
  118. path: examples/tutorial/basic-4/target/deploy/
  119. - uses: actions/download-artifact@v3
  120. with:
  121. name: basic_2.so
  122. path: examples/tutorial/basic-2/target/deploy/
  123. - uses: actions/download-artifact@v3
  124. with:
  125. name: composite.so
  126. path: tests/composite/target/deploy/
  127. - uses: ./.github/actions/setup-solana/
  128. - run: cd client/example && ./run-test.sh
  129. - uses: ./.github/actions/git-diff/
  130. test-bpf-upgradeable-state:
  131. needs: setup-anchor-cli
  132. name: Test tests/bpf-upgradeable-state
  133. runs-on: ubuntu-latest
  134. timeout-minutes: 30
  135. steps:
  136. - uses: actions/checkout@v3
  137. - uses: ./.github/actions/setup/
  138. - uses: ./.github/actions/setup-ts/
  139. - uses: ./.github/actions/setup-solana/
  140. - uses: actions/download-artifact@v3
  141. with:
  142. name: anchor-binary-no-caching
  143. path: ~/.cargo/bin/
  144. - run: chmod +x ~/.cargo/bin/anchor
  145. - run: solana-test-validator -r --quiet &
  146. name: start validator
  147. - run: cd tests/bpf-upgradeable-state && yarn --frozen-lockfile
  148. - run: cd tests/bpf-upgradeable-state
  149. - run: cd tests/bpf-upgradeable-state && anchor build --skip-lint
  150. - run: cd tests/bpf-upgradeable-state && solana program deploy --program-id program_with_different_programdata.json target/deploy/bpf_upgradeable_state.so
  151. - run: cd tests/bpf-upgradeable-state && cp bpf_upgradeable_state-keypair.json target/deploy/bpf_upgradeable_state-keypair.json && anchor test --skip-local-validator --skip-build --skip-lint
  152. - run: cd tests/bpf-upgradeable-state && npx tsc --noEmit
  153. - uses: ./.github/actions/git-diff/
  154. # # this test exists to make sure that anchor
  155. # # checks rent correctly for legacy accounts
  156. # # that don't have to be rent-exempt
  157. # test-misc-non-rent-exempt:
  158. # # the anchor cli is built with a different solana version
  159. # # but that's fine since it's just the cli
  160. # needs: setup-anchor-cli
  161. # name: Test tests/misc/nonRentExempt
  162. # runs-on: ubuntu-latest
  163. # timeout-minutes: 30
  164. # steps:
  165. # - uses: actions/checkout@v3
  166. # - uses: ./.github/actions/setup/
  167. # - uses: ./.github/actions/setup-ts/
  168. # # using an outdated validator but that
  169. # # is ok as long as the test doesn't
  170. # # include newer incompatible features
  171. # - run: sh -c "$(curl -sSfL https://release.solana.com/v1.8.14/install)"
  172. # shell: bash
  173. # - run: echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
  174. # shell: bash
  175. # - run: solana-keygen new --no-bip39-passphrase
  176. # shell: bash
  177. # - run: solana config set --url localhost
  178. # shell: bash
  179. # - uses: actions/download-artifact@v3
  180. # with:
  181. # name: anchor-binary-no-caching
  182. # path: ~/.cargo/bin/
  183. # - run: chmod +x ~/.cargo/bin/anchor
  184. # - run: cd tests/misc && yarn --frozen-lockfile
  185. # - run: cd tests/misc
  186. # - run: cd tests/misc && chmod +x ci.sh && ./ci.sh
  187. # - run: cd tests/misc && anchor test --skip-lint
  188. test-anchor-init:
  189. needs: setup-anchor-cli
  190. name: Test Anchor Init
  191. runs-on: ubuntu-latest
  192. timeout-minutes: 30
  193. steps:
  194. - uses: actions/checkout@v3
  195. - uses: ./.github/actions/setup/
  196. - uses: ./.github/actions/setup-ts/
  197. - uses: ./.github/actions/setup-solana/
  198. - uses: actions/download-artifact@v3
  199. with:
  200. name: anchor-binary-no-caching
  201. path: ~/.cargo/bin/
  202. - run: chmod +x ~/.cargo/bin/anchor
  203. - run: cd "$(mktemp -d)" && anchor init hello-anchor && cd hello-anchor && yarn link @project-serum/anchor && yarn && anchor test && yarn lint:fix
  204. - uses: ./.github/actions/git-diff/
  205. test-programs:
  206. needs: setup-anchor-cli
  207. name: Test ${{ matrix.node.path }}
  208. runs-on: ubuntu-latest
  209. timeout-minutes: 30
  210. strategy:
  211. fail-fast: false
  212. matrix:
  213. node:
  214. - cmd: cd tests/sysvars && anchor test --skip-lint
  215. path: tests/sysvars
  216. - cmd: cd tests/composite && anchor test --skip-lint
  217. path: tests/composite
  218. - cmd: cd tests/errors && anchor test --skip-lint && npx tsc --noEmit
  219. path: tests/errors
  220. - cmd: cd tests/spl/token-proxy && anchor test --skip-lint
  221. path: spl/token-proxy
  222. - cmd: cd tests/multisig && anchor test --skip-lint
  223. path: tests/multisig
  224. - cmd: cd tests/interface && anchor test --skip-lint
  225. path: tests/interface
  226. - cmd: cd tests/lockup && anchor test --skip-lint
  227. path: tests/lockup
  228. - cmd: cd tests/swap/deps/serum-dex/dex && cargo build-bpf -- --locked && cd ../../../ && anchor test --skip-lint
  229. path: tests/swap
  230. - cmd: cd tests/escrow && anchor test --skip-lint && npx tsc --noEmit
  231. path: tests/escrow
  232. - cmd: cd tests/pyth && anchor test --skip-lint && npx tsc --noEmit
  233. path: tests/pyth
  234. - cmd: cd tests/system-accounts && anchor test --skip-lint
  235. path: tests/system-accounts
  236. - cmd: cd tests/misc && anchor test --skip-lint && npx tsc --noEmit
  237. path: tests/misc
  238. - cmd: cd tests/events && anchor test --skip-lint
  239. path: tests/events
  240. - cmd: cd tests/cashiers-check && anchor test --skip-lint
  241. path: tests/cashiers-check
  242. - cmd: cd tests/declare-id && anchor test --skip-lint && npx tsc --noEmit
  243. path: tests/declare-id
  244. - cmd: cd tests/typescript && anchor test --skip-lint && npx tsc --noEmit
  245. path: tests/typescript
  246. - cmd: cd tests/zero-copy && anchor test --skip-lint && cd programs/zero-copy && cargo test-bpf
  247. path: tests/zero-copy
  248. - cmd: cd tests/chat && anchor test --skip-lint
  249. path: tests/chat
  250. - cmd: cd tests/ido-pool && anchor test --skip-lint
  251. path: tests/ido-pool
  252. - cmd: cd tests/cfo && anchor run test-with-build && cd deps/stake && git checkout Cargo.lock && cd ../swap && git checkout Cargo.lock
  253. path: tests/cfo
  254. - cmd: cd tests/auction-house && yarn --frozen-lockfile && anchor test --skip-lint && git checkout Cargo.lock
  255. path: tests/auction-house
  256. - cmd: cd tests/floats && yarn --frozen-lockfile && anchor test --skip-lint && npx tsc --noEmit
  257. path: tests/floats
  258. - cmd: cd tests/safety-checks && anchor run test
  259. path: tests/safety-checks
  260. - cmd: cd tests/custom-coder && anchor test --skip-lint && npx tsc --noEmit
  261. path: tests/custom-coder
  262. - cmd: cd tests/validator-clone && anchor test --skip-lint && npx tsc --noEmit
  263. path: tests/validator-clone
  264. - cmd: cd tests/cpi-returns && anchor test --skip-lint && npx tsc --noEmit
  265. path: tests/cpi-returns
  266. - cmd: cd tests/multiple-suites && anchor test --skip-lint && npx tsc --noEmit
  267. path: tests/multiple-suites
  268. - cmd: cd tests/pda-derivation && anchor test --skip-lint && npx tsc --noEmit
  269. path: tests/pda-derivation
  270. - cmd: cd tests/relations-derivation && anchor test --skip-lint && npx tsc --noEmit
  271. path: tests/relations-derivation
  272. - cmd: cd tests/anchor-cli-idl && ./test.sh
  273. path: tests/anchor-cli-idl
  274. steps:
  275. - uses: actions/checkout@v3
  276. - uses: ./.github/actions/setup/
  277. - uses: ./.github/actions/setup-ts/
  278. - uses: ./.github/actions/setup-solana/
  279. - uses: actions/download-artifact@v3
  280. with:
  281. name: anchor-binary-no-caching
  282. path: ~/.cargo/bin/
  283. - run: chmod +x ~/.cargo/bin/anchor
  284. - run: ${{ matrix.node.cmd }}
  285. name: ${{ matrix.node.path }} program test
  286. - uses: ./.github/actions/git-diff/