main.yml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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. test_client_js:
  124. name: Test Client JS
  125. runs-on: ubuntu-latest
  126. needs: [format_and_lint_client_js, build_program]
  127. steps:
  128. - name: Git Checkout
  129. uses: actions/checkout@v4
  130. - name: Setup Environment
  131. uses: ./.github/actions/setup
  132. with:
  133. solana: true
  134. - name: Restore Program Builds
  135. uses: actions/cache/restore@v4
  136. with:
  137. path: ./**/*.so
  138. key: ${{ runner.os }}-builds-${{ github.sha }}
  139. - name: Test Client JS
  140. run: pnpm clients:js:test
  141. test_client_rust:
  142. if: false # Disabled until we have a Rust client
  143. name: Test Client Rust
  144. runs-on: ubuntu-latest
  145. needs: format_and_lint_client_rust
  146. steps:
  147. - name: Git Checkout
  148. uses: actions/checkout@v4
  149. - name: Setup Environment
  150. uses: ./.github/actions/setup
  151. with:
  152. cargo-cache-key: cargo-rust-client
  153. solana: true
  154. - name: Test Client Rust
  155. run: pnpm clients:rust:test
  156. test_program:
  157. name: Test Program
  158. runs-on: ubuntu-latest
  159. needs: build_program
  160. steps:
  161. - name: Git Checkout
  162. uses: actions/checkout@v4
  163. - name: Setup Environment
  164. uses: ./.github/actions/setup
  165. with:
  166. cargo-cache-key: cargo-test-program
  167. - name: Restore Program Builds
  168. uses: actions/cache/restore@v4
  169. with:
  170. path: ./**/*.so
  171. key: ${{ runner.os }}-builds-${{ github.sha }}
  172. - name: Test
  173. run: pnpm programs:test