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

feat: allow git remote repositories (https) as project locations #152

Merged
merged 4 commits into from
Jun 5, 2023

Conversation

Angelmmiguel
Copy link
Contributor

@Angelmmiguel Angelmmiguel commented Jun 2, 2023

Add support for git repositories as valid project locations. Now you can run a project directly from a remote repository. There are different options to configure the git repository. These are all the new options:

--git-commit <GIT_COMMIT>  Set the commit when using a git repository as project
--git-tag <GIT_TAG>        Set the tag when using a git repository as project
--git-branch <GIT_BRANCH>  Set the branch when using a git repository as project
--git-folder <GIT_FOLDER>  Change the directory when using a git repository as project

Here you have an example:

$ cargo run -- https://github.com/vmware-labs/wasm-workers-server.git --git-folder "examples/js-basic"
⚙️  Preparing the project from: https://github.com/vmware-labs/wasm-workers-server.git
⚙️  Loading routes from: /tmp/dd21e3cd6d0f515301e1c7070e562af06074d9e8d10566179f97dba47e74cec9/examples/js-basic
⏳ Loading workers from 1 routes...
✅ Workers loaded in 2.113770416s.
    - http://127.0.0.1:8080/
      => /tmp/dd21e3cd6d0f515301e1c7070e562af06074d9e8d10566179f97dba47e74cec9/examples/js-basic/index.js
🚀 Start serving requests at http://127.0.0.1:8080

It closes #147

Install missing language runtimes

Some workers require specific runtimes. For example, you need to download a Python or Ruby runtime to develop workers based on these languages. wws stores this information in the .wws.toml, so you can install them with wws runtimes install.

When pulling a repository is convenient to install the missing runtimes directly. However, we may not want to make this the default behavior as you need to download "arbitrary" binaries for Internet. For this reason, I added an option to install runtimes automatically, so you can enable it for projects you trust:

$ wws https://github.com/vmware-labs/wasm-workers-server.git --git-folder "examples/js-basic" --install-runtimes
$ # Or
$ wws https://github.com/vmware-labs/wasm-workers-server.git --git-folder "examples/js-basic" -i

@Angelmmiguel Angelmmiguel added the 🚀 enhancement New feature or request label Jun 2, 2023
@Angelmmiguel Angelmmiguel requested a review from a team June 2, 2023 09:29
@Angelmmiguel Angelmmiguel self-assigned this Jun 2, 2023
@Angelmmiguel Angelmmiguel added this to the v1.3.0 milestone Jun 2, 2023
Copy link
Contributor

@ereslibre ereslibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Very nice feature! LGTM, some comments from my side :)

crates/project/src/options.rs Outdated Show resolved Hide resolved
crates/project/src/types/git.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Show resolved Hide resolved
src/utils/runtimes.rs Outdated Show resolved Hide resolved
src/utils/runtimes.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@ereslibre ereslibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @Angelmmiguel!

Comment on lines +36 to +38
if let Some(options) = options {
if let Some(git) = options.git {
if let Some(git_ref) = git.git_ref {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been looking for a better way to express this, but it requires let_chains and is unstable. :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, a new approach for "let chains" would be really great 😄. I will keep an eye on this. Thanks for the pointer.

@Angelmmiguel Angelmmiguel merged commit 0d70c87 into main Jun 5, 2023
@Angelmmiguel Angelmmiguel deleted the 147-load-remote-git-repos branch June 30, 2023 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run a project from a remote repository
3 participants