Gladear

Gladear

`Unused dependencies in mix.lock file` after upload, then download `deps` directory

Hello :waving_hand:

I’ve been struggling with GitHub Actions lately. I’m trying to parallelize my tests, and this includes building the project once, and then starting more tests. To achieve that, I tried to use GHA artifacts to move the built project from one job to another, but I’m having trouble with that.

Basically, in the first job I download the dependencies, build the project, upload deps directory to GitHub as an artifact. All good up to this point :ok_hand:
However, when I download the artifact and try to run my first test mix deps.unlock --check-unused, I get an Unused dependencies in mix.lock file .

Things I tried

  • At first, I uploaded the _build directory too, but when removing it the issue still appears,
  • If I run mix deps.get right after downloading, some dependencies are updated - and then the job goes on without issue,
  • use a different command after downloading, but they always end up in errors, for apparently the same reason (some deps are outdated),
  • after cleaning up the project, I tried to run mix deps.get; zip -r archive.zip deps; rm -rf deps; unzip archive.zip; mix deps.unlock --check-unused and it worked well

It may be important to note that the artifact upload/download archives and unarchives the files. Sooo, I’m wondering if mix uses some information about these files that are lost in the archiving process, like the time of creation or update or something, and if there’s a workaround to fix this - or maybe I’m just doing something wrong, but I have no idea what :smile:

Workflow file excerpt

This is the simplest workflow file I could come up with to reproduce the problem.

[...]

env:
  # Ensure everything is run in the test environment,
  # avoiding multiple compilations of the same code.
  MIX_ENV: test

jobs:
  build:
    name: Build project
    runs-on: ubuntu-22.04

    steps:
      - uses: actions/checkout@v3
      - name: Setup up Elixir
        uses: ./.github/workflows/composite/setup-elixir
      - run: mix deps.get --check-locked
      - name: Upload build artifacts
        uses: actions/upload-artifact@v4
        with:
          name: build
          path: |
            deps
          if-no-files-found: error

  validate:
    name: Validate code
    runs-on: ubuntu-22.04
    needs: build

    steps:
      - uses: actions/checkout@v3
      - name: Setup up Elixir
        uses: ./.github/workflows/composite/setup-elixir
      - uses: actions/download-artifact@v4
        with:
          name: build
      - name: Run code validation
        run: mix deps.unlock --check-unused

Thanks in advance for you input!

Marked As Solved

Gladear

Gladear

I found the origin of my problem! It was indeed actions/upload-workflow, which does not include hidden files by default :sweat_smile: I had to add the parameter include-hidden-files: true, and deps are now copied correctly.

Also Liked

timothy

timothy

Your mix.lock file contains a (sub)dependency that isn’t used (not defined in mix.exs or defined by another dependency in mix.exs). You can remove those entries from the lock file using

mix deps.clean --unlock --unused.

Where Next?

Popular in Questions Top

chokchit
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New

Other popular topics Top

New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39467 209
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement