ci: semver-checks should run on rust stable

This commit is contained in:
Jose Storopoli 2024-07-10 16:02:24 +00:00
parent 0fa2b0b16a
commit 213566f34b
No known key found for this signature in database
GPG Key ID: 29E00111DE172C28
2 changed files with 4 additions and 26 deletions

View File

@ -5,7 +5,7 @@ name: Check semver breaks
jobs: jobs:
API: API:
name: API - nightly toolchain name: API - stable toolchain
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
@ -15,10 +15,7 @@ jobs:
with: with:
fetch-depth: 0 # we need full history for cargo semver-checks fetch-depth: 0 # we need full history for cargo semver-checks
- name: "Install Rustup" - name: "Install Rustup"
uses: dtolnay/rust-toolchain@nightly uses: dtolnay/rust-toolchain@stable
- name: "Select nightly-version"
run: |
rustup default $(cat nightly-version)
- name: "Install cargo-binstall" - name: "Install cargo-binstall"
uses: cargo-bins/cargo-binstall@main uses: cargo-bins/cargo-binstall@main
- name: "Binstall cargo-semver-checks" - name: "Binstall cargo-semver-checks"

View File

@ -12,9 +12,6 @@
set -euo pipefail set -euo pipefail
# Our nightly version.
NIGHTLY=$(cat nightly-version)
# These are the hardcoded flags that cargo semver-checks uses # These are the hardcoded flags that cargo semver-checks uses
# under the hood to invoke rustdoc. # under the hood to invoke rustdoc.
RUSTDOCFLAGS="-Z unstable-options --document-private-items --document-hidden-items --output-format=json --cap-lints=allow" RUSTDOCFLAGS="-Z unstable-options --document-private-items --document-hidden-items --output-format=json --cap-lints=allow"
@ -29,9 +26,6 @@ else
fi fi
main() { main() {
# we need cargo nightly to generate the JSON files from cargo doc.
need_nightly
# On current commit: # On current commit:
# 1. bitcoin: all-features and no-default-features. # 1. bitcoin: all-features and no-default-features.
generate_json_files_all_features "bitcoin" "current" generate_json_files_all_features "bitcoin" "current"
@ -108,7 +102,7 @@ main() {
# Run cargo doc with the cargo semver-checks rustdoc flags. # Run cargo doc with the cargo semver-checks rustdoc flags.
# We don't care about dependencies. # We don't care about dependencies.
run_cargo_doc() { run_cargo_doc() {
RUSTDOCFLAGS="$RUSTDOCFLAGS" cargo +"$NIGHTLY" doc --no-deps "$@" RUSTDOCFLAGS="$RUSTDOCFLAGS" RUSTC_BOOTSTRAP=1 cargo doc --no-deps "$@"
} }
# Run cargo semver-check # Run cargo semver-check
@ -122,7 +116,7 @@ run_cargo_semver_check() {
# semver check fails. # semver check fails.
# We check that manually later. # We check that manually later.
set +e set +e
cargo +"$NIGHTLY" semver-checks -v --baseline-rustdoc "$crate-master-$variant.json" --current-rustdoc "$crate-current-$variant.json" > "$crate-$variant-semver.txt" 2>&1 cargo semver-checks -v --baseline-rustdoc "$crate-master-$variant.json" --current-rustdoc "$crate-current-$variant.json" > "$crate-$variant-semver.txt" 2>&1
set -e set -e
} }
@ -191,19 +185,6 @@ check_for_breaking_changes() {
fi fi
} }
# Safekeeping: check if we have a nightly compiler.
need_nightly() {
cargo_ver=$(cargo +"$NIGHTLY" --version)
if echo "$cargo_ver" | grep -q -v nightly; then
err "Need a nightly compiler; have $cargo_ver"
fi
}
err() {
echo "$1" >&2
exit 1
}
# #
# Main script # Main script
# #