Gladear
`Unused dependencies in mix.lock file` after upload, then download `deps` directory
Hello ![]()
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 ![]()
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
_builddirectory too, but when removing it the issue still appears, - If I run
mix deps.getright 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-unusedand 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 ![]()
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
I found the origin of my problem! It was indeed actions/upload-workflow, which does not include hidden files by default
I had to add the parameter include-hidden-files: true, and deps are now copied correctly.
Also Liked
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.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









