no-cashing-tests.yaml 11 KB

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