DeLaGuardo / setup-clojure

GitHub Action to provision clojure's most popular build tools for Linux, Mac OS X and Windows.
MIT License
184 stars 27 forks source link

leiningen classpath not set correctly #103

Closed pieterbreed closed 8 months ago

pieterbreed commented 8 months ago

I'm impacted by leiningen 2.11.0 breaking some plugins, and need to force lein 2.10.0 for now.

NOTE: This issue is not about the classpath for my project. The issue is the classpath from which the leiningen jar is found.

Here is my github actions configuration:

name: booboo
on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: actions/setup-java@v3
      with:
        distribution: "corretto"
        java-version: "17"
        # cache: "maven"
        # cache-dependency-path: 'clj/project.clj'
    - uses: DeLaGuardo/setup-clojure@12.3
      with:
        lein: 2.10.0
    - name: Run tests
      run: cd clj; which lein; DEBUG=true lein test

The output shows like this:

Run DeLaGuardo/setup-clojure@12.3
  with:
    lein: 2.10.0
    github-token: ***
    invalidate-cache: false
  env:
    JAVA_HOME: /opt/hostedtoolcache/Java_Corretto_jdk/17.0.10-7.1/x64
    JAVA_HOME_17_X64: /opt/hostedtoolcache/Java_Corretto_jdk/17.0.10-7.1/x64

/home/runner/work/_temp/temp_1735711811/leiningen/bin/lein version
Downloading Leiningen to /home/runner/work/_temp/temp_1735711811/leiningen/self-installs/leiningen-2.10.0-standalone.jar now...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  1 12.1M    1  173k    0     0   706k      0  0:00:17 --:--:--  0:00:17  706k
100 12.1M  100 12.1M    0     0  22.4M      0 --:--:-- --:--:-- --:--:-- 40.6M
/home/runner/work/_temp/temp_17357118)11/leiningen/self-installs/leiningen-2.10.0-standalone.jar.pending: OK
Leiningen 2.10.0 on Java 17.0.10 OpenJDK 64-Bit Server VM
/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/bridge-telemetry/bridge-telemetry --files-from manifest.txt --use-compress-program zstdmt
Cache Size: ~11 MB (11424450 B)
Cache saved successfully

so far so good... then

> Run cd clj; which lein; DEBUG=true lein test
  cd clj; which lein; DEBUG=true lein test
  shell: /usr/bin/bash -e {0}
  env:
    JAVA_HOME: /opt/hostedtoolcache/Java_Corretto_jdk/17.0.10-7.1/x64
    JAVA_HOME_17_X64: /opt/hostedtoolcache/Java_Corretto_jdk/17.0.10-7.1/x64
    LEIN_HOME: /opt/hostedtoolcache/Leiningen/2.10.0-12-3/x64
/opt/hostedtoolcache/Leiningen/2.10.0-12-3/x64/bin/lein
Leiningen's classpath: /usr/local/lib/lein/self-installs/leiningen-2.11.1-standalone.jar
...

Kindly note the line reading Leiningen's classpath, showing leiningen-2.11.1-standalone.jar.

As a result, I'm still impacted by the bug in lein's 2.11.1 version.

DeLaGuardo commented 8 months ago

Looks like there is now leiningen preinstalled to action runners. And it is 2.11.1 https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md?plain=1#L89

It is taking precedence over executable installed by this action. Good news — this is fixable. I'll release a new version in a few days. As a workaround you can use full path to installed leiningen binary $LEIN_HOME/bin/lein as an executable for your task

pieterbreed commented 8 months ago

Hi @DeLaGuardo , thank you for the response and willingness to supply a fix. Unfortunately the work-around is not effective. It still finds and uses the OS-installed leiningen uberjar when invoked like this.

Run cd clj; echo LEIN_HOME=$LEIN_HOME; DEBUG=true $LEIN_HOME/bin/lein test
  cd clj; echo LEIN_HOME=$LEIN_HOME; DEBUG=true $LEIN_HOME/bin/lein test
  shell: /usr/bin/bash -e {0}
  env:
    JAVA_HOME: /opt/hostedtoolcache/Java_Corretto_jdk/17.0.10-7.1/x64
    JAVA_HOME_17_X64: /opt/hostedtoolcache/Java_Corretto_jdk/17.0.10-7.1/x64
    LEIN_HOME: /opt/hostedtoolcache/Leiningen/2.10.0-12-3/x64
LEIN_HOME=/opt/hostedtoolcache/Leiningen/2.10.0-12-3/x64
Leiningen's classpath: /usr/local/lib/lein/self-installs/leiningen-2.11.1-standalone.jar
DeLaGuardo commented 8 months ago

Right, I just realise that there is LEIN_JAR env variable that points to the exact path to installed leiningen executable. https://github.com/DeLaGuardo/setup-clojure/actions/runs/7832883060/job/21372587378#step:3:115

DeLaGuardo commented 8 months ago

For some reason unsetting this var doesn't fix the issue. But I confirm that 2.9.1 leiningen works. Proper fix for newest versions will take a day to be merged.

DeLaGuardo commented 8 months ago

@pieterbreed should be fixed by 12.4 Please update and let me know if it doesn't work for you

pieterbreed commented 8 months ago

Fixed the issue, thank you for the quick turn-around. 👍