forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 1k
Ci/crate publish test #6550
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
Closed
Closed
Ci/crate publish test #6550
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
49f64ad
add crate publish test to ci
mircea-c fb8490f
Update ci/publish-crate.sh
mircea-c 49a20b4
Update ci/publish-crate.sh
mircea-c af3d9d3
Update ci/change-crate-deps.py
mircea-c b7e441b
Add buildkite action wait
mircea-c c69c99b
add extra job for crate publish test
mircea-c 155cbe3
Merge branch 'master' into ci/crate-publish-test
mircea-c 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,9 @@ | ||
| [target.x86_64-unknown-linux-gnu] | ||
| # When building for linux, target the minimal supported CPU | ||
| rustflags = ["-Ctarget-cpu=x86-64-v2"] | ||
|
|
||
| # registry configuration for crate publish test | ||
| [registries.kellnr] | ||
| index = "sparse+http://127.0.0.1:8000/api/v1/crates/" | ||
| credential-provider = ["cargo:token"] | ||
| token = "Zy9HhJ02RJmg0GCrgLfaCVfU6IwDfhXD" |
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,54 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| # This script: | ||
| # - searches given manifest file for solana / agave dependencies | ||
| # - modifies each found line in the file by adding a custom registry parameter | ||
| # - writes the output back to the given manifest file | ||
| # | ||
|
|
||
| import json | ||
| import os | ||
| import subprocess | ||
| import sys | ||
|
|
||
| if len(sys.argv) != 3: | ||
| print('Usage: %s <manifest path> <crate-name>' % sys.argv[0]) | ||
|
|
||
| real_file = os.path.realpath(__file__) | ||
| ci_path = os.path.dirname(real_file) | ||
| src_root = os.path.dirname(ci_path) | ||
| cargo_toml = os.path.join(src_root, sys.argv[1]) | ||
| pkg_name = sys.argv[2] | ||
| version = os.environ.get('CI_TAG') | ||
|
|
||
|
|
||
| def load_metadata(): | ||
| cmd = f'{src_root}/cargo metadata --no-deps --format-version=1' | ||
| return json.loads(subprocess.Popen( | ||
| [f"{src_root}/cargo", "metadata", "--no-deps", "--format-version=1"], stdout=subprocess.PIPE).communicate()[0]) | ||
|
|
||
|
|
||
| def get_pkg_deps(package_name): | ||
| metadata = load_metadata() | ||
| dependency_graph = dict() | ||
|
|
||
| for pkg in metadata['packages']: | ||
| dependency_graph[pkg['name']] = [ | ||
| x['name'] for x in pkg['dependencies'] if x['name'].startswith(('solana', 'agave')) and x['source'] is None | ||
| ] | ||
| return dependency_graph[package_name] | ||
|
|
||
|
|
||
| with open(cargo_toml, 'rb', 0) as file: | ||
| data = file.readlines() | ||
| deps = get_pkg_deps(pkg_name) | ||
|
|
||
| for idx, line in enumerate(data): | ||
| split_line = line.decode().split(" =", 1) | ||
| if split_line[0] in deps and not split_line[1].startswith(' { registry'): | ||
| tmp = split_line[1].replace("workspace = true", "version = \"" + version + "\"") | ||
| tmp = tmp.replace("{", '').lstrip() | ||
| data[idx] = bytes(split_line[0] + ' = { registry = "kellnr", ' + tmp, 'utf-8') | ||
|
yihau marked this conversation as resolved.
|
||
|
|
||
| with open(cargo_toml, 'wb') as file: | ||
| file.writelines(data) | ||
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
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
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.
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.
I think this one should happen in the main pipeline or a different pipeline instead of here. some reasons:
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.
We want the release to stop if there's an issue with the crate publishing. That's why I moved this back here.
This test takes over an hour to run, so it's not a good choice to have it run on every PR.
I'll do some more work on making a more targeted check for each crate that we can add to regular CI later.
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.
okay. if we want to to do so, I will suggest that we can use
queue: "solana"instead ofqueue: "release-build".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.
What is the benefit of moving it to the other queue?
I see there's only one agent in the
release-buildqueue. Are you concerned about the check taking up too much time in that queue?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.
the only difference atm is that
release-buildhas some secrets. if you don't need them, you can use other machines for reducing wait time.