In my Github Action, that is exactly what I do (I think):
name: build
env:
MIX_ENV: test
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
name: Build on Windows
runs-on: windows-2019
env:
CC: gcc
MAKE: make
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
with:
elixir-version: '1.13.x' # Define the elixir version [required]
otp-version: '24.2.x' # Define the OTP version [required]
- name: Install choco
shell: powershell
run: |
Set-ExecutionPolicy -ExecutionPolicy Bypass
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
- name: Install bakeware dependencies
shell: powershell
run: choco install -y zstandard make mingw
- name: Install Dependencies
shell: powershell
run: mix deps.get
- name: Run credo code analyser
shell: powershell
run: mix credo --strict
I am even using powershell to do it (even though I am not really sure if this is needed).
Problem
However my GitHub Actions code comes back with this error:
==> bakeware
mkdir "d:/a/market_manager/market_manager/_build/test/lib/bakeware/obj"
mkdir "d:/a/market_manager/market_manager/_build/test/lib/bakeware/launcher"
mkdir "d:/a/market_manager/market_manager/_build/test/lib/bakeware/obj/zstd/lib/decompress"
mkdir: cannot create directory 'd:/a/market_manager/market_manager/_build/test/lib/bakeware/obj/zstd/lib/decompress': No such file or directory
make: *** [Makefile:70: d:/a/market_manager/market_manager/_build/test/lib/bakeware/obj/zstd/lib/decompress] Error 1
could not compile dependency :bakeware, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile bakeware", update it with "mix deps.update bakeware" or clean it with "mix deps.clean bakeware"
** (Mix) Could not compile with "make" (exit status: 2).
It says it cannot compile with make.
Question
I have tried copy/pasting the section:
env:
CC: gcc
MAKE: make
To every section in that file I could think of, but I always end up with the same issue.
==> bakeware
mkdir "d:/a/market_manager/market_manager/_build/dev/lib/bakeware/obj"
mkdir "d:/a/market_manager/market_manager/_build/dev/lib/bakeware/launcher"
mkdir "d:/a/market_manager/market_manager/_build/dev/lib/bakeware/obj/zstd/lib/decompress"
mkdir: cannot create directory 'd:/a/market_manager/market_manager/_build/dev/lib/bakeware/obj/zstd/lib/decompress': No such file or directory
mingw32-make: *** [Makefile:70: d:/a/market_manager/market_manager/_build/dev/lib/bakeware/obj/zstd/lib/decompress] Error 1
could not compile dependency :bakeware, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile bakeware", update it with "mix deps.update bakeware" or clean it with "mix deps.clean bakeware"
** (Mix) Could not compile with "make" (exit status: 2).
Why do you think it’s the env vars? The error states it is mkdir that is failing. You’ll see that the Makefile tries to handle mkdir differently for Windows.
Could you try to isolate whether it is the CMD run or PowerShell run that is failing, or both?
I have tried to install choco with powershell and then run the commands using cmd. The result is still the same.
This is likely the most vanilla action I can think of, I dont get why something as simple as mkdir would not work.
In this snippet I manually create the needed folders and then I assert on them. The output is as follows:
Directory: D:\a\market_manager\market_manager\_build\test\lib\bakeware
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2/2/2022 11:06 AM obj
d----- 2/2/2022 11:06 AM launcher
Directory: D:\a\market_manager\market_manager\_build\test\lib\bakeware\obj\zstd\lib
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2/2/2022 11:06 AM decompress
True
We can see that:
All directories are created
Test-Path returns True, which means that 'd:/a/market_manager/market_manager/_build/test/lib/bakeware/obj/zstd/lib/decompress' does exist.
This only makes things more confusing to me as the error has still not changed:
mkdir: cannot create directory 'd:/a/market_manager/market_manager/_build/test/lib/bakeware/obj/zstd/lib/decompress': No such file or directory
make: *** [Makefile:70: d:/a/market_manager/market_manager/_build/test/lib/bakeware/obj/zstd/lib/decompress] Error 1
could not compile dependency :bakeware, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile bakeware", update it with "mix deps.update bakeware" or clean it with "mix deps.clean bakeware"
** (Mix) Could not compile with "C:\ProgramData\Chocolatey\bin\make.exe" (exit status: 2).
I really can’t understand the error no such file of directory when every command I used shows beyond reasonable doubt that the folder does exist.
Any ideas or suggestions for investigation would be welcome :S
==> bakeware
mkdir "d:/a/market_manager/market_manager/_build/dev/lib/bakeware/obj"
mkdir "d:/a/market_manager/market_manager/_build/dev/lib/bakeware/launcher"
mkdir "d:/a/market_manager/market_manager/_build/dev/lib/bakeware/obj/zstd/lib/decompress"
mkdir: cannot create directory 'd:/a/market_manager/market_manager/_build/dev/lib/bakeware/obj/zstd/lib/decompress': No such file or directory
mingw32-make: *** [Makefile:70: d:/a/market_manager/market_manager/_build/dev/lib/bakeware/obj/zstd/lib/decompress] Error 1
could not compile dependency :bakeware, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile bakeware", update it with "mix deps.update bakeware" or clean it with "mix deps.clean bakeware"
** (Mix) Could not compile with "make" (exit status: 2).
I wonder if I need some special configuration for my Github Workers that maybe I am not aware of?
In this minimal umbrella app, the github action still fails for windows and Ubuntu.
I am using the exact same file for the github workflow used by bakeware.
I now believe one of 2 things:
my mix.exs file has issues I am not aware of
bakeware has an issue
I am trying to figure out what is going on, but I am having trouble.
Basically, mkdir was not behaving as expected between cmd and powershell.
I am now awaiting for approval of the authors.
Furthermore, I also updated my MWE with the fork in my account so anyone can see it working.