From 7712f8bc9ff7e15b22952c8158d1de7ec2831d2f Mon Sep 17 00:00:00 2001 From: Julian Eager Date: Tue, 17 Dec 2024 19:05:55 +0800 Subject: [PATCH] chore: check publishable crates separately (#12628) closes #12625 cc @staffik --- .github/workflows/ci.yml | 20 ++++++++++++++++---- Justfile | 10 +++++++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c89a30674b9..ac9fda7a174 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -425,13 +425,25 @@ jobs: fail_ci_if_error: true flags: pytests,upgradability,linux - windows_public_libraries_check: - name: "Windows check for building public libraries" - runs-on: "windows-latest" + publishable_packages_check: + name: "Cargo check publishable packages separately" + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - name: Linux + id: linux + os: ubuntu-latest + - name: Windows + id: win + os: windows-latest timeout-minutes: 30 steps: - uses: actions/checkout@v4 - uses: taiki-e/install-action@5ce83af8b5520828f63d83d98df0eea6a66c7978 with: tool: just - - run: just check_build_public_libraries + - run: just check-publishable-separately + - run: just check-publishable-separately --no-default-features + - run: just check-publishable-separately --all-features diff --git a/Justfile b/Justfile index 80851906e70..91dfadfa9d2 100644 --- a/Justfile +++ b/Justfile @@ -10,7 +10,6 @@ platform_excludes := if os() == "macos" { } nightly_flags := "--features nightly,test_features" -public_libraries := "-p near-primitives -p near-crypto -p near-jsonrpc-primitives -p near-chain-configs -p near-primitives-core" export RUST_BACKTRACE := env("RUST_BACKTRACE", "short") ci_hack_nextest_profile := if env("CI_HACKS", "0") == "1" { "--profile ci" } else { "" } @@ -150,5 +149,10 @@ check-protocol-schema: env {{protocol_schema_env}} cargo test -p protocol-schema-check --profile dev-artifacts env {{protocol_schema_env}} cargo run -p protocol-schema-check --profile dev-artifacts -check_build_public_libraries: - cargo check {{public_libraries}} +publishable := "cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.publish == null or (.publish | length > 0)) | .name'" +check-publishable-separately *OPTIONS: + #!/usr/bin/env bash + for pkg in $({{ publishable }}); do + echo "Checking $pkg..." + cargo check -p $pkg {{ OPTIONS }} + done