no-cashing-tests.yaml 12 KB

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