|
| 1 | +name: Build Safety-Critical Rust Coding Guidelines |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths: |
| 6 | + - 'subcommittee/coding-guidelines/initiatives/safety-critical-rust-coding-guidelines/**' |
| 7 | + pull_request: |
| 8 | + paths: |
| 9 | + - 'subcommittee/coding-guidelines/initiatives/safety-critical-rust-coding-guidelines/**' |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout repository |
| 16 | + uses: actions/checkout@v3 |
| 17 | + |
| 18 | + - name: Install uv |
| 19 | + run: | |
| 20 | + curl -LsSf https://astral.sh/uv/install.sh | sh |
| 21 | + export PATH="/root/.cargo/bin:$PATH" |
| 22 | + uv --version |
| 23 | +
|
| 24 | + - name: Build documentation |
| 25 | + working-directory: subcommittee/coding-guidelines/initiatives/safety-critical-rust-coding-guidelines |
| 26 | + run: | |
| 27 | + mkdir -p build |
| 28 | + ./make.py 2>&1 | tee build/build.log |
| 29 | +
|
| 30 | + # Check for a wide range of error indicators in the log |
| 31 | + if grep -q -E "Traceback" build/build.log; then |
| 32 | + echo "::error::Build errors detected in log" |
| 33 | + |
| 34 | + # Extract error contexts and annotate them in the GitHub Actions UI |
| 35 | + echo "=== ERROR DETAILS ===" |
| 36 | + |
| 37 | + # Check for the Sphinx temp error file reference and extract it if present |
| 38 | + TEMP_ERROR_FILE=$(grep -o '/tmp/sphinx-err-[^ ]*\.log' logs/build.log | head -1) |
| 39 | + if [ ! -z "$TEMP_ERROR_FILE" ] && [ -f "$TEMP_ERROR_FILE" ]; then |
| 40 | + echo "==== SPHINX DETAILED TRACEBACK START ====" |
| 41 | + cat "$TEMP_ERROR_FILE" |
| 42 | + echo "==== SPHINX DETAILED TRACEBACK END ====" |
| 43 | + |
| 44 | + # Save this traceback for artifacts |
| 45 | + cp "$TEMP_ERROR_FILE" build/sphinx_traceback.log |
| 46 | + fi |
| 47 | + |
| 48 | + exit 1 |
| 49 | + fi |
| 50 | +
|
| 51 | + - name: Archive build logs |
| 52 | + uses: actions/upload-artifact@v4 |
| 53 | + if: always() |
| 54 | + with: |
| 55 | + name: build-logs |
| 56 | + path: subcommittee/coding-guidelines/initiatives/safety-critical-rust-coding-guidelines/ |
| 57 | + retention-days: 7 |
| 58 | + compression-level: 6 # Default compression level for a good balance of speed and size |
0 commit comments