GitHub Actions checkout#v3: where is repo downloaded? - github-actions

I am working with GitHub Actions to build code on Windows, Linux, and MacOS. I use actions/commit#v3 #actions/checkout#v3 to download my repo to each server. However, I do not know where the repo gets downloaded. I have to curl other files and add them to the repo folder for the build to work.
Does anyone know where repos are downloaded on each server (Windows, Linux, and MacOS) with actions/commit#v3 #actions/checkout#v3? I'm having trouble finding anything in the documentation. If the path is set in an environment variable, I would prefer to use that instead of hard coding the path for each server.

The environment variable you're looking for is GITHUB_WORKSPACE.
The default working directory on the runner for steps, and the default location of your repository when using the checkout action. For example, /home/runner/work/my-repo-name/my-repo-name.
Source: https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables

Related

Github Action how to deal with standalone config file

We are using Github Action to deploy our code. On push, the source code will be pushed and we were able to build the code and deploy successfully if the config file is also tracked by the repository. However, we are encountering a problem with a config file in .gitignore.
Our app has different versions, controlled by this config file, and also this file is different from testing to production. Therefore, this file is standalone and not tracked by the git repository. However, for Github actions to build the project correctly, this file is necessary and has to be placed on a certain path of the project, e.g., /configs/env_configs.json.
This seems like a very common use case but I find very little information in Github action's document.
Is there a good way to work this out?

Can I use opam to make a package out of a local file and install it?

I'm new to opam and trying to figure out how to use it properly. For a class, I want to set up students with an environment that has some custom packages installed. (The package will consist of some raw .ml files that I got from a colleague at another school; the files are on their github but there's no .opam file that I can see, and as far as I know they're not in any official package release.)
Can I somehow call these local .ml files a package and ask opam to install it? Do the files have to be on github first, and if so can I use my colleague's existing repository as the source? I don't want to make any of this public, since it is not my own work; I just want to configure my local environment so that the code in the files can be included easily as a package. Basically I don't know the best way to proceed so I'm happy for any advice.
You can add a custom opam file in the base directory of the project. See the documentation for how to create that file.
Then you can enter opam pin add . in the base directory and your project will be installed as if it was an opam package. Check opam pin --help for more info (you can also pin to a remote git project for instance).
Note that though the default repository is hosted on github, this is in no way a requirement for opam. Opam is dependent on git but you can absolutely use it with a private git repository. If you want to use your colleague's repository as the source, that is totally doable though it is often preferable to have the opam file at the root of the directory (you can do a PR on their repository or make your own fork of it on github, the site makes it clear you copied the code).
If pinning is not to your taste, you can also create your own repository though this is probably a bit too heavyweight for your needs.
Good luck!

Uploading remote server files after git checkout

I am using phpstorm 7 on my windows host for a git project. The files are synced with a VM via phpstorm's remote server feature, so each time a save is made, the changed file is also upoloaded to my VM.
I am having difficulties when I am pulling newer versions from Git because the only way to send the changed files to my VM is to upload a full copy of the project via phpstorm. Or of course I can send them individually but it also takes too much effort.
So my question is if there is a feature or plugin for phpstorm which automatically uploads only the changed files after a git checkout.
Thank you!
You can :
sync src code with option deployement to delete the file that no existing in target location
create a external tools for sync
create macro that launch a git pull and after launch a sync
create external tools for sync AND others for pulling git branch
When you create a macro or external tools don't forget that you can launch those with a shortcut.

Jenkins projects pointing to same Mercurial repo do not share source

I am using Jenkins for our build server. I have multiple projects using the same Mercurial (Hg) repository and want to avoid each project cloning it's own local repo to build from (since the repo is rather large). This is supposed to be possible via Jenkins and the Mercurial plugin.
In my Mercurial plugin configuration I have checked both "Use Repository Caches" and "Use Repository Sharing". In each project, the same repository location (a network location specified via IP address) is listed.
However, each project still seems to want to create a clone of the repository. Any ideas?
In our setup (using Jenkins 1.506), I've defined a custom workspace under the Advanced Project Options for each of my builds, typically at [project]\repo and then build from there into a \build\ folder.
If you define the custom workspace for each Jenkins project to point to the same shared custom workspace using the same source for the repo it will reuse what is already there.
I've not tested this, but I would assume that under this setup, it is important to prevent concurrent builds from occurring in the same working directory. Bad things would follow.
As a followup question: What is your rationale for not wanting each build to have its own source code?

How to clone a local repository using PyCharm

I'm currently using PyCharm but finding impossible to checkout or clone from a local Mercurial repository.
In the Clone Mercurial Repository dialog, you can put an URL to clone from, and works ok with HTTP URLs, but I'm clueless about how to do it from a local repository.
I've tried putting file:// before the absolute path, but PyCharm keeps telling me no repository found there, so I have to open the console, clone, setup project, etc.
There must be a way, every other IDE I've used allows to do it
Thanks and regards!
It works for me:
It doesn't need "file://", just type in the path.
Are you on Windows or Linux/Mac?
Maybe, you use the "tilda" sign (~) for the home directory? This dialog doesn't understand tildas.
Also note, that you have to specify the path to the Mercurial root, not to the ".hg" directory itself.
Please share your path so that we could see, what can be treated incorrectly there.