Gladear

Gladear

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

Hello :wave:

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

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
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
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New
Codball
Mix format works fine if run from the cmd. I’ve followed this to facilitate the implementation into VSC which involves downloading an ext...
New

Other popular topics Top

albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
sergio
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement