-
Notifications
You must be signed in to change notification settings - Fork 114
Add support for github refs when downloading Ark #7645
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Prevent GitHub Repo References in Package.json | ||
|
||
on: | ||
pull_request: | ||
branches: [main, release/*, prerelease/*] | ||
paths: | ||
- "extensions/positron-r/package.json" | ||
push: | ||
branches: [main, release/*, prerelease/*] | ||
paths: | ||
- "extensions/positron-r/package.json" | ||
|
||
jobs: | ||
check-repo-references: | ||
name: Check for GitHub Repo References in Ark Version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Check for repo references in package.json | ||
run: | | ||
echo "Checking for GitHub repo references in package.json" | ||
|
||
# Extract the Ark version from package.json using jq | ||
ARK_VERSION=$(jq -r '.positron.binaryDependencies.ark // empty' extensions/positron-r/package.json) | ||
|
||
# Check if the extracted version follows the GitHub reference pattern | ||
if [[ "$ARK_VERSION" =~ ^[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+@[a-zA-Z0-9._\/-]+ ]] then | ||
echo "::error::GitHub repo reference found in extensions/positron-r/package.json: $ARK_VERSION" | ||
echo "GitHub repo references (org/repo@revision format) are only for development and should not be used in main or release branches." | ||
exit 1 | ||
else | ||
echo "No GitHub repo references found in extensions/positron-r/package.json" | ||
fi |
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,68 @@ | ||
# Positron R Extension Scripts | ||
|
||
## `install-kernel.ts` | ||
|
||
This script handles downloading and installing the Ark R kernel, which is used by the Positron R extension to execute R code. | ||
|
||
|
||
### Installation Methods | ||
|
||
#### Release Mode (Production Use) | ||
|
||
- Downloads pre-built binaries from GitHub releases | ||
- Uses a semantic version number like `"0.1.182"` | ||
- Example in package.json: | ||
```json | ||
"positron": { | ||
"binaryDependencies": { | ||
"ark": "0.1.182" | ||
} | ||
} | ||
``` | ||
|
||
|
||
#### Local development mode | ||
|
||
For kernel developers working directly on the Ark kernel, the script will check for locally built versions in a sibling `ark` directory before attempting to download or build from source. | ||
|
||
Note that this has precedence over downloading Ark based on the version specified in `package.json` (both release and github references). | ||
|
||
|
||
#### CI development Mode | ||
|
||
- Clones and builds the Ark kernel from source using a GitHub repositoryreference | ||
- Uses the format `"org/repo@branch_or_revision"` | ||
- Examples in package.json: | ||
```json | ||
"positron": { | ||
"binaryDependencies": { | ||
"ark": "posit-dev/ark@main" // Use the main branch | ||
"ark": "posit-dev/ark@experimental-feature" // Use a feature branch | ||
"ark": "posit-dev/ark@a1b2c3d" // Use a specific commit | ||
"ark": "posit-dev/ark@v0.1.183" // Use a specific tag | ||
} | ||
} | ||
``` | ||
|
||
The repository reference format (`org/repo@branch_or_revision`) should only be used during development and never be merged into main or release branches. A GitHub Action (`prevent-repo-references.yml`) enforces this restriction by checking pull requests to main and release branches for this pattern. | ||
|
||
|
||
### Authentication | ||
|
||
When accessing GitHub repositories or releases, the script attempts to find a GitHub Personal Access Token (PAT) in the following order: | ||
|
||
1. The `GITHUB_PAT` environment variable | ||
2. The `POSITRON_GITHUB_PAT` environment variable | ||
3. The git config setting `credential.https://api.github.com.token` | ||
|
||
Providing a PAT is recommended to avoid rate limiting and to access private repositories. | ||
|
||
|
||
## `compile-syntax.ts` | ||
|
||
This script compiles TextMate grammar files for syntax highlighting. | ||
|
||
|
||
## `post-install.ts` | ||
|
||
This script performs additional setup steps after the extension is installed. |
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.
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.
Since this is for development only, would the debug build be preferable?
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 thought so as well but: posit-dev/ark#619
By the way, when R crashes the only symptom surfacing from
startLanguageRuntime()
is an error about "http request failed". I assume this is from supervisor. https://github.com/posit-dev/positron/actions/runs/16799688806/job/47580232540#step:12:448Would it be helpful to open an issue about this?