Github actions build exe with cmake+msvc has no icon

Here is my demo repo https://github.com/xiaozhuai/test_github_actions

I use github actions for building. But on windows, the exe icon disapeared. No errors.
On my local machine, it works fine. I can’t figure out why this happen.

See https://github.com/xiaozhuai/test_github_actions/actions/runs/134971370

Everything is fine but the exe has no icon. : (

Hi @xiaozhuai ,
What’s the operating system of your local machine? Have you tried on windows machine?
I tested your sample code in my windows machine, the exe icon is not the rocket but the default icon of exe file on windows os.
cmake

1 Like

I’m on windows 2019 LTSC with latest Visual Studio Build Tools (Only build tools, not install Visual Studio).
On my local machine, the exe file has the right icon(The rocket). On github action, all fine without error, but no icon(Windows default application icon). Just like your pic. Your can try build this demo manually.

call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
git clone https://github.com/xiaozhuai/test_github_actions
cd test_github_actions
md build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" ..
nmake

On my local machine

The screenshot I provided before is the result I built the demo manually using the same command as you provided above.


The different is I am on windows 10 , Version 10.0.18362 Build 18362.
The GitHub hosted windows machine for tag windows-latest is Windows Server 2019.
To figure out whether this icon issue is related to the system, would you mind adding a self-hosted runner in your local machine?

OK, I will try this later. Thanks!

I try self-hosted runner on my local machine, all works fine.
The difference is that I use Visual Studio Build Tools, not Visual Studio Enterprise.
So I make some change to yaml

-                    call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
+                    call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars32.bat"

see https://github.com/xiaozhuai/test_github_actions/actions/runs/137306032

I tried to download the windows x64 exe (https://github.com/xiaozhuai/test_github_actions/suites/803726730/artifacts/8694779) from your workflow run artifacts, the exe uses the default exe icon on windows.


What’s the result if you download the artifact to your local machine?
If the exe download from github has the right icon on your local machine, the issue is more related to the operating system .

@yanjingzhu Yes, on my machine, it has icon…
What happens…
Or how can I do to make github actions build the exe with right icon?

I tried to download your artifacts again. After I extract the zip folder, the icon show correctly in my machine.
To be honest, I am not familiar with cMake . Would you mind opening a new ticket in cMake forum asking whether the exe icon behavior is related to operating system?

@yanjingzhu Strange problem. If I can connect to github actions runner, maybe I can solve this. I think it’s related to toolchains. Anyway, thanks for your help!

actions/virtual-environments repository contains the source used to create the virtual environments for GitHub Actions hosted runners. You could check it . Or you could raise an issue in this repo.