|
90 | 90 | echo "matrix=[$(echo $indices | tr ' ' ',')]" >> $GITHUB_OUTPUT |
91 | 91 | fi |
92 | 92 |
|
| 93 | + fmt: |
| 94 | + needs: changes |
| 95 | + if: ${{ github.event_name == 'pull_request' && needs.changes.outputs.total_projects != '0' }} |
| 96 | + name: Rustfmt |
| 97 | + runs-on: ubuntu-latest |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@v4 |
| 100 | + - uses: dtolnay/rust-toolchain@stable |
| 101 | + with: |
| 102 | + components: rustfmt |
| 103 | + - uses: mozilla-actions/[email protected] |
| 104 | + - name: Run fmt |
| 105 | + run: | |
| 106 | + readarray -t projects < <(echo '${{ needs.changes.outputs.changed_projects }}' | jq -r '.[]') |
| 107 | + for project in "${projects[@]}"; do |
| 108 | + if [ -f "$project/Cargo.toml" ]; then |
| 109 | + cd "$project" |
| 110 | + cargo fmt --check |
| 111 | + cd - > /dev/null |
| 112 | + fi |
| 113 | + done |
| 114 | +
|
| 115 | + clippy: |
| 116 | + needs: changes |
| 117 | + if: ${{ github.event_name == 'pull_request' && needs.changes.outputs.total_projects != '0' }} |
| 118 | + name: Clippy |
| 119 | + runs-on: ubuntu-latest |
| 120 | + steps: |
| 121 | + - uses: actions/checkout@v4 |
| 122 | + - uses: dtolnay/rust-toolchain@stable |
| 123 | + with: |
| 124 | + components: clippy |
| 125 | + - uses: mozilla-actions/[email protected] |
| 126 | + - name: Run clippy |
| 127 | + run: | |
| 128 | + readarray -t projects < <(echo '${{ needs.changes.outputs.changed_projects }}' | jq -r '.[]') |
| 129 | + for project in "${projects[@]}"; do |
| 130 | + if [ -f "$project/Cargo.toml" ]; then |
| 131 | + cd "$project" |
| 132 | + cargo clippy -- -D warnings |
| 133 | + cd - > /dev/null |
| 134 | + fi |
| 135 | + done |
| 136 | +
|
93 | 137 | build-and-test: |
94 | 138 | needs: changes |
95 | 139 | if: needs.changes.outputs.total_projects != '0' |
@@ -120,27 +164,53 @@ jobs: |
120 | 164 | cd "$project" || return 1 |
121 | 165 |
|
122 | 166 | # Install dependencies |
123 | | - if ! pnpm install --frozen-lockfile; then |
124 | | - echo "::error::pnpm install failed for $project" |
125 | | - echo "$project: pnpm install failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt |
126 | | - cd - > /dev/null |
127 | | - return 1 |
128 | | - fi |
| 167 | + if [ -f "package.json" ]; then |
| 168 | + if ! pnpm install --frozen-lockfile; then |
| 169 | + echo "::error::pnpm install failed for $project" |
| 170 | + echo "$project: pnpm install failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt |
| 171 | + cd - > /dev/null |
| 172 | + return 1 |
| 173 | + fi |
129 | 174 |
|
130 | | - # Build |
131 | | - if ! pnpm build; then |
132 | | - echo "::error::build failed for $project" |
133 | | - echo "$project: build failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt |
134 | | - cd - > /dev/null |
135 | | - return 1 |
136 | | - fi |
| 175 | + # Build |
| 176 | + if ! pnpm build; then |
| 177 | + echo "::error::build failed for $project" |
| 178 | + echo "$project: build failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt |
| 179 | + cd - > /dev/null |
| 180 | + return 1 |
| 181 | + fi |
137 | 182 |
|
138 | | - # Test |
139 | | - if ! pnpm build-and-test; then |
140 | | - echo "::error::tests failed for $project" |
141 | | - echo "$project: tests failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt |
142 | | - cd - > /dev/null |
143 | | - return 1 |
| 183 | + # Test |
| 184 | + if ! pnpm build-and-test; then |
| 185 | + echo "::error::tests failed for $project" |
| 186 | + echo "$project: tests failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt |
| 187 | + cd - > /dev/null |
| 188 | + return 1 |
| 189 | + fi |
| 190 | + else |
| 191 | + # Use Steel CLI |
| 192 | + if ! cargo install steel-cli; then |
| 193 | + echo "::error::steel-cli installation failed for $project" |
| 194 | + echo "$project: steel-cli installation failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt |
| 195 | + cd - > /dev/null |
| 196 | + return 1 |
| 197 | + fi |
| 198 | +
|
| 199 | + # Build |
| 200 | + if ! steel build; then |
| 201 | + echo "::error::steel build failed for $project" |
| 202 | + echo "$project: steel build failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt |
| 203 | + cd - > /dev/null |
| 204 | + return 1 |
| 205 | + fi |
| 206 | +
|
| 207 | + # Test |
| 208 | + if ! steel test; then |
| 209 | + echo "::error::steel test failed for $project" |
| 210 | + echo "$project: steel test failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt |
| 211 | + cd - > /dev/null |
| 212 | + return 1 |
| 213 | + fi |
144 | 214 | fi |
145 | 215 |
|
146 | 216 | echo "Build and tests succeeded for $project with $solana_version version." |
@@ -184,21 +254,29 @@ jobs: |
184 | 254 | with: |
185 | 255 | solana-cli-version: stable |
186 | 256 | - name: Build and Test with Stable |
| 257 | + env: |
| 258 | + SCCACHE_GHA_ENABLED: "true" |
| 259 | + RUSTC_WRAPPER: "sccache" |
187 | 260 | run: | |
188 | 261 | source build_and_test.sh |
189 | 262 | solana -V |
190 | 263 | rustc -V |
191 | 264 | process_projects "stable" |
| 265 | + sccache --show-stats |
192 | 266 | - name: Setup Solana 1.18.17 |
193 | 267 | |
194 | 268 | with: |
195 | 269 | solana-cli-version: 1.18.17 |
196 | 270 | - name: Build and Test with 1.18.17 |
| 271 | + env: |
| 272 | + SCCACHE_GHA_ENABLED: "true" |
| 273 | + RUSTC_WRAPPER: "sccache" |
197 | 274 | run: | |
198 | 275 | source build_and_test.sh |
199 | 276 | solana -V |
200 | 277 | rustc -V |
201 | 278 | process_projects "1.18.17" |
| 279 | + sccache --show-stats |
202 | 280 |
|
203 | 281 | - name: Set failed projects output |
204 | 282 | id: set-failed |
|
0 commit comments