Skip to content

Commit 122ff4d

Browse files
Test the error message on rustc 1.64 in CI
1 parent aae7270 commit 122ff4d

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

.github/workflows/ci.yml

+89
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
- run-on-tokio-explicit
4040
- run-on-tokio-implicit
4141
- run-on-perf-event-open-sys2
42+
- fails-on-1-64-rustc-rust-fnv
4243
if: ${{ success() || failure() }} # Run this job even if a dependency has failed.
4344
steps:
4445
- name: Job outcomes
@@ -60,6 +61,7 @@ jobs:
6061
echo "run-on-tokio-explicit: ${{ needs.run-on-tokio-explicit.result }}"
6162
echo "run-on-tokio-implicit: ${{ needs.run-on-tokio-implicit.result }}"
6263
echo "run-on-perf-event-open-sys2: ${{ needs.run-on-perf-event-open-sys2.result }}"
64+
echo "fails-on-1-64-rustc-rust-fnv: ${{ needs.fails-on-1-64-rustc-rust-fnv.result }}"
6365
6466
# Fail this required job if any of its dependent jobs have failed.
6567
#
@@ -100,6 +102,8 @@ jobs:
100102
run: exit 1
101103
- if: ${{ needs.run-on-perf-event-open-sys2.result != 'success' }}
102104
run: exit 1
105+
- if: ${{ needs.fails-on-1-64-rustc-rust-fnv.result != 'success' }}
106+
run: exit 1
103107

104108
lint:
105109
name: Check lint and rustfmt
@@ -1383,6 +1387,91 @@ jobs:
13831387
key: ${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
13841388
path: subject/target/semver-checks/cache
13851389

1390+
fails-on-1-64-rustc-rust-fnv:
1391+
# cargo-semver-checks fails if the rustc version is not high enough
1392+
# because of rustdoc format incompatibilities. This test ensures that
1393+
# we have a good error message.
1394+
# https://github.com/obi1kenobi/cargo-semver-checks/issues/444
1395+
name: 'Check failure on 1.64'
1396+
runs-on: ubuntu-latest
1397+
needs:
1398+
- build-binary
1399+
steps:
1400+
- name: Checkout cargo-semver-checks
1401+
uses: actions/checkout@v3
1402+
with:
1403+
persist-credentials: false
1404+
path: 'semver'
1405+
1406+
# rust-fnv is very lightweight and quite stable.
1407+
- name: Checkout rust-fnv
1408+
uses: actions/checkout@v3
1409+
with:
1410+
persist-credentials: false
1411+
repository: "servo/rust-fnv"
1412+
ref: '94334357754a82f3ffb705dc387bd5f4c921e954'
1413+
path: 'subject'
1414+
1415+
- name: Install rust
1416+
id: toolchain
1417+
uses: dtolnay/[email protected]
1418+
1419+
- name: Restore binary
1420+
id: cache-binary
1421+
uses: actions/cache/restore@v3
1422+
with:
1423+
path: bins/
1424+
key: bins-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
1425+
fail-on-cache-miss: true
1426+
1427+
- name: Restore rustdoc
1428+
id: cache
1429+
uses: actions/cache/restore@v3
1430+
with:
1431+
key: ${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
1432+
path: subject/target/semver-checks/cache
1433+
1434+
- name: Restore cargo index and rustdoc target dir
1435+
uses: Swatinem/rust-cache@v2
1436+
with:
1437+
workspaces: |
1438+
subject/target/semver-checks/local-fnv-1_0_7/
1439+
1440+
- name: Run semver-checks
1441+
continue-on-error: true
1442+
id: semver_checks
1443+
run: |
1444+
cd semver
1445+
set -euo pipefail
1446+
../bins/cargo-semver-checks semver-checks check-release --manifest-path="../subject/Cargo.toml" 2>&1 | tee output
1447+
touch unexpectedly_did_not_fail
1448+
1449+
- name: Check whether it failed
1450+
if: steps.semver_checks.outcome != 'failure'
1451+
run: |
1452+
echo "Error! check-release should have failed because the rustc version is too old (1.64), but it has not."
1453+
exit 1
1454+
1455+
- name: Check output
1456+
run: |
1457+
cd semver
1458+
EXPECTED="$(echo -e "Error: rustc version is not high enough: >=1.65.0 needed, got 1.64.0")"
1459+
RESULT="$(cat output | grep Error)"
1460+
diff <(echo "$RESULT") <(echo "$EXPECTED")
1461+
1462+
- name: Cleanup
1463+
run: |
1464+
cd semver
1465+
rm output
1466+
rm -f unexpectedly_did_not_fail
1467+
1468+
- name: Save rustdoc
1469+
uses: actions/cache/save@v3
1470+
if: steps.cache.outputs.cache-hit != 'true'
1471+
with:
1472+
key: ${{ runner.os }}-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('semver/**/Cargo.lock') }}-${{ github.job }}-rustdoc
1473+
path: subject/target/semver-checks/cache
1474+
13861475
init-release:
13871476
name: Run the release workflow
13881477
needs:

0 commit comments

Comments
 (0)