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

Add support for github packages :octocat: #109

Merged
merged 1 commit into from
Dec 27, 2022
Merged

Add support for github packages :octocat: #109

merged 1 commit into from
Dec 27, 2022

Conversation

jmackie
Copy link
Member

@jmackie jmackie commented Dec 26, 2022

Extends the PackageSpec type to support GitHub repositories and updates the install logic.

A GitHub package dependency is specified like:

[package-set.packages.js-ref]
github = { owner = "ditto-lang", repo = "js-ref" }     # inspired by Nix's fetchFromGitHub
revision = "fb8a458da5a9394afc199974ed880bf9e99c7571"
sha256 = "a25b7f0f65ce48157ca6ff536b675c7fdd1383c6b901991257328bbd6189cf3d"

The install logic is then:

  1. GET https://github.com/{github.owner}/{github.repo}/archive/{revision}.zip
  2. Check that the sha256 matches
  3. Store the downloaded zip archive in the cache, using the sha256 as the key (much like Nix)
  4. Unpack contents of the archive into the current project's package directory

And if the entry already exists in the cache, we skip straight to 4.

@codecov
Copy link

codecov bot commented Dec 26, 2022

Codecov Report

Merging #109 (e054746) into main (445761e) will decrease coverage by 0.63%.
The diff coverage is 3.75%.

@@            Coverage Diff             @@
##             main     #109      +/-   ##
==========================================
- Coverage   85.12%   84.48%   -0.64%     
==========================================
  Files          83       83              
  Lines       14942    15062     +120     
==========================================
+ Hits        12719    12725       +6     
- Misses       2223     2337     +114     
Impacted Files Coverage Δ
crates/ditto-cli/src/pkg.rs 2.29% <0.00%> (-0.94%) ⬇️
crates/ditto-config/src/package_set.rs 83.33% <100.00%> (+0.98%) ⬆️
crates/ditto-config/src/tests.rs 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jmackie jmackie merged commit 2079565 into main Dec 27, 2022
@jmackie jmackie deleted the github-package-support branch December 27, 2022 09:40
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.

1 participant