main.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. name: Main
  2. on:
  3. push:
  4. branches: [main]
  5. pull_request:
  6. branches: [main]
  7. jobs:
  8. format_and_lint_client_js:
  9. name: Format & Lint Client JS
  10. runs-on: ubuntu-latest
  11. steps:
  12. - name: Git Checkout
  13. uses: actions/checkout@v4
  14. - name: Setup Environment
  15. uses: ./.github/actions/setup
  16. - name: Format Client JS
  17. run: pnpm clients:js:format
  18. - name: Lint Client JS
  19. run: pnpm clients:js:lint
  20. format_and_lint_client_rust:
  21. if: false # Disabled until we have a Rust client
  22. name: Format & Lint Client Rust
  23. runs-on: ubuntu-latest
  24. steps:
  25. - name: Git Checkout
  26. uses: actions/checkout@v4
  27. - name: Setup Environment
  28. uses: ./.github/actions/setup
  29. with:
  30. clippy: true
  31. rustfmt: true
  32. - name: Format Client Rust
  33. run: pnpm clients:rust:format
  34. - name: Lint Client Rust
  35. run: pnpm clients:rust:lint
  36. format_and_lint_program:
  37. name: Format & Lint Program
  38. runs-on: ubuntu-latest
  39. steps:
  40. - name: Git Checkout
  41. uses: actions/checkout@v4
  42. - name: Setup Environment
  43. uses: ./.github/actions/setup
  44. with:
  45. clippy: true
  46. rustfmt: true
  47. - name: Format
  48. run: pnpm programs:format
  49. - name: Lint
  50. run: pnpm programs:lint
  51. audit_rust:
  52. name: Audit Rust
  53. runs-on: ubuntu-latest
  54. steps:
  55. - name: Git Checkout
  56. uses: actions/checkout@v4
  57. - name: Setup Environment
  58. uses: ./.github/actions/setup
  59. with:
  60. cargo-cache-key: cargo-audit
  61. - name: Install cargo-audit
  62. uses: taiki-e/install-action@v2
  63. with:
  64. tool: cargo-audit
  65. - name: Run cargo-audit
  66. run: pnpm rust:audit
  67. semver_rust:
  68. name: Check semver Rust
  69. runs-on: ubuntu-latest
  70. steps:
  71. - name: Git Checkout
  72. uses: actions/checkout@v4
  73. - name: Setup Environment
  74. uses: ./.github/actions/setup
  75. with:
  76. cargo-cache-key: cargo-semver
  77. - name: Install cargo-audit
  78. uses: taiki-e/install-action@v2
  79. with:
  80. tool: cargo-semver-checks
  81. - name: Run semver checks
  82. run: pnpm rust:semver
  83. spellcheck_rust:
  84. name: Spellcheck Rust
  85. runs-on: ubuntu-latest
  86. steps:
  87. - name: Git Checkout
  88. uses: actions/checkout@v4
  89. - name: Setup Environment
  90. uses: ./.github/actions/setup
  91. with:
  92. cargo-cache-key: cargo-spellcheck
  93. - name: Install cargo-spellcheck
  94. uses: taiki-e/install-action@v2
  95. with:
  96. tool: cargo-spellcheck
  97. - name: Run cargo-spellcheck
  98. run: pnpm rust:spellcheck
  99. generate_clients:
  100. name: Check Client Generation
  101. runs-on: ubuntu-latest
  102. steps:
  103. - name: Git Checkout
  104. uses: actions/checkout@v4
  105. - name: Setup Environment
  106. uses: ./.github/actions/setup
  107. with:
  108. rustfmt: true
  109. - name: Generate Clients
  110. run: pnpm generate:clients
  111. - name: Check Working Directory
  112. run: |
  113. git status --porcelain
  114. test -z "$(git status --porcelain)"
  115. build_program:
  116. name: Build Program
  117. runs-on: ubuntu-latest
  118. needs: format_and_lint_program
  119. steps:
  120. - name: Git Checkout
  121. uses: actions/checkout@v4
  122. - name: Setup Environment
  123. uses: ./.github/actions/setup
  124. with:
  125. cargo-cache-key: cargo-build-program
  126. solana: true
  127. - name: Build
  128. run: pnpm programs:build
  129. - name: Upload Program Builds
  130. uses: actions/upload-artifact@v4
  131. with:
  132. name: program-builds
  133. path: ./target/deploy/*.so
  134. if-no-files-found: error
  135. - name: Save Program Builds For Client Jobs
  136. uses: actions/cache/save@v4
  137. with:
  138. path: ./**/*.so
  139. key: ${{ runner.os }}-builds-${{ github.sha }}
  140. test_client_js:
  141. name: Test Client JS
  142. runs-on: ubuntu-latest
  143. needs: [format_and_lint_client_js, build_program]
  144. steps:
  145. - name: Git Checkout
  146. uses: actions/checkout@v4
  147. - name: Setup Environment
  148. uses: ./.github/actions/setup
  149. with:
  150. solana: true
  151. - name: Restore Program Builds
  152. uses: actions/cache/restore@v4
  153. with:
  154. path: ./**/*.so
  155. key: ${{ runner.os }}-builds-${{ github.sha }}
  156. - name: Test Client JS
  157. run: pnpm clients:js:test
  158. test_client_rust:
  159. if: false # Disabled until we have a Rust client
  160. name: Test Client Rust
  161. runs-on: ubuntu-latest
  162. needs: format_and_lint_client_rust
  163. steps:
  164. - name: Git Checkout
  165. uses: actions/checkout@v4
  166. - name: Setup Environment
  167. uses: ./.github/actions/setup
  168. with:
  169. cargo-cache-key: cargo-rust-client
  170. solana: true
  171. - name: Test Client Rust
  172. run: pnpm clients:rust:test
  173. test_program:
  174. name: Test Program
  175. runs-on: ubuntu-latest
  176. needs: format_and_lint_program
  177. steps:
  178. - name: Git Checkout
  179. uses: actions/checkout@v4
  180. - name: Setup Environment
  181. uses: ./.github/actions/setup
  182. with:
  183. cargo-cache-key: cargo-test-program
  184. solana: true
  185. - name: Test
  186. run: pnpm programs:test