main.yml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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_interface:
  51. name: Format & Lint 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 interface:format
  63. - name: Lint
  64. run: pnpm 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. audit_rust:
  81. name: Audit Rust
  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. cargo-cache-key: cargo-audit
  90. - name: Install cargo-audit
  91. uses: taiki-e/install-action@v2
  92. with:
  93. tool: cargo-audit
  94. - name: Run cargo-audit
  95. run: pnpm rust:audit
  96. spellcheck_rust:
  97. name: Spellcheck Rust
  98. runs-on: ubuntu-latest
  99. steps:
  100. - name: Git Checkout
  101. uses: actions/checkout@v4
  102. - name: Setup Environment
  103. uses: ./.github/actions/setup
  104. with:
  105. cargo-cache-key: cargo-spellcheck
  106. - name: Install cargo-spellcheck
  107. uses: taiki-e/install-action@v2
  108. with:
  109. tool: cargo-spellcheck
  110. - name: Run cargo-spellcheck
  111. run: pnpm rust:spellcheck
  112. generate_clients:
  113. name: Check Client Generation
  114. runs-on: ubuntu-latest
  115. steps:
  116. - name: Git Checkout
  117. uses: actions/checkout@v4
  118. - name: Setup Environment
  119. uses: ./.github/actions/setup
  120. with:
  121. rustfmt: true
  122. - name: Generate Clients
  123. run: pnpm generate:clients
  124. - name: Check Working Directory
  125. run: |
  126. git status --porcelain
  127. test -z "$(git status --porcelain)"
  128. build_program:
  129. name: Build Program
  130. runs-on: ubuntu-latest
  131. needs: format_and_lint_program
  132. steps:
  133. - name: Git Checkout
  134. uses: actions/checkout@v4
  135. - name: Setup Environment
  136. uses: ./.github/actions/setup
  137. with:
  138. cargo-cache-key: cargo-build-program
  139. solana: true
  140. - name: Build
  141. run: pnpm programs:build
  142. - name: Upload Program Builds
  143. uses: actions/upload-artifact@v4
  144. with:
  145. name: program-builds
  146. path: ./target/deploy/*.so
  147. if-no-files-found: error
  148. - name: Save Program Builds For Client Jobs
  149. uses: actions/cache/save@v4
  150. with:
  151. path: ./**/*.so
  152. key: ${{ runner.os }}-builds-${{ github.sha }}
  153. build_ptoken:
  154. name: Build p-token
  155. runs-on: ubuntu-latest
  156. needs: [format_and_lint_interface, format_and_lint_ptoken]
  157. steps:
  158. - name: Git Checkout
  159. uses: actions/checkout@v4
  160. - name: Setup Environment
  161. uses: ./.github/actions/setup
  162. with:
  163. cargo-cache-key: cargo-build-program
  164. solana: true
  165. - name: Build
  166. run: pnpm p-token:build
  167. - name: Upload p-token Builds
  168. uses: actions/upload-artifact@v4
  169. with:
  170. name: p-token-builds
  171. path: ./target/deploy/*.so
  172. if-no-files-found: error
  173. - name: Save p-token Build For Client Jobs
  174. uses: actions/cache/save@v4
  175. with:
  176. path: ./**/*.so
  177. key: ${{ runner.os }}-ptoken-build-${{ github.sha }}
  178. test_client_js:
  179. name: Test Client JS
  180. runs-on: ubuntu-latest
  181. needs: [format_and_lint_client_js, build_program]
  182. steps:
  183. - name: Git Checkout
  184. uses: actions/checkout@v4
  185. - name: Setup Environment
  186. uses: ./.github/actions/setup
  187. with:
  188. solana: true
  189. - name: Restore Program Builds
  190. uses: actions/cache/restore@v4
  191. with:
  192. path: ./**/*.so
  193. key: ${{ runner.os }}-builds-${{ github.sha }}
  194. - name: Test Client JS
  195. run: pnpm clients:js:test
  196. test_client_rust:
  197. if: false # Disabled until we have a Rust client
  198. name: Test Client Rust
  199. runs-on: ubuntu-latest
  200. needs: format_and_lint_client_rust
  201. steps:
  202. - name: Git Checkout
  203. uses: actions/checkout@v4
  204. - name: Setup Environment
  205. uses: ./.github/actions/setup
  206. with:
  207. cargo-cache-key: cargo-rust-client
  208. solana: true
  209. - name: Test Client Rust
  210. run: pnpm clients:rust:test
  211. test_program:
  212. name: Test Program
  213. runs-on: ubuntu-latest
  214. needs: build_program
  215. steps:
  216. - name: Git Checkout
  217. uses: actions/checkout@v4
  218. - name: Setup Environment
  219. uses: ./.github/actions/setup
  220. with:
  221. cargo-cache-key: cargo-test-program
  222. - name: Restore Program Builds
  223. uses: actions/cache/restore@v4
  224. with:
  225. path: ./**/*.so
  226. key: ${{ runner.os }}-builds-${{ github.sha }}
  227. - name: Test
  228. run: pnpm programs:test
  229. test_ptoken:
  230. name: Test p-token
  231. runs-on: ubuntu-latest
  232. needs: build_ptoken
  233. steps:
  234. - name: Git Checkout
  235. uses: actions/checkout@v4
  236. - name: Setup Environment
  237. uses: ./.github/actions/setup
  238. with:
  239. cargo-cache-key: cargo-test-ptoken
  240. solana: true
  241. - name: Restore Program Builds
  242. uses: actions/cache/restore@v4
  243. with:
  244. path: ./**/*.so
  245. key: ${{ runner.os }}-ptoken-build-${{ github.sha }}
  246. - name: Test
  247. run: pnpm p-token:test
  248. conformance_ptoken:
  249. name: Conformance Test for p-token
  250. runs-on: ubuntu-latest
  251. needs: build_ptoken
  252. steps:
  253. - name: Git Checkout
  254. uses: actions/checkout@v4
  255. - name: Setup Environment
  256. uses: ./.github/actions/setup
  257. with:
  258. cargo-cache-key: cargo-fixtures-ptoken
  259. solana: true
  260. - name: Restore Program Builds
  261. uses: actions/cache/restore@v4
  262. with:
  263. path: ./**/*.so
  264. key: ${{ runner.os }}-ptoken-build-${{ github.sha }}
  265. - name: Install mollusk-svm-cli
  266. uses: taiki-e/cache-cargo-install-action@v2
  267. with:
  268. tool: mollusk-svm-cli
  269. - name: Generate SPL Token Fixtures
  270. run: pnpm fixtures:generate
  271. - name: Run Fixtures
  272. run: pnpm fixtures:run pinocchio_token_program