Skip to content
Open
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
18 changes: 18 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,24 @@ jobs:
exit "$EXIT_CODE"
fi

lint-rust:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This does not lint rust sources. A better name would be lint-crates.

Suggested change
lint-rust:
lint-crates:

if: github.event.pull_request.draft == false
runs-on: ubuntu-slim
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
sparse-checkout: |
tools/nix/pkgs.nix
deps/v8/DEPS
deps/crates/check-deps-in-sync-with-v8.sh
deps/crates/Cargo.toml
deps/crates/Cargo.lock
sparse-checkout-cone-mode: false
- uses: cachix/install-nix-action@ab739621df7a23f52766f9ccc97f38da6b7af14f # v31.10.5
- name: Validate dependencies
run: nix-shell -I nixpkgs=./tools/nix/pkgs.nix --pure -p cacert gawk git jq tomlq --run ./deps/crates/check-deps-in-sync-with-v8.sh

lint-py:
if: github.event.pull_request.draft == false
runs-on: ubuntu-slim
Expand Down
36 changes: 36 additions & 0 deletions deps/crates/check-deps-in-sync-with-v8.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh
#! nix-shell --pure -i bash -p cacert gawk git jq tomlq
set -e

BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd)

THIRD_PARTY_REPO=$(mktemp -d)
DEP_VERSIONS=$(mktemp)

cleanup () {
EXIT_CODE=$?
rm -f "$DEP_VERSIONS"
rm -rf "$THIRD_PARTY_REPO"
exit $EXIT_CODE
}

trap cleanup INT TERM EXIT

tq -f "$BASE_DIR/deps/crates/Cargo.lock" -o json '.package' > "$DEP_VERSIONS"


REV=$(awk -F"'" "/'\\/chromium\\/src\\/third_party\\/rust'/{ print \$8 }" "$BASE_DIR/deps/v8/DEPS")
git clone --depth=1 --revision "$REV" https://chromium.googlesource.com/chromium/src/third_party/rust "$THIRD_PARTY_REPO"

MISMATCH=
for dep in $(tq -f "$BASE_DIR/deps/crates/Cargo.toml" -o json '.dependencies' | jq -r 'keys | .[]'); do
CURRENT_VERSION=$(jq --arg dep_name "$dep" -r '.[] | select(.name == $dep_name) | .version' < "$DEP_VERSIONS")
REQUIRED_VERSION=$(grep '^Version: ' "$THIRD_PARTY_REPO/$dep"/*/README.chromium | awk '{ print $2 }')

[ "$CURRENT_VERSION" = "$REQUIRED_VERSION" ] || {
echo "$dep should be on version $REQUIRED_VERSION, found $CURRENT_VERSION" >&2
MISMATCH=1
}
done

[ -z "$MISMATCH" ] && echo "All versions match" >&2
Loading