main.yml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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. audit_rust:
  51. name: Audit Rust
  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. cargo-cache-key: cargo-audit
  60. - name: Install cargo-audit
  61. uses: taiki-e/install-action@v2
  62. with:
  63. tool: cargo-audit
  64. - name: Run cargo-audit
  65. run: pnpm rust:audit
  66. spellcheck_rust:
  67. name: Spellcheck Rust
  68. runs-on: ubuntu-latest
  69. steps:
  70. - name: Git Checkout
  71. uses: actions/checkout@v4
  72. - name: Setup Environment
  73. uses: ./.github/actions/setup
  74. with:
  75. cargo-cache-key: cargo-spellcheck
  76. - name: Install cargo-spellcheck
  77. uses: taiki-e/install-action@v2
  78. with:
  79. tool: cargo-spellcheck
  80. - name: Run cargo-spellcheck
  81. run: pnpm rust:spellcheck
  82. generate_clients:
  83. name: Check Client Generation
  84. runs-on: ubuntu-latest
  85. steps:
  86. - name: Git Checkout
  87. uses: actions/checkout@v4
  88. - name: Setup Environment
  89. uses: ./.github/actions/setup
  90. with:
  91. rustfmt: true
  92. - name: Generate Clients
  93. run: pnpm generate:clients
  94. - name: Check Working Directory
  95. run: |
  96. git status --porcelain
  97. test -z "$(git status --porcelain)"
  98. build_program:
  99. name: Build Program
  100. runs-on: ubuntu-latest
  101. needs: format_and_lint_program
  102. steps:
  103. - name: Git Checkout
  104. uses: actions/checkout@v4
  105. - name: Setup Environment
  106. uses: ./.github/actions/setup
  107. with:
  108. cargo-cache-key: cargo-build-program
  109. solana: true
  110. - name: Build
  111. run: pnpm programs:build
  112. - name: Upload Program Builds
  113. uses: actions/upload-artifact@v4
  114. with:
  115. name: program-builds
  116. path: ./target/deploy/*.so
  117. if-no-files-found: error
  118. - name: Save Program Builds For Client Jobs
  119. uses: actions/cache/save@v4
  120. with:
  121. path: ./**/*.so
  122. key: ${{ runner.os }}-builds-${{ github.sha }}
  123. build_ptoken:
  124. name: Build p-token
  125. runs-on: ubuntu-latest
  126. steps:
  127. - name: Git Checkout
  128. uses: actions/checkout@v4
  129. - name: Setup Environment
  130. uses: ./.github/actions/setup
  131. with:
  132. cargo-cache-key: cargo-build-program
  133. solana: true
  134. - name: Build
  135. run: pnpm p-token:build
  136. - name: Upload p-token Builds
  137. uses: actions/upload-artifact@v4
  138. with:
  139. name: p-token-builds
  140. path: ./target/deploy/*.so
  141. if-no-files-found: error
  142. - name: Save p-token Build For Client Jobs
  143. uses: actions/cache/save@v4
  144. with:
  145. path: ./**/*.so
  146. key: ${{ runner.os }}-ptoken-build-${{ github.sha }}
  147. test_client_js:
  148. name: Test Client JS
  149. runs-on: ubuntu-latest
  150. needs: [format_and_lint_client_js, build_program]
  151. steps:
  152. - name: Git Checkout
  153. uses: actions/checkout@v4
  154. - name: Setup Environment
  155. uses: ./.github/actions/setup
  156. with:
  157. solana: true
  158. - name: Restore Program Builds
  159. uses: actions/cache/restore@v4
  160. with:
  161. path: ./**/*.so
  162. key: ${{ runner.os }}-builds-${{ github.sha }}
  163. - name: Test Client JS
  164. run: pnpm clients:js:test
  165. test_client_rust:
  166. if: false # Disabled until we have a Rust client
  167. name: Test Client Rust
  168. runs-on: ubuntu-latest
  169. needs: format_and_lint_client_rust
  170. steps:
  171. - name: Git Checkout
  172. uses: actions/checkout@v4
  173. - name: Setup Environment
  174. uses: ./.github/actions/setup
  175. with:
  176. cargo-cache-key: cargo-rust-client
  177. solana: true
  178. - name: Test Client Rust
  179. run: pnpm clients:rust:test
  180. test_program:
  181. name: Test Program
  182. runs-on: ubuntu-latest
  183. needs: build_program
  184. steps:
  185. - name: Git Checkout
  186. uses: actions/checkout@v4
  187. - name: Setup Environment
  188. uses: ./.github/actions/setup
  189. with:
  190. cargo-cache-key: cargo-test-program
  191. - name: Restore Program Builds
  192. uses: actions/cache/restore@v4
  193. with:
  194. path: ./**/*.so
  195. key: ${{ runner.os }}-builds-${{ github.sha }}
  196. - name: Test
  197. run: pnpm programs:test
  198. conformance_ptoken:
  199. name: Conformance Test for p-token
  200. runs-on: ubuntu-latest
  201. needs: build_ptoken
  202. steps:
  203. - name: Git Checkout
  204. uses: actions/checkout@v4
  205. - name: Setup Environment
  206. uses: ./.github/actions/setup
  207. with:
  208. cargo-cache-key: cargo-fixtures-ptoken
  209. solana: true
  210. - name: Restore Program Builds
  211. uses: actions/cache/restore@v4
  212. with:
  213. path: ./**/*.so
  214. key: ${{ runner.os }}-ptoken-build-${{ github.sha }}
  215. - name: Install mollusk-svm-cli
  216. uses: taiki-e/cache-cargo-install-action@v2
  217. with:
  218. tool: mollusk-svm-cli
  219. - name: Generate SPL Token Fixtures
  220. run: pnpm fixtures:generate
  221. - name: Run Fixtures
  222. run: pnpm fixtures:run pinocchio_token_program