Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 52 additions & 4 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,73 @@ jobs:
os: '["ubuntu-latest", "macos-latest", "windows-latest"]'
release-build: true

# Everyday jobs on real data: the Census Bureau's tracts for Shelby County, Tennessee, checked
# against the areas it publishes (crates/engine/tests/workflows.rs). The files are public domain
# and pinned by checksum; a changed file fails the run, a download that fails skips the tests
# (`tested` tells the report, which then neither opens nor closes an issue).
workflows:
name: Workflows on real data
needs: changed
if: needs.changed.outputs.run == 'true'
runs-on: ubuntu-latest
outputs:
tested: ${{ steps.data.outputs.ok }}
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
save-if: false
- uses: actions/cache@v6
with:
path: workflow-data
key: workflow-data-census-2024-1
- id: data
name: Download the Census files
run: |
set -uo pipefail
mkdir -p workflow-data
cd workflow-data
ok=true
while read -r sum url; do
file="${url##*/}"
if ! echo "$sum $file" | sha256sum -c --status 2>/dev/null; then
curl -sSfL --retry 3 -o "$file" "$url" || { echo "::warning::could not download $url"; ok=false; continue; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug (robustness), confidence medium. curl has no timeout, so a stalled connection to census.gov can hang this job until GitHub's default six-hour limit. The report job waits on workflows, so the nightly report is delayed too. Bounding the connect and total time turns a stall into the existing "download failed, skip" path.

Suggested change
curl -sSfL --retry 3 -o "$file" "$url" || { echo "::warning::could not download $url"; ok=false; continue; }
curl -sSfL --retry 3 --connect-timeout 30 --max-time 600 -o "$file" "$url" || { echo "::warning::could not download $url"; ok=false; continue; }

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, worth bounding. The next change to nightly.yml, the fuzzing job I'm preparing for #779, will add --max-time to these downloads and timeout-minutes to the job, rather than another push here.

echo "$sum $file" | sha256sum -c || { echo "::error::$file has changed: update its checksum and check the test"; exit 1; }
fi
done <<'LIST'
e635ccb4f3035f8fa19b76352a63c89b893f57d0b96ecd5b713754141184bd3d https://www2.census.gov/geo/tiger/TIGER2024/TRACT/tl_2024_47_tract.zip
38cdd818f50248f67fabf4baf4b82df4ed6110dcaafebcbe4d4f9a389bb47ab8 https://www2.census.gov/geo/docs/maps-data/data/gazetteer/2024_Gazetteer/2024_gaz_tracts_47.txt
LIST
echo "ok=$ok" >> "$GITHUB_OUTPUT"
- name: Run the workflow tests on them
if: steps.data.outputs.ok == 'true'
env:
RUSTGIS_WORKFLOW_DATA: ${{ github.workspace }}/workflow-data
run: cargo test --locked -p rustgis-engine --test workflows -- --ignored

report:
name: Report
needs: [changed, rust]
needs: [changed, rust, workflows]
# A cancelled run is neither a failure nor a fix.
if: always() && github.event_name == 'schedule' && needs.changed.outputs.run == 'true' && needs.rust.result != 'cancelled'
if: always() && github.event_name == 'schedule' && needs.changed.outputs.run == 'true' && needs.rust.result != 'cancelled' && needs.workflows.result != 'cancelled'
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- env:
GH_TOKEN: ${{ github.token }}
RESULT: ${{ needs.rust.result }}
# "incomplete": everything ran passed, but the real-data tests couldn't download their files.
RESULT: ${{ (needs.rust.result != 'success' || needs.workflows.result != 'success') && 'failure' || (needs.workflows.outputs.tested == 'true' && 'success' || 'incomplete') }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quality, confidence high. The RESULT expression packs three outcomes into one nested &&/|| chain that reads as a puzzle. Because && and || return operands and not booleans, it is easy to misread. The same logic is clearer in the shell step that already reads $RESULT, where the three branches can be spelled out:

if [ "$RUST" != success ] || [ "$WORKFLOWS" != success ]; then RESULT=failure
elif [ "$TESTED" = true ]; then RESULT=success
else RESULT=incomplete; fi

with RUST, WORKFLOWS and TESTED passed in env. The behaviour is unchanged; the outcomes are just spelled out.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment above the expression lists the three outcomes. I'll leave splitting it into steps for the release quality pass rather than push again.

RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
title="Nightly build failed"
open="$(gh issue list -R "$GITHUB_REPOSITORY" --state open --search "in:title \"$title\"" \
--json number,title --jq "[.[] | select(.title == \"$title\")][0].number // \"\"")"
if [ "$RESULT" = success ]; then
if [ "$RESULT" = incomplete ]; then
echo "The real-data tests didn't run (download failed): leaving the nightly issue as it is."
elif [ "$RESULT" = success ]; then
if [ -n "$open" ]; then
gh issue close "$open" -R "$GITHUB_REPOSITORY" --comment "Fixed: the nightly run on $GITHUB_SHA passed ($RUN)."
fi
Expand Down
Loading
Loading