I am currently implementing a simple test program for my small project in GitHub, But I'm having trouble running that same test program in the CI workflow in a runs-on: windows-latest
environment.
For the linux
job I don't have any problem.
But I can't figure out how to run the executable in windows
. it's giving me an exit code error 1:
mingw32-make: *** [makefile:33: run_test] Error -1073741511 Error: Process completed with exit code 1.
Here is the .yml
file that I'm currently using.
name: tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: compile tests
run: make test CXX=g++
- name: run tests
run: make run_test
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: compile tests
run: make test CXX=g++
- name: run tests
run: make run_test
This is the portion of the makefile
for running the test program.
run_test:
@echo running test program
ifeq ($(OS), Linux)
./$(OUTPUT_NAME).$(EXTENSION)
else
.\$(OUTPUT_NAME)
endif
I also tried to edit the line in the makefile that runs the executable to other forms like given below:
.\$(OUTPUT_NAME).$(EXTENSION)
./$(OUTPUT_NAME).$(EXTENSION)
./$(OUTPUT_NAME)
./$(OUTPUT_NAME)
$(OUTPUT_NAME).$(EXTENSION)
$(OUTPUT_NAME)
But still these attempts is giving me either an exit error code 1 or error exit code 2.
I also tried to run
- name: run tests
shell: cmd
run: make run_test
and just use $(OUTPUT_NAME)
in the makefile but still no success.
[EDIT]
The compilation for windows-latest
environment (compile test) works perfectly fine, The only problem that I encounter is I cannot run that compiled executable.
GitHubs windows-latest
which is currently equivalent to windows-2022
(at the time of writing) by default does not include the necessary DLL paths needed in the environment variables, so when we compile our program it actually produces an invalid executable that will not run when executed.
In the GitHub issues above, some are suggesting to manually add these DLLs by yourself which could fix the problem.
We can also use an older windows-2019
as our runner instead of windows-latest
since this runner by default has the necessary DLL files needed to correctly compile and run our executable, this is the easiest solution that I have seen.
name: tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
windows:
# ...
runs-on: windows-2019
# ...