|
53 | 53 | steps:
|
54 | 54 | - name: Checkout the source code
|
55 | 55 | uses: actions/checkout@v4
|
| 56 | + # Cache citool to make its build faster, as it's in the critical path. |
| 57 | + # The rust-cache doesn't bleed into the main `job`, so it should not affect any other |
| 58 | + # Rust compilation. |
| 59 | + - name: Cache citool |
| 60 | + uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8 |
| 61 | + with: |
| 62 | + workspaces: src/ci/citool |
56 | 63 | - name: Calculate the CI job matrix
|
57 | 64 | env:
|
58 | 65 | COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
|
68 | 75 | timeout-minutes: 360
|
69 | 76 | env:
|
70 | 77 | CI_JOB_NAME: ${{ matrix.name }}
|
| 78 | + CI_JOB_DOC_URL: ${{ matrix.doc_url }} |
| 79 | + GITHUB_WORKFLOW_RUN_ID: ${{ github.run_id }} |
| 80 | + GITHUB_REPOSITORY: ${{ github.repository }} |
71 | 81 | CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
|
72 | 82 | # commit of PR sha or commit sha. `GITHUB_SHA` is not accurate for PRs.
|
73 | 83 | HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
81 | 91 | # Check the `calculate_matrix` job to see how is the matrix defined.
|
82 | 92 | include: ${{ fromJSON(needs.calculate_matrix.outputs.jobs) }}
|
83 | 93 | steps:
|
| 94 | + - name: Install cargo in AWS CodeBuild |
| 95 | + if: matrix.codebuild |
| 96 | + run: | |
| 97 | + # Check if cargo is installed |
| 98 | + if ! command -v cargo &> /dev/null; then |
| 99 | + echo "Cargo not found, installing Rust..." |
| 100 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal |
| 101 | + # Make cargo available in PATH |
| 102 | + echo "$HOME/.cargo/bin" >> $GITHUB_PATH |
| 103 | + fi |
| 104 | +
|
84 | 105 | - name: disable git crlf conversion
|
85 | 106 | run: git config --global core.autocrlf false
|
86 | 107 |
|
@@ -115,9 +136,6 @@ jobs:
|
115 | 136 | # which then uses log commands to actually set them.
|
116 | 137 | EXTRA_VARIABLES: ${{ toJson(matrix.env) }}
|
117 | 138 |
|
118 |
| - - name: setup upstream remote |
119 |
| - run: src/ci/scripts/setup-upstream-remote.sh |
120 |
| - |
121 | 139 | - name: ensure the channel matches the target branch
|
122 | 140 | run: src/ci/scripts/verify-channel.sh
|
123 | 141 |
|
@@ -158,6 +176,8 @@ jobs:
|
158 | 176 | run: src/ci/scripts/install-ninja.sh
|
159 | 177 |
|
160 | 178 | - name: enable ipv6 on Docker
|
| 179 | + # Don't run on codebuild because systemctl is not available |
| 180 | + if: ${{ !matrix.codebuild }} |
161 | 181 | run: src/ci/scripts/enable-docker-ipv6.sh
|
162 | 182 |
|
163 | 183 | # Disable automatic line ending conversion (again). On Windows, when we're
|
@@ -190,8 +210,20 @@ jobs:
|
190 | 210 | CARGO_INCREMENTAL=0 CARGO_TARGET_DIR=../../../build/citool cargo build
|
191 | 211 |
|
192 | 212 | - name: run the build
|
193 |
| - # Redirect stderr to stdout to avoid reordering the two streams in the GHA logs. |
194 |
| - run: src/ci/scripts/run-build-from-ci.sh 2>&1 |
| 213 | + run: | |
| 214 | + set +e |
| 215 | + # Redirect stderr to stdout to avoid reordering the two streams in the GHA logs. |
| 216 | + src/ci/scripts/run-build-from-ci.sh 2>&1 |
| 217 | + STATUS=$? |
| 218 | + set -e |
| 219 | +
|
| 220 | + if [[ "$STATUS" -ne 0 && -n "$CI_JOB_DOC_URL" ]]; then |
| 221 | + echo "****************************************************************************" |
| 222 | + echo "To find more information about this job, visit the following URL:" |
| 223 | + echo "$CI_JOB_DOC_URL" |
| 224 | + echo "****************************************************************************" |
| 225 | + fi |
| 226 | + exit ${STATUS} |
195 | 227 | env:
|
196 | 228 | AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }}
|
197 | 229 | AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}
|
@@ -226,16 +258,31 @@ jobs:
|
226 | 258 | if: github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1'
|
227 | 259 |
|
228 | 260 | - name: postprocess metrics into the summary
|
| 261 | + # This step is not critical, and if some I/O problem happens, we don't want |
| 262 | + # to cancel the build. |
| 263 | + continue-on-error: true |
229 | 264 | run: |
|
230 | 265 | if [ -f build/metrics.json ]; then
|
231 |
| - ./build/citool/debug/citool postprocess-metrics build/metrics.json ${GITHUB_STEP_SUMMARY} |
| 266 | + METRICS=build/metrics.json |
232 | 267 | elif [ -f obj/build/metrics.json ]; then
|
233 |
| - ./build/citool/debug/citool postprocess-metrics obj/build/metrics.json ${GITHUB_STEP_SUMMARY} |
| 268 | + METRICS=obj/build/metrics.json |
234 | 269 | else
|
235 | 270 | echo "No metrics.json found"
|
| 271 | + exit 0 |
236 | 272 | fi
|
237 | 273 |
|
| 274 | + # Get closest bors merge commit |
| 275 | + PARENT_COMMIT=`git rev-list --author='bors <[email protected]>' -n1 --first-parent HEAD^1` |
| 276 | +
|
| 277 | + ./build/citool/debug/citool postprocess-metrics \ |
| 278 | + --job-name ${CI_JOB_NAME} \ |
| 279 | + --parent ${PARENT_COMMIT} \ |
| 280 | + ${METRICS} >> ${GITHUB_STEP_SUMMARY} |
| 281 | +
|
238 | 282 | - name: upload job metrics to DataDog
|
| 283 | + # This step is not critical, and if some I/O problem happens, we don't want |
| 284 | + # to cancel the build. |
| 285 | + continue-on-error: true |
239 | 286 | if: needs.calculate_matrix.outputs.run_type != 'pr'
|
240 | 287 | env:
|
241 | 288 | DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
|
|
0 commit comments