-
Notifications
You must be signed in to change notification settings - Fork 104
Call Pkg.resolve()
before hashing Manifest
#519
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# This action runs Pkg.instantiate() and Pkg.resolve() every time the master | ||
# branch is pushed to. If this leads to a change in the Manifest.toml file, it | ||
# will open a PR to update the Manifest.toml file. This ensures that the | ||
# contents of the Manifest in the repository are consistent with the contents | ||
# of the Manifest used by the CI system (i.e. during the actual docs | ||
# generation). | ||
# | ||
# See https://github.com/TuringLang/docs/issues/518 for motivation. | ||
|
||
name: Resolve Manifest | ||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
jobs: | ||
check-version: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
env: | ||
# Disable precompilation as it takes a long time and is not needed for this workflow | ||
JULIA_PKG_PRECOMPILE_AUTO: 0 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Julia | ||
uses: julia-actions/setup-julia@v2 | ||
|
||
- name: Instantiate and resolve | ||
run: | | ||
julia -e 'using Pkg; Pkg.instantiate(); Pkg.resolve()' | ||
|
||
- name: Open PR | ||
id: create_pr | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
branch: resolve-manifest | ||
add-paths: Manifest.toml | ||
commit-message: "Update Manifest.toml" | ||
body: "This PR is automatically generated by the `resolve_manifest.yml` GitHub Action." | ||
title: "Update Manifest.toml to match CI environment" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the downside, updating the
Manifest.toml
file for every PR might cause issues for docs/tutorials that are not changed by PRs. On the positive side, such a policy would ensure tutorials and docs are more actively maintained for new Julia package versions.Is this a desirable policy that we wish to enforce?
cc @devmotion @mhauru
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm,
Pkg.resolve()
doesn't update packages though; that would bePkg.update()
.I'm sure I'm missing some weird edge case of an edge case 😄 but the only situation I could think of where
resolve()
actually changes anything is the already edge case where CI runs with a Julia version different from that in the Manifest.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Or if the Manifest is inconsistent with Project.toml, but we have a check for that 🙂)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@penelopeysm, you might want to ask in the Julia language workspace to clarify the difference between
resolve
andupdate
. The docstrings are not super clear in this case:Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I found https://discourse.julialang.org/t/what-is-the-difference-between-pkg-resolve-and-pkg-instantiate/77643/2:
But actually even better, I tested it locally :)
If Project.toml has a compat entry of
"Foo = 0.5"
and Manifest has[email protected]
, resolve() will fail with an error. We shouldn't run into this case because in this repository there only has one compat entry for Turing itself, and we already check that the Turing version is consistentIf Project.toml has no compat entry and Manifest has
[email protected]
,resolve()
doesn't do anything, even if there's a newer version available. This means that for all non-Turing deps the version in the Manifest will always be the one used.