no-cashing-tests.yaml 11 KB

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