main.yml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. name: Main
  2. on:
  3. push:
  4. branches: [main]
  5. pull_request:
  6. jobs:
  7. format_and_lint_client_js:
  8. name: Format & Lint Client JS
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: Git Checkout
  12. uses: actions/checkout@v4
  13. - name: Setup Environment
  14. uses: ./.github/actions/setup
  15. - name: Format Client JS
  16. run: pnpm clients:js:format
  17. - name: Lint Client JS
  18. run: pnpm clients:js:lint
  19. format_and_lint_client_rust:
  20. if: false # Disabled until we have a Rust client
  21. name: Format & Lint Client Rust
  22. runs-on: ubuntu-latest
  23. steps:
  24. - name: Git Checkout
  25. uses: actions/checkout@v4
  26. - name: Setup Environment
  27. uses: ./.github/actions/setup
  28. with:
  29. clippy: true
  30. rustfmt: true
  31. - name: Format Client Rust
  32. run: pnpm clients:rust:format
  33. - name: Lint Client Rust
  34. run: pnpm clients:rust:lint
  35. format_and_lint_program:
  36. name: Format & Lint Program
  37. runs-on: ubuntu-latest
  38. steps:
  39. - name: Git Checkout
  40. uses: actions/checkout@v4
  41. - name: Setup Environment
  42. uses: ./.github/actions/setup
  43. with:
  44. clippy: true
  45. rustfmt: true
  46. - name: Format
  47. run: pnpm programs:format
  48. - name: Lint
  49. run: pnpm programs:lint
  50. format_and_lint_pinterface:
  51. name: Format & Lint P-Interface
  52. runs-on: ubuntu-latest
  53. steps:
  54. - name: Git Checkout
  55. uses: actions/checkout@v4
  56. - name: Setup Environment
  57. uses: ./.github/actions/setup
  58. with:
  59. clippy: true
  60. rustfmt: true
  61. - name: Format
  62. run: pnpm p-interface:format
  63. - name: Lint
  64. run: pnpm p-interface:lint
  65. format_and_lint_ptoken:
  66. name: Format & Lint p-token
  67. runs-on: ubuntu-latest
  68. steps:
  69. - name: Git Checkout
  70. uses: actions/checkout@v4
  71. - name: Setup Environment
  72. uses: ./.github/actions/setup
  73. with:
  74. clippy: true
  75. rustfmt: true
  76. - name: Format
  77. run: pnpm p-token:format
  78. - name: Lint
  79. run: pnpm p-token:lint
  80. format_and_lint_interface:
  81. name: Format, Lint & Test Interface
  82. runs-on: ubuntu-latest
  83. steps:
  84. - name: Git Checkout
  85. uses: actions/checkout@v4
  86. - name: Setup Environment
  87. uses: ./.github/actions/setup
  88. with:
  89. clippy: true
  90. rustfmt: true
  91. - name: Format
  92. run: pnpm interface:format
  93. - name: Lint
  94. run: pnpm interface:lint
  95. - name: Lint
  96. run: pnpm interface:test
  97. audit_rust:
  98. name: Audit Rust
  99. runs-on: ubuntu-latest
  100. steps:
  101. - name: Git Checkout
  102. uses: actions/checkout@v4
  103. - name: Setup Environment
  104. uses: ./.github/actions/setup
  105. with:
  106. cargo-cache-key: cargo-audit
  107. - name: Install cargo-audit
  108. uses: taiki-e/install-action@v2
  109. with:
  110. tool: cargo-audit
  111. - name: Run cargo-audit
  112. run: pnpm rust:audit
  113. spellcheck_rust:
  114. name: Spellcheck Rust
  115. runs-on: ubuntu-latest
  116. steps:
  117. - name: Git Checkout
  118. uses: actions/checkout@v4
  119. - name: Setup Environment
  120. uses: ./.github/actions/setup
  121. with:
  122. cargo-cache-key: cargo-spellcheck
  123. - name: Install cargo-spellcheck
  124. uses: taiki-e/install-action@v2
  125. with:
  126. tool: cargo-spellcheck
  127. - name: Run cargo-spellcheck
  128. run: pnpm rust:spellcheck
  129. generate_clients:
  130. name: Check Client Generation
  131. runs-on: ubuntu-latest
  132. steps:
  133. - name: Git Checkout
  134. uses: actions/checkout@v4
  135. - name: Setup Environment
  136. uses: ./.github/actions/setup
  137. with:
  138. rustfmt: true
  139. - name: Generate Clients
  140. run: pnpm generate:clients
  141. - name: Check Working Directory
  142. run: |
  143. git status --porcelain
  144. test -z "$(git status --porcelain)"
  145. build_program:
  146. name: Build Program
  147. runs-on: ubuntu-latest
  148. needs: format_and_lint_program
  149. steps:
  150. - name: Git Checkout
  151. uses: actions/checkout@v4
  152. - name: Setup Environment
  153. uses: ./.github/actions/setup
  154. with:
  155. cargo-cache-key: cargo-build-program
  156. solana: true
  157. - name: Build
  158. run: pnpm programs:build
  159. - name: Upload Program Builds
  160. uses: actions/upload-artifact@v4
  161. with:
  162. name: program-builds
  163. path: ./target/deploy/*.so
  164. if-no-files-found: error
  165. - name: Save Program Builds For Client Jobs
  166. uses: actions/cache/save@v4
  167. with:
  168. path: ./**/*.so
  169. key: ${{ runner.os }}-builds-${{ github.sha }}
  170. build_ptoken:
  171. name: Build p-token
  172. runs-on: ubuntu-latest
  173. needs: [format_and_lint_pinterface, format_and_lint_ptoken]
  174. steps:
  175. - name: Git Checkout
  176. uses: actions/checkout@v4
  177. - name: Setup Environment
  178. uses: ./.github/actions/setup
  179. with:
  180. cargo-cache-key: cargo-build-program
  181. solana: true
  182. - name: Build
  183. run: pnpm p-token:build
  184. - name: Upload p-token Builds
  185. uses: actions/upload-artifact@v4
  186. with:
  187. name: p-token-builds
  188. path: ./target/deploy/*.so
  189. if-no-files-found: error
  190. - name: Save p-token Build For Client Jobs
  191. uses: actions/cache/save@v4
  192. with:
  193. path: ./**/*.so
  194. key: ${{ runner.os }}-ptoken-build-${{ github.sha }}
  195. test_client_js:
  196. name: Test Client JS
  197. runs-on: ubuntu-latest
  198. needs: [format_and_lint_client_js, build_program]
  199. steps:
  200. - name: Git Checkout
  201. uses: actions/checkout@v4
  202. - name: Setup Environment
  203. uses: ./.github/actions/setup
  204. with:
  205. solana: true
  206. - name: Restore Program Builds
  207. uses: actions/cache/restore@v4
  208. with:
  209. path: ./**/*.so
  210. key: ${{ runner.os }}-builds-${{ github.sha }}
  211. - name: Test Client JS
  212. run: pnpm clients:js:test
  213. test_client_rust:
  214. if: false # Disabled until we have a Rust client
  215. name: Test Client Rust
  216. runs-on: ubuntu-latest
  217. needs: format_and_lint_client_rust
  218. steps:
  219. - name: Git Checkout
  220. uses: actions/checkout@v4
  221. - name: Setup Environment
  222. uses: ./.github/actions/setup
  223. with:
  224. cargo-cache-key: cargo-rust-client
  225. solana: true
  226. - name: Test Client Rust
  227. run: pnpm clients:rust:test
  228. test_program:
  229. name: Test Program
  230. runs-on: ubuntu-latest
  231. needs: build_program
  232. steps:
  233. - name: Git Checkout
  234. uses: actions/checkout@v4
  235. - name: Setup Environment
  236. uses: ./.github/actions/setup
  237. with:
  238. cargo-cache-key: cargo-test-program
  239. - name: Restore Program Builds
  240. uses: actions/cache/restore@v4
  241. with:
  242. path: ./**/*.so
  243. key: ${{ runner.os }}-builds-${{ github.sha }}
  244. - name: Test
  245. run: pnpm programs:test
  246. test_ptoken:
  247. name: Test p-token
  248. runs-on: ubuntu-latest
  249. needs: build_ptoken
  250. steps:
  251. - name: Git Checkout
  252. uses: actions/checkout@v4
  253. - name: Setup Environment
  254. uses: ./.github/actions/setup
  255. with:
  256. cargo-cache-key: cargo-test-ptoken
  257. solana: true
  258. purge: true
  259. - name: Restore Program Builds
  260. uses: actions/cache/restore@v4
  261. with:
  262. path: ./**/*.so
  263. key: ${{ runner.os }}-ptoken-build-${{ github.sha }}
  264. - name: Test
  265. run: pnpm p-token:test
  266. conformance_ptoken:
  267. name: Conformance Test for p-token
  268. runs-on: ubuntu-latest
  269. needs: build_ptoken
  270. steps:
  271. - name: Git Checkout
  272. uses: actions/checkout@v4
  273. - name: Setup Environment
  274. uses: ./.github/actions/setup
  275. with:
  276. cargo-cache-key: cargo-fixtures-ptoken
  277. solana: true
  278. - name: Restore Program Builds
  279. uses: actions/cache/restore@v4
  280. with:
  281. path: ./**/*.so
  282. key: ${{ runner.os }}-ptoken-build-${{ github.sha }}
  283. - name: Install mollusk-svm-cli
  284. uses: taiki-e/cache-cargo-install-action@v2
  285. with:
  286. tool: mollusk-svm-cli
  287. - name: Generate SPL Token Fixtures
  288. run: pnpm fixtures:generate
  289. - name: Run Fixtures
  290. run: pnpm fixtures:run pinocchio_token_program