about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-01-07 20:43:06 +0000
committerbors <bors@rust-lang.org>2024-01-07 20:43:06 +0000
commitd475e62159dfaa0e476aef04a5bd237e2ea1b7e3 (patch)
tree1134d8a9ca575c30098cca0856979d99c55a8083 /src
parent6f017d22cc9ed8d27543510a10f101c11bbd9669 (diff)
parent7d5de709c8fbe24bb34817d289ac91f0d2e3a6b8 (diff)
downloadrust-d475e62159dfaa0e476aef04a5bd237e2ea1b7e3.tar.gz
rust-d475e62159dfaa0e476aef04a5bd237e2ea1b7e3.zip
Auto merge of #3260 - saethlin:build-all-tier-2, r=RalfJung
Check if tier 2 targets build in the nightly cron job

This PR adds a CI job that only runs nightly which will install Miri built from the latest commit, and try to build every Tier 2 without host tools target, as documented on https://doc.rust-lang.org/nightly/rustc/platform-support.html.

I'm not really excited about the idea of scraping the tier 2 without host tools list, but also keeping the list up-to-date by hand seems prone to forgetting to update it. And that update seems like the sort of manual maintenance we should automate.
Diffstat (limited to 'src')
-rw-r--r--src/tools/miri/.github/workflows/ci.yml4
-rw-r--r--src/tools/miri/.github/workflows/sysroots.yml49
-rw-r--r--src/tools/miri/cargo-miri/Cargo.lock4
-rwxr-xr-xsrc/tools/miri/ci/build-all-targets.sh27
-rwxr-xr-xsrc/tools/miri/ci/ci.sh (renamed from src/tools/miri/ci.sh)0
-rw-r--r--src/tools/miri/ci/scrape-targets.py15
6 files changed, 95 insertions, 4 deletions
diff --git a/src/tools/miri/.github/workflows/ci.yml b/src/tools/miri/.github/workflows/ci.yml
index dec85e9232f..0954c57a1db 100644
--- a/src/tools/miri/.github/workflows/ci.yml
+++ b/src/tools/miri/.github/workflows/ci.yml
@@ -73,7 +73,7 @@ jobs:
           cargo -V
 
       - name: Test
-        run: ./ci.sh
+        run: ./ci/ci.sh
 
   style:
     name: style checks
@@ -169,7 +169,7 @@ jobs:
             --message 'Dear @*T-miri*,
 
           It would appear that the [Miri cron job build]('"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"') failed.
-          
+
           This likely means that rustc changed the miri directory and
           we now need to do a [`./miri rustc-pull`](https://github.com/rust-lang/miri/blob/master/CONTRIBUTING.md#importing-changes-from-the-rustc-repo).
 
diff --git a/src/tools/miri/.github/workflows/sysroots.yml b/src/tools/miri/.github/workflows/sysroots.yml
new file mode 100644
index 00000000000..509521e7478
--- /dev/null
+++ b/src/tools/miri/.github/workflows/sysroots.yml
@@ -0,0 +1,49 @@
+name: Tier 2 sysroots
+
+on: push
+#  schedule:
+#    - cron: '44 4 * * *' # At 4:44 UTC every day.
+
+defaults:
+  run:
+    shell: bash
+
+jobs:
+  sysroots:
+    name: Build the sysroots
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - name: Build the sysroots
+        run: |
+          cargo install -f rustup-toolchain-install-master
+          ./miri toolchain -c rust-docs # Docs are the only place targets are separated by tier
+          ./miri install
+          python3 -m pip install beautifulsoup4
+          ./ci/build-all-targets.sh
+
+  sysroots-cron-fail-notify:
+    name: sysroots cronjob failure notification
+    runs-on: ubuntu-latest
+    needs: [sysroots]
+    if: failure() || cancelled()
+    steps:
+      # Send a Zulip notification
+      - name: Install zulip-send
+        run: pip3 install zulip
+      - name: Send Zulip notification
+        env:
+          ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }}
+          ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }}
+        run: |
+          ~/.local/bin/zulip-send --user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com \
+            --stream miri --subject "Cron Job Failure (miri, $(date -u +%Y-%m))" \
+            --message 'Dear @*T-miri*,
+
+          It would appear that the [Miri sysroots cron job build]('"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"') failed.
+
+          Would you mind investigating this issue?
+
+          Thanks in advance!
+          Sincerely,
+          The Miri Cronjobs Bot'
diff --git a/src/tools/miri/cargo-miri/Cargo.lock b/src/tools/miri/cargo-miri/Cargo.lock
index 6e3a8dbaa1d..fe384c9d497 100644
--- a/src/tools/miri/cargo-miri/Cargo.lock
+++ b/src/tools/miri/cargo-miri/Cargo.lock
@@ -194,9 +194,9 @@ dependencies = [
 
 [[package]]
 name = "rustc-build-sysroot"
-version = "0.4.2"
+version = "0.4.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ed2a90dfa5232ed5ff21d53d4df655f315ab316ea06fc508f1c74bcedb1ce6c"
+checksum = "39dcf8d82b1f79a179bdb284dc44db440a9666eefa5a6df5ef282d6db930d544"
 dependencies = [
  "anyhow",
  "rustc_version",
diff --git a/src/tools/miri/ci/build-all-targets.sh b/src/tools/miri/ci/build-all-targets.sh
new file mode 100755
index 00000000000..bf3ffd07017
--- /dev/null
+++ b/src/tools/miri/ci/build-all-targets.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+set -eu
+set -o pipefail
+
+FAILS_DIR=failures
+
+rm -rf $FAILS_DIR
+mkdir $FAILS_DIR
+
+PLATFORM_SUPPORT_FILE=$(rustc +miri --print sysroot)/share/doc/rust/html/rustc/platform-support.html
+
+for target in $(python3 ci/scrape-targets.py $PLATFORM_SUPPORT_FILE); do
+    # Wipe the cache before every build to minimize disk usage
+    rm -rf ~/.cache/miri
+    if cargo +miri miri setup --target $target 2>&1 | tee failures/$target; then
+        # If the build succeeds, delete its output. If we have output, a build failed.
+        rm $FAILS_DIR/$target
+    fi
+done
+
+# If the sysroot for any target fails to build, we will have a file in FAILS_DIR.
+if [[ $(ls failures | wc -l) -ne 0 ]]; then
+    echo "Sysroots for the following targets failed to build:"
+    ls $FAILS_DIR
+    exit 1
+fi
diff --git a/src/tools/miri/ci.sh b/src/tools/miri/ci/ci.sh
index 6bcc68ebf7c..6bcc68ebf7c 100755
--- a/src/tools/miri/ci.sh
+++ b/src/tools/miri/ci/ci.sh
diff --git a/src/tools/miri/ci/scrape-targets.py b/src/tools/miri/ci/scrape-targets.py
new file mode 100644
index 00000000000..c0cc5b2c3b4
--- /dev/null
+++ b/src/tools/miri/ci/scrape-targets.py
@@ -0,0 +1,15 @@
+import sys
+from bs4 import BeautifulSoup
+
+html = open(sys.argv[1], 'r').read()
+soup = BeautifulSoup(html, features="html.parser")
+# The tables are:
+# Tier 1                    <-- this is already checked by main CI, so we ignore it here
+# Tier 2 with host tools    <-- we want this one
+# Tier 2 without host tools <-- and also this
+# Tier 3
+for table in soup.find_all("table")[1:3]:
+    for row in table.find_all('tr'):
+        code = row.find('code')
+        if code is not None:
+            print(code.text)