Comments (23)
This environment variable might also be interesting:
https://github.com/borkdude/deps.clj#deps_clj_tools_version
from setup-clojure.
The exit code for PowerShell launches directly from GitHub Actions is handled properly, but if you call clojure yourself from a script you have to be aware of this:
TIL, (I am powershell naive, so maybe obvious to most of you):
If you runpowershell -command my-command
the exit code frommy-command
is not returned to the caller.
For that you need tag on anexit $LASTEXITCODE
, like:
powershell -command "my-command;exit $LASTEXITCODE"
Kind of important if you are wanting to know about little things like test failures.
I don't have specific examples of escaping woes, but I've felt them.
I do see an old slack post from me about me about trying to install clojure core team cli:
For what it is worth, I had a pleasant experience experimenting with @borkdude’s deps.clj (using its deps.exe) when setting up testing of rewrite-cljc on GitHub Actions on Windows. I was even bold enough to rename deps.exe to
clojure.exe
. I did initially try installing the official alpha Clojure PowerShell module, but GitHub Actions did not see the module, so I gave up, admittedly, rather quickly. Using a renamed deps.clj allowed me the luxury of calling clojure easily from any shell.
I think you've solved the installation part of this problem with your setup-clojure Action, but not the easily "runnable from any shell" part.
If you want a blurb for the README, maybe something like?:
cmd-exe-workaround
Some people bump into challenges using the clojure core team alpha cli
on Windows because it is runnable only from Powershell. Launching a Powershell module from a script can make such things as argument escaping and exit code capturing extra tricky. For these people, we offer cmd-exe-workaround
to instead install borkdude/deps.clj's deps.exe
as clojure.exe
when on Windows.
from setup-clojure.
Well, I think that is mostly the case since deps.clj as a binary it solves a problem on Windows mostly.
from setup-clojure.
The latest version got a fix to run clojure tools deps on windows the same way as on other platforms. https://github.com/DeLaGuardo/setup-clojure/blob/main/.github/workflows/smoke-tests.yml#L31-L52
from setup-clojure.
Thanks for the reply!
By cli, you mean the Clojure official Windows PowerShell module, right?
Can I still use borkdude's deps.exe (renamed to clojure) on Windows?
Or are you saying that cli
automatically uses deps.exe on Windows?
(Sorry if the answer is obvious, I'm feeling a little not-so-bright here! 🙂)
from setup-clojure.
I've never written a GitHub Action, so I am probably missing something, but I don't see anything calling getLatestDepsClj.
from setup-clojure.
Right, getLatestDepsClj is not used anymore. Instead, when you use input cli: %version%
for windows platform, it will install official Windows PowerShell Module into the directory visible for powershell and pwsh (default shell for github action runner on windows). That means previously required option shell: powershell
is not needed anymore. Run step using clojure
command line will recognise correctly where binary is installed without additional options.
jobs:
run-clojure-cli:
strategy:
matrix:
# note all three available platforms
os: [ubuntu-latest, macOS-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'
- name: Install Clojure CLI
uses: DeLaGuardo/[email protected]
with:
cli: 1.10.1.693
# step uses clojure command is the same across all platforms
- name: Execute clojure code
run: clojure -e "(+ 1 1)"
from setup-clojure.
Ah, thanks for the clarification!
I use @borkdude's deps.exe
as clojure.exe
to avoid many headaches on Windows.
I think the setup-clojure action was briefly offering this as an option?
Anyway, these days I can always use bb clojure
on Windows instead.
from setup-clojure.
deps.exe
was there as a workaround, yes. But the code to install it is here, so it would be easy to reintroduce it. Do you know some place where I can read about the headaches you mention? I would like to evaluate them and bring back an option to install deps.exe
or find a way to avoid most problems.
from setup-clojure.
Another reason you might want to use deps.exe
as clojure.exe
is shelling out: when shelling out with ProcessBuilder
or babashka.process
for that matter, it just works whereas with the Powershell installation you have to write pwsh.exe -c 'clojure ...'
or equivalent (not exactly sure what the command is, but you get the idea).
from setup-clojure.
interesting, thanks! Btw. pwsh.exe
is the default shell for windows based runners, so adding pwsh.exe -c '...'
should not be necessary with [email protected]
from setup-clojure.
Yes, I'm talking about shelling out from e.g. a clojure program or bb script, not in the Github Actions "code".
from setup-clojure.
got it. That sounds like a good reason to add deps.exe
to the set of tools available to install. thanks!
from setup-clojure.
Yes, what @borkdude said 🙂.
Figuring out argument escaping on Windows is difficult and made more painful when shelling out with Powershell. Capturing the exit code in these cases is also non-obvious for those who aren't Powershell experts.
If/when you do re-add deps.exe as clojure.exe on Windows, it would be extra convenient if I could express I'd like to use this on Windows without repeating a setup-clojure
with a GitHub Actions if
for Windows. I think your cmd-exe-workaround:
would allow this if it were understood that it overrides cli:
?
from setup-clojure.
yes, it will install clojure
command overtaking the cli:
input.
Btw. could you share an example of the process that is hard to grok on windows with "official powershell cli"? Then I can add it to the test suite to capture regressions, if any
from setup-clojure.
thanks!
from setup-clojure.
Afterthought: cmd-exe-workaround
might be a bit of an odd name with the direction we seem to be going in?
Maybe: deps-exe-cli
instead?
from setup-clojure.
or deps.clj
?
from setup-clojure.
I was thinking exe
to hint it would be only active on Windows.
And cli
to hint that it overrides any cli
specification.
But if this holds true, maybe there is a clearer way to represent this.
Is it shortsighted of me to assume deps.clj only on Windows? Would someone find a case where they wanted to use a deps.clj
binary on another OS?
from setup-clojure.
Is it shortsighted of me to assume deps.clj only on Windows? Would someone find a case where they wanted to use a deps.clj binary on another OS?
On Slack @borkdude mentioned:
FWIW I never had anyone ask me to provide a deps.exe for a different architecture
from setup-clojure.
In that context, I meant Windows: not ever has someone request e.g. an aarch64 binary for deps.exe on Windows.
from setup-clojure.
Ah, thanks! I wrongly assumed you meant that folks only used the deps binary on Windows.
from setup-clojure.
I think you could now try clj-msi as the workaround on Windows:
https://github.com/casselc/clj-msi/releases
This packages deps.clj as clj.exe
and clojure.exe
and installs it on your PATH. This might become the official installer for Clojure on Windows in the future.
from setup-clojure.
Related Issues (20)
- Failed due to HTTP 404 of cljstyle HOT 1
- 404 on cljstyle HOT 3
- leiningen classpath not set correctly HOT 6
- boot support for MS-Windows HOT 10
- Clojure install error after boot.exe/cache update HOT 2
- Clojure cli tools are not available on the Windows pwsh shell HOT 1
- Consider moving `pre` logic to the main entrypoint
- Version 9.3 doesn't find bb in a monorepo HOT 2
- Support for arm64 runners
- invalidate-cache: true doesn't work on self-hosted runners
- latest for cli should only use latest stable version HOT 3
- Add annotations similar to clojure-lint-action HOT 1
- Use lein.bat on Windows rather than Powershell HOT 4
- Update to node 16+ HOT 3
- "Bad Credentials" fetching clj-kondo HOT 5
- Clojure CLI downloads are moving to Github releases HOT 4
- Builds failing due to HTTP 404 HOT 2
- Request: add polylith tool to the list of tools that can be installed HOT 3
- API Rate Limit exceeded errors HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from setup-clojure.