no-cashing-tests.yaml 12 KB

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