main.yml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. name: Main
  2. on:
  3. push:
  4. branches: [main]
  5. pull_request:
  6. branches: [main]
  7. jobs:
  8. format_and_lint_programs:
  9. name: Format & Lint Programs
  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. with:
  17. clippy: true
  18. rustfmt: true
  19. - name: Format Programs
  20. run: pnpm programs:format
  21. - name: Lint Programs
  22. run: pnpm programs:lint
  23. format_and_lint_client_js:
  24. name: Format & Lint Client JS
  25. runs-on: ubuntu-latest
  26. steps:
  27. - name: Git Checkout
  28. uses: actions/checkout@v4
  29. - name: Setup Environment
  30. uses: ./.github/actions/setup
  31. - name: Format Client JS
  32. run: pnpm clients:js:format
  33. - name: Lint Client JS
  34. run: pnpm clients:js:lint
  35. format_and_lint_client_rust:
  36. name: Format & Lint Client Rust
  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 Client Rust
  47. run: pnpm clients:rust:format
  48. - name: Lint Client Rust
  49. run: pnpm clients:rust:lint
  50. build_programs:
  51. name: Build programs
  52. runs-on: ubuntu-latest
  53. needs: format_and_lint_programs
  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-programs
  61. solana: true
  62. - name: Build Programs
  63. run: pnpm programs:build
  64. - name: Upload Program Builds
  65. uses: actions/upload-artifact@v4
  66. with:
  67. name: program-builds
  68. path: ./target/deploy/*.so
  69. if-no-files-found: error
  70. - name: Save Program Builds For Client Jobs
  71. uses: actions/cache/save@v4
  72. with:
  73. path: ./**/*.so
  74. key: ${{ runner.os }}-builds-${{ github.sha }}
  75. test_programs:
  76. name: Test Progams
  77. runs-on: ubuntu-latest
  78. needs: format_and_lint_programs
  79. steps:
  80. - name: Git Checkout
  81. uses: actions/checkout@v4
  82. - name: Setup Environment
  83. uses: ./.github/actions/setup
  84. with:
  85. cargo-cache-key: cargo-program-tests
  86. cargo-cache-fallback-key: cargo-programs
  87. solana: true
  88. - name: Test Programs
  89. run: pnpm programs:test
  90. generate_idls:
  91. name: Check IDL Generation
  92. runs-on: ubuntu-latest
  93. needs: format_and_lint_programs
  94. steps:
  95. - name: Git Checkout
  96. uses: actions/checkout@v4
  97. - name: Setup Environment
  98. uses: ./.github/actions/setup
  99. with:
  100. cargo-cache-key: cargo-programs
  101. cargo-cache-local-key: cargo-local
  102. - name: Generate IDLs
  103. run: pnpm generate:idls
  104. - name: Check Working Directory
  105. run: |
  106. git status --porcelain
  107. test -z "$(git status --porcelain)"
  108. generate_clients:
  109. name: Check Client Generation
  110. runs-on: ubuntu-latest
  111. needs: format_and_lint_programs
  112. steps:
  113. - name: Git Checkout
  114. uses: actions/checkout@v4
  115. - name: Setup Environment
  116. uses: ./.github/actions/setup
  117. with:
  118. rustfmt: true
  119. - name: Generate Clients
  120. run: pnpm generate:clients
  121. - name: Check Working Directory
  122. run: |
  123. git status --porcelain
  124. test -z "$(git status --porcelain)"
  125. test_client_js:
  126. name: Test Client JS
  127. runs-on: ubuntu-latest
  128. needs: build_programs
  129. steps:
  130. - name: Git Checkout
  131. uses: actions/checkout@v4
  132. - name: Setup Environment
  133. uses: ./.github/actions/setup
  134. with:
  135. solana: true
  136. - name: Restore Program Builds
  137. uses: actions/cache/restore@v4
  138. with:
  139. path: ./**/*.so
  140. key: ${{ runner.os }}-builds-${{ github.sha }}
  141. - name: Test Client JS
  142. run: pnpm clients:js:test
  143. test_client_rust:
  144. name: Test Client Rust
  145. runs-on: ubuntu-latest
  146. needs: build_programs
  147. steps:
  148. - name: Git Checkout
  149. uses: actions/checkout@v4
  150. - name: Setup Environment
  151. uses: ./.github/actions/setup
  152. with:
  153. cargo-cache-key: cargo-rust-client
  154. solana: true
  155. - name: Restore Program Builds
  156. uses: actions/cache/restore@v4
  157. with:
  158. path: ./**/*.so
  159. key: ${{ runner.os }}-builds-${{ github.sha }}
  160. - name: Test Client Rust
  161. run: pnpm clients:rust:test