Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run cargo install on the CI #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

qryxip
Copy link
Contributor

@qryxip qryxip commented May 20, 2020

cargo installが壊れる、といったことがたまーに発生するので。

@tanakh
Copy link
Owner

tanakh commented Sep 19, 2020

ビルドが通ってinstallがこけるというのは具体的にどういった要因によるのかと、それをCIで拾う必要があるのかというのをいただけるでしょうか?

@qryxip
Copy link
Contributor Author

qryxip commented Sep 20, 2020

こける要因としてはこの2つですね。2.は実際に見たことも無いですが、1.を3回くらい踏んだので... CIに入れる理由としては1.が発生したときにCIのバッヂが真っ赤になることによって、ユーザーが「インストールできねーぞ」というissueを立てる前に報告者本人の環境に起因している訳ではないことを本人が容易に確認できるという利点があります。(「なんかわかりませんがインストールに失敗します。私の環境は...(長々と報告者の環境とcargo installのエラー表示)」→ 「インストールできまんせんしCIが真っ赤です。--lockedではとりあえず可能なようですが。n週間前からこうなっているようです」)

  1. デフォルトでCargo.lockが無視されることにより、依存ライブラリがマイナーバージョンアップデートでうっかり破壊的変更をぶちこんできたときにcargo installが失敗することがある。これはユーザーが--locked付きで実行すればとりあえず回避可能。

    cargo install - The Cargo Book

    By default, the Cargo.lock file that is included with the package will be ignored. This means that Cargo will recompute which versions of dependencies to use, possibly using newer versions that have been released since the package was published. The --locked flag can be used to force Cargo to use the packaged Cargo.lock file if it is available. This may be useful for ensuring reproducible builds, to use the exact same set of dependencies that were available when the package was published. It may also be useful if a newer version of a dependency is published that no longer builds on your system, or has other problems. The downside to using --locked is that you will not receive any fixes or updates to any dependency. Note that Cargo did not start publishing Cargo.lock files until version 1.37, which means packages published with prior versions will not have a Cargo.lock file available.

  2. 「あるライブラリの必要であるはずのfeatureが明示的に有効化されていないが、dev-dependencies込みのdependency graph上ではたまたま有効化されている」というケースはしばしば存在する。dev-dependenciescargo installでは除外されるため、これを踏ん付けてcargo install--lockedでも失敗するという可能性がある。これは流石に直接見たことがない。

    Don't require dev-dependencies when not needed in certain cases rust-lang/cargo#5012

https:/rust-lang/cargo/blob/rust-1.47.0/src/cargo/ops/cargo_install.rs#L593

https:/rust-lang/cargo/blob/rust-1.47.0/src/cargo/core/workspace.rs#L76-L80

@qryxip
Copy link
Contributor Author

qryxip commented Sep 20, 2020

一応dependency graphの乖離が小さければ追加のビルド時間は0に近いし、大きければ1., 2.が発生する確率が増えるので意義はあると思います。 まあ少々神経質すぎるかもしれませんが...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants