name: MSBuild
on: [push]
env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: .
# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Release
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Restore NuGet packages
working-directory: ${{env.GITHUB_WORKSPACE}}
run: nuget restore ${{env.SOLUTION_FILE_PATH}}
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: '5.15.2'
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'
dir: '${{ github.workspace }}/example/'
install-deps: 'true'
modules: 'qtcore qtwidgets qtgui'
cached: 'false'
setup-python: 'true'
tools-only: 'false'
- name: Build
working-directory: ${{env.GITHUB_WORKSPACE}}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}}
However, it looks like some variables are not set properly since Qt can't find its headers:
D:\a\GithubActionsWithQtTest\GithubActionsWithQtTest\GithubActionsWithQtTest\GithubActionsWithQtTest.h(3,10): fatal error C1083: Cannot open include file: 'QtWidgets/QMainWindow': No such file or directory (compiling source file GithubActionsWithQtTest.cpp) [D:\a\GithubActionsWithQtTest\GithubActionsWithQtTest\GithubActionsWithQtTest\GithubActionsWithQtTest.vcxproj]
Is this kind of build currently supported? I figured that QtMsBuild folder was not being detected either so I had to manually copy it from my local machine's %LOCALAPPDATA%\QtMsBuild into the project folder. I am not sure if the local QtMsBuild folder differs from the one on the remote machine and if it is valid. In any case, the entire %LOCALAPPDATA% folder doesn't even seem to exist on the github runner.
I am currently trying to set up a dummy Qt 5.15.2 window app to build with your script and Visual Studio 2019 using Actions. https://github.com/MaksymAtNimagna/GithubActionsWithQtTest
The script looks as follows:
However, it looks like some variables are not set properly since Qt can't find its headers: D:\a\GithubActionsWithQtTest\GithubActionsWithQtTest\GithubActionsWithQtTest\GithubActionsWithQtTest.h(3,10): fatal error C1083: Cannot open include file: 'QtWidgets/QMainWindow': No such file or directory (compiling source file GithubActionsWithQtTest.cpp) [D:\a\GithubActionsWithQtTest\GithubActionsWithQtTest\GithubActionsWithQtTest\GithubActionsWithQtTest.vcxproj]
Is this kind of build currently supported? I figured that QtMsBuild folder was not being detected either so I had to manually copy it from my local machine's %LOCALAPPDATA%\QtMsBuild into the project folder. I am not sure if the local QtMsBuild folder differs from the one on the remote machine and if it is valid. In any case, the entire %LOCALAPPDATA% folder doesn't even seem to exist on the github runner.