main.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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. semver_rust:
  67. name: Check semver 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-semver
  76. - name: Install cargo-audit
  77. uses: taiki-e/install-action@v2
  78. with:
  79. tool: cargo-semver-checks
  80. - name: Run semver checks
  81. run: pnpm rust:semver
  82. spellcheck_rust:
  83. name: Spellcheck Rust
  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. cargo-cache-key: cargo-spellcheck
  92. - name: Install cargo-spellcheck
  93. uses: taiki-e/install-action@v2
  94. with:
  95. tool: cargo-spellcheck
  96. - name: Run cargo-spellcheck
  97. run: pnpm rust:spellcheck
  98. generate_clients:
  99. name: Check Client Generation
  100. runs-on: ubuntu-latest
  101. steps:
  102. - name: Git Checkout
  103. uses: actions/checkout@v4
  104. - name: Setup Environment
  105. uses: ./.github/actions/setup
  106. with:
  107. rustfmt: true
  108. - name: Generate Clients
  109. run: pnpm generate:clients
  110. - name: Check Working Directory
  111. run: |
  112. git status --porcelain
  113. test -z "$(git status --porcelain)"
  114. build_program:
  115. name: Build Program
  116. runs-on: ubuntu-latest
  117. needs: format_and_lint_program
  118. steps:
  119. - name: Git Checkout
  120. uses: actions/checkout@v4
  121. - name: Setup Environment
  122. uses: ./.github/actions/setup
  123. with:
  124. cargo-cache-key: cargo-build-program
  125. solana: true
  126. - name: Build
  127. run: pnpm programs:build
  128. - name: Upload Program Builds
  129. uses: actions/upload-artifact@v4
  130. with:
  131. name: program-builds
  132. path: ./target/deploy/*.so
  133. if-no-files-found: error
  134. - name: Save Program Builds For Client Jobs
  135. uses: actions/cache/save@v4
  136. with:
  137. path: ./**/*.so
  138. key: ${{ runner.os }}-builds-${{ github.sha }}
  139. test_client_js:
  140. name: Test Client JS
  141. runs-on: ubuntu-latest
  142. needs: [format_and_lint_client_js, build_program]
  143. steps:
  144. - name: Git Checkout
  145. uses: actions/checkout@v4
  146. - name: Setup Environment
  147. uses: ./.github/actions/setup
  148. with:
  149. solana: true
  150. - name: Restore Program Builds
  151. uses: actions/cache/restore@v4
  152. with:
  153. path: ./**/*.so
  154. key: ${{ runner.os }}-builds-${{ github.sha }}
  155. - name: Test Client JS
  156. run: pnpm clients:js:test
  157. test_client_rust:
  158. if: false # Disabled until we have a Rust client
  159. name: Test Client Rust
  160. runs-on: ubuntu-latest
  161. needs: format_and_lint_client_rust
  162. steps:
  163. - name: Git Checkout
  164. uses: actions/checkout@v4
  165. - name: Setup Environment
  166. uses: ./.github/actions/setup
  167. with:
  168. cargo-cache-key: cargo-rust-client
  169. solana: true
  170. - name: Test Client Rust
  171. run: pnpm clients:rust:test
  172. test_program:
  173. name: Test Program
  174. runs-on: ubuntu-latest
  175. needs: format_and_lint_program
  176. steps:
  177. - name: Git Checkout
  178. uses: actions/checkout@v4
  179. - name: Setup Environment
  180. uses: ./.github/actions/setup
  181. with:
  182. cargo-cache-key: cargo-test-program
  183. solana: true
  184. - name: Test
  185. run: pnpm programs:test