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

[Bug?] Cannot resolve -p with Mill 0.11.6 #3270

Open
zhutmost opened this issue Jan 21, 2024 · 8 comments
Open

[Bug?] Cannot resolve -p with Mill 0.11.6 #3270

zhutmost opened this issue Jan 21, 2024 · 8 comments

Comments

@zhutmost
Copy link

First, thank the developers for your efforts.

I use the Steward GitHub action to manage my Scala projects' dependencies.
I am using some mill 0.11 features in a project, so I bumped the mill-version in my scala-steward-action configurations to 0.11.6.

But the action workflow fails. The following is its log:

Run scala-steward-org/scala-steward-action@v2
  with:
    author-name: GitHub Action
    author-email: [email protected]
    github-app-id: 304424
    github-app-installation-id: 37217608
    github-app-key: ***
  
    github-app-auth-only: true
    repo-config: ./.scala-steward.conf
    repos-file: repos.md
    mill-version: 0.11.6
    cache-ttl: 2hours
    max-buffer-size: 16384
    coursier-cli-url: https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-linux.gz
    github-api-url: https://api.github.com
    github-repository: zhutmost/scala-steward
    github-token: ***
    ignore-opts-files: true
    sign-commits: false
    timeout: 20min
✓ Default Scala Steward configuration set to: ./.scala-steward.conf
✓ Using multiple repos file: repos.md
✓ GitHub App information retrieved from GitHub
✓ Scala Steward workspace created
Trying to restore workspace contents from cache...
  Received 4389 of 4389 (100.0%), 0.1 MBs/sec
  Cache Size: ~0 MB (4389 B)
  /usr/bin/tar -xf /home/runner/work/_temp/1cbd8d7a-4c5b-4433-b96c-87859609440d/cache.tzst -P -C /home/runner/work/scala-steward/scala-steward --use-compress-program unzstd
  Cache restored successfully
  Scala Steward workspace contents restored from cache
Launching scala-steward
  2024-01-21 09:01:22,188 INFO   
    ____            _         ____  _                             _
   / ___|  ___ __ _| | __ _  / ___|| |_ _____      ____ _ _ __ __| |
   \___ \ / __/ _` | |/ _` | \___ \| __/ _ \ \ /\ / / _` | '__/ _` |
    ___) | (_| (_| | | (_| |  ___) | ||  __/\ V  V / (_| | | | (_| |
   |____/ \___\__,_|_|\__,_| |____/ \__\___| \_/\_/ \__,_|_|  \__,_|
   v0.28.0
   
  2024-01-21 09:01:24,510 INFO  Loaded 224 artifact migration(s)
  2024-01-21 09:01:24,869 INFO  Loaded 33 Scalafix migration(s)
  2024-01-21 09:01:25,121 INFO  Loaded 2 repo config(s)
  2024-01-21 09:01:25,595 INFO  Run self checks
  2024-01-21 09:01:25,678 INFO  Using git version 2.43.0
  2024-01-21 09:01:26,531 INFO  Using scalafix 0.11.1
  2024-01-21 09:01:27,470 INFO  Using scalafmt 3.7.17
  2024-01-21 09:01:28,283 INFO  Removing any run-specific files
  2024-01-21 09:01:28,320 INFO  ──────────── Steward zhutmost/chipmunk ────────────
  2024-01-21 09:01:28,323 INFO  Check cache of zhutmost/chipmunk
  2024-01-21 09:01:29,103 INFO  Clone zhutmost/chipmunk
  2024-01-21 09:01:30,332 INFO  Refresh cache of zhutmost/chipmunk
  2024-01-21 09:01:30,513 INFO  Get dependencies in . from Mill
  2024-01-21 09:02:01,358 ERROR Steward zhutmost/chipmunk failed
  org.scalasteward.core.io.process$ProcessFailedException: '"SBT_OPTS=-Xmx2048m -Xss8m -XX:MaxMetaspaceSize=512m" mill -i -p /home/runner/scala-steward/workspace/repos/zhutmost/chipmunk/scala-steward.sc show org.scalasteward.mill.plugin.StewardPlugin/extractDeps' exited with code 1.
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  
    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
   92 50.3M   92 46.4M    0     0   118M      0 --:--:-- --:--:-- --:--:--  118M
  100 50.3M  100 50.3M    0     0   123M      0 --:--:-- --:--:-- --:--:--  123M
  Preparing Java 11.0.21 runtime; this may take a minute or two ...
  [info] compiling 1 Scala source to /home/runner/scala-steward/workspace/repos/zhutmost/chipmunk/out/mill-build/compile.dest/classes ...
  [info] done compiling
  Cannot resolve -p. Try `mill resolve _` to see what's available.
  
  	at org.scalasteward.core.io.process$.$anonfun$slurp$7(process.scala:78)
  	at org.scalasteward.core.io.process$.$anonfun$slurp$7$adapted(process.scala:72)
  	at flatMap @ org.scalasteward.core.io.process$.$anonfun$slurp$5(process.scala:72)
  	at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
  	at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
  	at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
  	at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
  	at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
  	at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
  	at modify @ fs2.internal.Scope.close(Scope.scala:262)
  	at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
  	at rethrow$extension @ fs2.Compiler$Target.$anonfun$compile$1(Compiler.scala:1[57](https://github.com/zhutmost/scala-steward/actions/runs/7600175536/job/20698116078#step:4:57))
  	at as @ org.scalasteward.core.io.process$.$anonfun$readLinesIntoBuffer$1(process.scala:126)
  	at get @ fs2.internal.Scope.openScope(Scope.scala:275)
  	at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:1[63](https://github.com/zhutmost/scala-steward/actions/runs/7600175536/job/20698116078#step:4:63))
  	at flatMap @ fs2.Pull$.$anonfun$compile$21(Pull.scala:1215)
  	at update @ fs2.internal.Scope.releaseChildScope(Scope.scala:224)
  2024-01-21 09:02:01,3[69](https://github.com/zhutmost/scala-steward/actions/runs/7600175536/job/20698116078#step:4:69) INFO  ──────────── Total time: Steward zhutmost/chipmunk: 33s 41ms ────────────
  2024-01-21 09:02:01,384 INFO  ──────────── Total time: run: 35s [78](https://github.com/zhutmost/scala-steward/actions/runs/7600175536/job/20698116078#step:4:79)9ms ────────────
Error:  ✕ Launching scala-steward failed

I guess the key is that "Cannot resolve -p. Try mill resolve _ to see what's available."
but I have no idea how to fix it. Does someone have any ideas?

@zhutmost
Copy link
Author

The workflow configuration yaml is like this:

# Workflow to upgrade the Scala dependencies automatically

on:
  workflow_dispatch:
  schedule:
    - cron: '0 0 * * 0'

name: Upgrade Scala Dependencies with Steward

jobs:
  scala-steward:
    runs-on: ubuntu-latest
    name: Launch Scala Steward
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Launch Scala Steward
        uses: scala-steward-org/scala-steward-action@v2
        with:
          author-name: "GitHub Action"
          author-email: "[email protected]"
          github-app-id: "*******"
          github-app-installation-id: "*******"
          github-app-key: ${{ secrets.APP_PRIVATE_KEY }}
          github-app-auth-only: 'true'
          repo-config: "./.scala-steward.conf"
          repos-file: 'repos.md'
          mill-version: '0.11.6'

@fthomas
Copy link
Member

fthomas commented Jan 22, 2024

It looks like Scala Steward ran code for Mill < 0.11 to extract dependencies. Does the zhutmost/chipmunk repo has a .mill-version and does it contain a version >= 0.11?

@zhutmost
Copy link
Author

No, I don't specify a mill version in my project.
And because I use some 0.11 API in my build.sc, it will throw another error (xxx type not found) when running with mill 0.10.x.

@fthomas
Copy link
Member

fthomas commented Jan 22, 2024

Sounds like a .mill-version with a 0.11 version would fix this issue then.

@zhutmost
Copy link
Author

I read the code referenced by you. Are you sure Mill 0.11 has an option "-p"?

It looks like Scala Steward ran code for Mill < 0.11 to extract dependencies. Does the zhutmost/chipmunk repo has a .mill-version and does it contain a version >= 0.11?

@fthomas
Copy link
Member

fthomas commented Jan 22, 2024

If you add .mill-version with a 0.11 version, it will run this code.

@zhutmost
Copy link
Author

Ok, let me try. And the configuration mill-version in github action does not take effect?

Run scala-steward-org/scala-steward-action@v2
  with:
    mill-version: 0.11.6 // *******************this line
    ....

@olivierdeckers
Copy link
Contributor

adding a .mill-version file works, but specifying the mill-version argument in the action as @zhutmost mentions still triggers the pre 0.11 code path.
This code doesn't seem to be taking that github-actions argument into account, looking only at files:

private def getMillVersion(buildRootDir: File): F[Option[Version]] =

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

No branches or pull requests

3 participants