Giter VIP home page Giter VIP logo

run-cmake's Introduction

Action Status

Coverage Status

Quickstart with a C++ project template

Take a look at this C++ project template that applies all the following instructions, but also shows how to create a pure workflow without using special GitHub action that you cannot run locally on your development machine, but directly using the tools (CMake, Ninja, vcpkg, C++ compilers) you already use daily.

The run-cmake action runs CMake on GitHub workflows leveraging CMakePresets.json. Note that usage of CMakePresets.json is required.

Good companions are the run-vcpkg action and the get-cmake action.

Special features which provide added value over a pure workflow are:

  • annotations for CMake errors/warnings and for build (gcc/msvc/clang) errors/warnings are created inline in the changed source files the build run for, e.g.: Annotation
  • when necessary, it sets up the environment to build with the MSVC toolset.
  • automatic dump of log files created by CMake (e.g., CMakeOutput.log) and vcpkg. The content of those files flow into the workflow output log. The regex is customizable by the user.

The provided samples use GitHub hosted runners.

Good companions are the run-vcpkg action and the get-cmake action.


Quickstart with instructions

It is highly recommended to use:

jobs:
  build:
    steps:
      #-uses: actions/cache@v3   <===== YOU DO NOT NEED THIS!

      # Install latest CMake and Ninja.
      - uses: lukka/get-cmake@latest
      # Or pin to a specific CMake version:
      # lukka/[email protected]

      # Setup vcpkg: ensures vcpkg is downloaded and built.
      # Since vcpkg.json is being used later on to install the packages
      # when `run-cmake` runs, no packages are installed at this time
      # (and vcpkg does not run).
      - name: Setup anew (or from cache) vcpkg (and does not build any package)
        uses: lukka/run-vcpkg@v11 # Always specify the specific _version_ of the
                                  # action you need, `v11` in this case to stay up
                                  # to date with fixes on the v11 branch.
        #with:
          # This is the default location of the directory containing vcpkg sources.
          # Change it to the right location if needed.
          # vcpkgDirectory: '${{ github.workspace }}/vcpkg'

          # If not using a submodule for vcpkg sources, this specifies which commit
          # id must be checkout from a Git repo.
          # Note: it must not be set if using a Git submodule for vcpkg.
          # vcpkgGitCommitId: '${{ matrix.vcpkgCommitId }}'

          # This is only needed if the command `vcpkg install` must run at this step.
          # Instead it is highly suggested to let `run-cmake` to run vcpkg later on
          # using the vcpkg.cmake toolchain. The default is `false`.
          # runVcpkgInstall: true

          # This is only needed if `runVpkgInstall` is `true`.
          # This glob expression used to locate the vcpkg.json and  use
          # its directory location as `working directory` when running `vcpkg install`.
          # Change it to match a single manifest file you want to use.
          # Note: do not use `${{ github.context }}` to compose the value as it
          # contains backslashes that would be misinterpreted. Instead
          # compose a value relative to the root of the repository using
          # `**/path/from/root/of/repo/to/vcpkg.json` to match the desired `vcpkg.json`.
          # vcpkgJsonGlob: '**/vcpkg.json'

      - name: Run CMake consuming CMakePreset.json and run vcpkg to build packages
        uses: lukka/run-cmake@v10
        with:
          # This is the default path to the CMakeLists.txt along side the
          # CMakePresets.json. Change if you need have CMakeLists.txt and CMakePresets.json
          # located elsewhere.
          # cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'

          # You could use CMake workflow presets defined in the CMakePresets.json
          # with just this line below. Note this one cannot be used with any other
          # preset input, it is mutually exclusive.
          # workflowPreset: 'workflow-name'

          # This is the name of the CMakePresets.json's configuration to use to generate
          # the project files. This configuration leverages the vcpkg.cmake toolchain file to
          # run vcpkg and install all dependencies specified in vcpkg.json.
          configurePreset: 'ninja-multi-vcpkg'
          # Additional arguments can be appended to the cmake command.
          # This is useful to reduce the number of CMake's Presets since you can reuse
          # an existing preset with different variables.
          configurePresetAdditionalArgs: "['-DENABLE_YOUR_FEATURE=1']"

          # This is the name of the CMakePresets.json's configuration to build the project.
          buildPreset: 'ninja-multi-vcpkg'
          # Additional arguments can be appended when building, for example to specify the
          # configuration to build.
          # This is useful to reduce the number of CMake's Presets you need in CMakePresets.json.
          buildPresetAdditionalArgs: "['--config Release']"

          # This is the name of the CMakePresets.json's configuration to test the project with.
          testPreset: 'ninja-multi-vcpkg'
          # Additional arguments can be appended when testing, for example to specify the config
          # to test.
          # This is useful to reduce the number of CMake's Presets you need in CMakePresets.json.
          testPresetAdditionalArgs: "['--config Release']"

     #  [OPTIONAL] Define the vcpkg's triplet you want to enforce, otherwise the default one
    #  for the hosting system will be automatically choosen (x64 is the default on all
    #  platforms, e.g. `x64-osx`).
    #  VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
    #
    #  [OPTIONAL] By default the action disables vcpkg's telemetry by defining VCPKG_DISABLE_METRICS.
    #  This behavior can be disabled by defining `VCPKG_ENABLE_METRICS` as follows.
    #  VCPKG_ENABLE_METRICS: 1
    #

Action reference: all input/output parameters

Description of all input parameters: action.yml


Flowchart

Flowchart with related input in action.yml which let customize the flow.

┌───────────────────────────┐      ┌───────────────────────────┐
│ <if workflowPreset        │  Yes │ Run the workflow       `*`│  Inputs:
│ provided>                 ├─────►│ and then exit             │   - `cmakeListsTxtPath`
└─────────────┬─────────────┘      └─────────────┬─────────────┘   - `workflowPreset`
              │ No                               ⬬                 - `workflowPresetCmdString`
              ▼
┌──────────────────────────────────┐
│ <if configurePreset           `*`│     Inputs:
│ provided>                        |      - `cmakeListsTxtPath`
|                                  |      - `configurePreset`
│ $CONFIGURE_PRESET_NAME =         │      - `configurePresetCmdString`
│ configurePreset's value          │
| runs: `cmake --preset`           │
└─────────────┬────────────────────┘
              ▼
┌───────────────────────────────────┐
│ <if buildPreset provided>      `*`│     Inputs:
│                                   │     - `buildPreset`
│ $BUILD_PRESET_NAME=buildPreset    │     - `cmakeListsTxtPath`
│ runs: `cmake --build --preset`    │     - `buildPresetCmdString`
└─────────────┬─────────────────────┘     - `buildPresetAdditionalArgs`
              ▼
┌───────────────────────────────────┐
│ <if testPreset provided>       `*`│    Inputs:
│                                   │     - `testPreset`
│ $TEST_PRESET_NAME=testPreset      │     - `cmakeListsTxtPath`
│ runs: `ctest --preset`            │     - `testPresetCmdString`
└─────────────┬─────────────────────┘     - `testPresetAdditionalArgs`
              ▼
┌───────────────────────────────────┐
│ <if packagePreset provided>    `*`│    Inputs:
│                                   │     - `packagePreset`
│ $PACKAGE_PRESET_NAME=packagePreset│     - `cmakeListsTxtPath`
│ runs: `cpack --preset`            │     - `packagePresetCmdString`
└─────────────┬─────────────────────┘     - `packagePresetAdditionalArgs`
              ▼
              ⬬ END


  `*` On Windows runners, the MSVC environment is setup for each block
   with the `*` on the top right corner. Note that VCPKG_ROOT will not be
   overridden by the value defined in the VS Developer Command Prompt
   environment, but the original value will be kept.
 ┌───────────────────────────┐
 │ <if VCPKG_ROOT defined    │  Inputs:
 │ and CC and CXX undefined> │   - `runVcpkgEnvFormatString`
 │ run `vcpkg env` to set    │   - `configurePresetAdditionalArgs`
 │ the environment for MSVC  │
 └───────────────────────────┘

Samples

Checkmarks indicates whether the samples "uses" or specifies the thing in the header or whether it is true.

workflow link vcpkg as submodule explicit triplet vcpkg toolchain CMake's Presets Ninja run-vcpkg runs vcpkg CMake runs vcpkg
link
link
link
link

Who is using run-cmake

This graph shows the list of public repositories with more than 25 stars using run-cmake.


License

All the content in this repository is licensed under the MIT License.

Copyright © 2019-2020-2021-2022-2023 Luca Cappa


Disclaimer

The software is provided as is, there is no warranty of any kind. All users are encouraged to improve the source code with fixes and new features.


Contributing

Read CONTRIBUTING.md

run-cmake's People

Contributors

alanb-sony avatar davidebeatrici avatar dependabot[bot] avatar jwillemsen avatar lukka avatar marcono1234 avatar saviq avatar stotiks avatar vadi2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

run-cmake's Issues

Multiline cmakeAppendedArgs Values?

Is it possible to spread cmakeAppendedArgs across multiple lines?

For example, the cmakeAppendedArgs is getting quite long. Is there any way to break these apart?

      - name: Compile
        uses: lukka/[email protected]
        with:
          cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
          cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
          cmakeAppendedArgs: '-DCMAKE_C_FLAGS=""-march=k8 -mtune=generic -O2 -g -fomit-frame-pointer -fno-stack-protector -pipe" -DCMAKE_VERBOSE_MAKEFILE=true -DENABLE_STATIC=ON'
          buildDirectory: ${{ github.workspace }}/build/

Thanks

[Question]Alternatives to the ninja generator for cmake.

Hey,

I'm writing a workflow for a cmake based project on windows and I'm experiencing a weird bug where add_subdirectory(foo) fucks up the path.

Building with CMake in build directory 'D:\a\bergamot-translator\bergamot-translator/build/Debug' ...
  ninja: error: FindFirstFileExA(3rd_party/ssplit-cpp/d:/a/bergamot-translator/bergamot-translator/build/debug): The filename, directory name, or volume label syntax is incorrect.

This only happens on windows. Mac and linux builds work fine. Do you think this is a cmake or ninja issue? Are other generators packaged with this action (eg nmake)? How do I use one?

Support for annotations

Would it be possible to support annotations with the action?

Any warnings right now are pretty hidden deep inside the workflow -> job -> vcpkg step -> run vcpkg.

Selection_564

Just a quality of life improvement.

CMake configuration step fails after workers update

Hi,
I've set up GitHub workflow with run-cmake and 5 days ago it did work fine.
Right now configuration step fails on macos-latest runner with the following error:

CMake Error: The current CMakeCache.txt directory /Users/runner/runners/2.263.0/work/chessx/b/ninja/CMakeCache.txt is different than the directory /Users/runner/runners/2.262.1/work/chessx/b/ninja where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt
25
  CMake Error: The source "/Users/runner/runners/2.263.0/work/chessx/chessx/CMakeLists.txt" does not match the source "/Users/runner/runners/2.262.1/work/chessx/chessx/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.

Judging from path mismatches it appears that worker infrastructure has been updated.
However where did CMakeCache.txt with old path come from?
Is there any caching going on in run-cmake?

How to configure only?

I'd like to use the action to generate compile commands - and not run the whole compile process. How can I do that with this action, which'll help cmake take into account all of the dependencies?

Print output log on failure

Sometimes you mess up while developing your cmake file and you get this:

2021-02-18T05:37:47.6190770Z -- Configuring incomplete, errors occurred!
2021-02-18T05:37:47.6191890Z See also "/Users/runner/work/Mudlet/b/ninja/CMakeFiles/CMakeOutput.log".
2021-02-18T05:37:47.6194760Z ##[endgroup]
2021-02-18T05:37:47.6195870Z ⏱ elapsed: 44.722 seconds
2021-02-18T05:37:47.6202480Z Error: "CMake failed with error code: '1'.
2021-02-18T05:37:47.6204080Z     at CMakeRunner.<anonymous> (/Users/runner/work/_actions/lukka/run-cmake/v3/dist/index.js:3452:31)
2021-02-18T05:37:47.6205650Z     at Generator.next (<anonymous>)
2021-02-18T05:37:47.6207090Z     at fulfilled (/Users/runner/work/_actions/lukka/run-cmake/v3/dist/index.js:3263:58)
2021-02-18T05:37:47.6208100Z     at runMicrotasks (<anonymous>)
2021-02-18T05:37:47.6209140Z     at processTicksAndRejections (internal/process/task_queues.js:93:5)
2021-02-18T05:37:47.6213000Z ##[error]run-cmake action execution failed: 'Error: "CMake failed with error code: '1'.'

You then have to edit your build config to show the cmake error in /Users/runner/work/Mudlet/b/ninja/CMakeFiles/CMakeOutput.log.

It would be nice if run-cmake automatically printed that file for this particular kind of failure.

[question] run build without presets

I cannot find a way to run cmake --build without any buildPresets.

To be clear: I am using CMake with make generator and with a list of configurePresets.
But I didn't find any useful settings in buildPreset, so I don't want to duplicate all items from config section to build in a CMakePresets.json.

I have two options: specify buildPreset key in action (it will cause build error) or skip it (then action just skip building). I don't like both alternatives ;)

Yes, as a workaround, I can specify something like run: cmake .. --preset ${{preset}} && cmake --build ., but it's not so elegant as dedicated solution.

Update to cmake 3.17.10

Not that this action is particularly oudated, but the latest release adds a –debug-find flag which is terribly useful in an environment like github actions when you're trying to figure out why is library detection failing.

How do I just do `vcpkg install packages && cmake -DCMAKE_TOOLCHAIN_FILE=%vcpkg%\scripts\buildsystems\vcpkg.cmake"`?

Maybe I'm overcomplicating things, but I want to do:

  build_windows:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v2
      - name: install dependencies
        run: |
          git clone --depth=1 https://github.com/Microsoft/vcpkg.git
          .\vcpkg\bootstrap-vcpkg.bat
          .\vcpkg\vcpkg install libarchive
      - name: build
        run: |
          md cmake-build-debug
          cd cmake-build-debug
          cmake .. -DCMAKE_TOOLCHAIN_FILE="..\vcpkg\scripts\buildsystems\vcpkg.cmake"
          cmake --build .
        shell: cmd
      - name: test
        run: ctest .
        working-directory: cmake-build-debug

Except I want to cache everything vcpkg related. Happy to pin https://github.com/Microsoft/vcpkg to a specific commit hash.

How do I do this with run-cmake, without introducing vcpkg as a submodule?

(also preferably without a vcpkg.json)

Thanks,

PS: I tried one the examples with submodule ❌'d on https://github.com/marketplace/actions/run-vcpkg#samples… but it still required a submodule

CMAKE not recognizing BuildType argument

Hi!

I'm passing -DCMAKE_BUILD_TYPE=Release argument to the cmakeAppendedArgs action, but CMAKE doesn't recognize it. Is there any extra step needed to make it work?

Integrating CMake actions with CDash and CTest

Hi @lukka,

Thanks very much for an extremely useful set of actions. I am on the process of porting my project's aging Travis IaC infrastructure [1] to the brand new world of GitHub actions and I started by using your code. I very quickly got something up and running with great vcpkg support [2] but I then ran into a problem. In the past I made use of CDash quite a lot for dashboards [3]. This allowed us to view detail stats of the CI builds. It worked via a CTest script [4], though it was by no means perfect.

I've been trying to integrate that with your actions, but I have now begun to think this is not a good idea because the approaches seem to be quite different. I am now thinking about making a copy & paste action of your run-cmake action but just have it execute a CTest script. Do you think this is a good idea? Or would it perhaps make more sense for your test step to allow users to supply a script via -S script_name?

Any ideas on this would be greatly appreciated :-)

Many thanks for your time.

Marco

[1] https://github.com/MASD-Project/dogen/blob/master/.travis.yml

[2] https://github.com/MASD-Project/dogen/blob/master/.github/workflows/build-vcpkg.yml

[3] https://my.cdash.org/index.php?project=MASD+Project+-+Dogen

[4] https://github.com/MASD-Project/dogen/blob/master/CTestConfig.cmake

[5] https://gitlab.kitware.com/cmake/cmake/-/issues/23383

Permit additional cmake variables to be set in addition to the preset

Presets are a good feature but it can be impractical to write a CMakePresets.json that contains every necessary variable, particularly if you have a cmake variable whose value needs to match a matrix variable.

The only way to use this action in that case is to hard code the matrix from the action into CMakePresets.json which means now you have two files which must be kept in sync with each other or else your action will break.

cmake itself allows additional variables to be set on the command line even when a preset is specified.

run cmake using VS15Arm64 failed

it says:

CMake Error at CMakeLists.txt:2 (project):
  Generator

    Visual Studio 15 2017

  could not find any instance of Visual Studio.



-- Configuring incomplete, errors occurred!

I known it need load environment by exec C:\\Program Files (x86)\\Microsoft Visual Studio\\${version}\\Enterprise\\VC\\vcvarsall.bat, but I don't how to fix it in the action.

Windows: "The system cannot find the path specified" when using run-cmake and run-vcpkg

The linux and apple builds works with my configuration, but not the windows one. I'm not sure I understand the error, so I r don't know if it's a bug from run-cmake or a problem in my configurations.

Here' s the error:

► Run lukka/run-cmake@v3
tool: D:\a\_temp\909795809\cmake-3.21.1-windows-x86_64\bin\cmake.exe
tool: D:\a\_temp\909795809\ninja.exe
► Setup environment variables for triplet 'x64-windows' using 'vcpkg env'
⏱ elapsed: 2.161 seconds
Error: get_directories_non_recursive(D:\a\kangaru\kangaru\vcpkg_installed\x64-windows\tools): The system cannot find the path specified.
    
    
    
    at CMakeUtils.<anonymous> (D:\a\_actions\lukka\run-cmake\v3\dist\index.js:4765:27)
    at Generator.next (<anonymous>)
    at fulfilled (D:\a\_actions\lukka\run-cmake\v3\dist\index.js:4717:58)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: run-cmake action execution failed: 'Error: get_directories_non_recursive(D:\a\kangaru\kangaru\vcpkg_installed\x64-windows\tools): The system cannot find the path specified.

Here's my configuration:

on: [push, pull_request]

jobs:
  build:
    env:
      buildDir: ${{ github.workspace }}/build
    name: ${{ matrix.os }}-hosted-basic
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        include:
          - os: windows-latest
            triplet: x64-windows
            build-type: RelWithDebInfo
          - os: ubuntu-latest
            triplet: x64-linux
            build-type: RelWithDebInfo
          - os: macos-latest
            triplet: x64-osx
            build-type: RelWithDebInfo
            
    steps:
      - uses: actions/checkout@v2

      - name: get-cmake
        uses: lukka/[email protected]

      - name: Run vcpkg
        uses: lukka/run-vcpkg@v6
        with:
          # Just install vcpkg for now, do not install any ports in this step yet.
          setupOnly: true
          # Location of the vcpkg as submodule of the repository.
          vcpkgDirectory: '${{ github.workspace }}/vcpkg'
          vcpkgGitCommitId: '57bd7102d9fd880daa1b0958692294c4a125f6d8'
          # Since the cache must be invalidated when content of the vcpkg.json file changes, let's
          # compute its hash and append this to the computed cache's key.
          appendedCacheKey: ${{ hashFiles( '**/vcpkg.json' ) }}
          vcpkgTriplet: ${{ matrix.triplet }}
          # Ensure the vcpkg artifacts are cached, they are generated in the 'CMAKE_BINARY_DIR/vcpkg_installed'.
          additionalCachedPaths: ${{ env.buildDir }}/vcpkg_installed
      - name: 'Run CMake with Ninja, install dependencies with vcpkg, build with CMake'
        uses: lukka/run-cmake@v3
        with:
          cmakeListsOrSettingsJson: CMakeListsTxtBasic
          cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
          useVcpkgToolchainFile: true
          cmakeAppendedArgs: '-GNinja -DKANGARU_TEST=ON'
          buildDirectory: ${{ env.buildDir }}

      - name: Test
        working-directory: ${{github.workspace}}/build
        # Execute tests defined by the CMake configuration.  
        # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
        run: ctest -C ${{env.build-type}}

Here's the live error. As you can see from that page ubuntu and macos are working correctly.

[Question] How to force Release build?

Hi, I'm trying to use your routine for building my stuff in GH actions. I want to build Release, and I succeed with it on my PC without any additional flags. But the routine keeps producing Debug. It also links to debug libraries, including MSVCRT, and I have liker issues. How to explicitly configure to build Release?

Here is my presets:

{
  "version": 3,
  "cmakeMinimumRequired": {
    "major": 3,
    "minor": 22,
    "patch": 0
  },
  "configurePresets": [
    {
      "name": "default",
      "displayName": "Default Config",
      "description": "Default build",
      "binaryDir": "${sourceDir}/build",
      "cacheVariables": {
        "VCPKG_LOCATION": "${sourceDir}/vcpkg",
        "CMAKE_BUILD_TYPE": "Release",
        "CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS": true
      },
      "toolchainFile": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
    }
  ],
  "buildPresets": [
    {
      "name": "default",
      "configurePreset": "default"
    }
  ],
  "testPresets": [
    {
      "name": "default",
      "configurePreset": "default",
      "output": {"outputOnFailure": true},
      "execution": {"noTestsAction": "error", "stopOnFailure": true}
    }
  ]
}

And my yaml config:

name: CMake_vcpkg_autocache

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

env:
  BUILD_TYPE: Release

jobs:
  build:
    name: ${{ matrix.os }}-${{ github.workflow }},
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest]
        include:
          - os: windows-latest
            triplet: x64-windows-release
          - os: ubuntu-latest
            triplet: x64-linux-release

    env:
      VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}

    steps:
      - name: Checkout repository and submodules
        uses: actions/checkout@v2
        with:
          submodules: recursive

      - name: Install dependencies for Linux
        if: ${{ matrix.os == 'ubuntu-latest' }}
        run: sudo apt install curl clang make libboost-all-dev libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libglfw3 libglfw3-dev libxi-dev libtbb-dev

      - name: Restore artifacts, or setup vcpkg for building artifacts
        uses: lukka/run-vcpkg@main
        id: runvcpkg

      - name: List $RUNNER_WORKSPACE before build
        run: find $RUNNER_WORKSPACE
        shell: bash
      - name: Prints output of run-vcpkg's action.
        run: echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' "

      - name: Run CMake+vcpkg
        uses: lukka/run-cmake@v10
        id: runcmake
        with:
          cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
          configurePreset: 'default'
          buildPreset: 'default'
          testPreset: 'default'

      - name: List $RUNNER_WORKSPACE after build
        run: find $RUNNER_WORKSPACE
        shell: bash

'configurePreset' option is wrongly required

According to the action.yml file, 'configurePreset' is not a required input. However, if you don't provide it you get the following error:

Error: Input required and not supplied: configurePreset
    at Object.getInput (/home/runner/work/_actions/lukka/run-cmake/v10/dist/index.js:10092:15)
    at ActionLib.getInput (/home/runner/work/_actions/lukka/run-cmake/v10/dist/index.js:9160:26)
    at new CMakeRunner (/home/runner/work/_actions/lukka/run-cmake/v10/dist/index.js:4033:56)
    at Function.<anonymous> (/home/runner/work/_actions/lukka/run-cmake/v10/dist/index.js:4042:37)
    at Generator.next (<anonymous>)
    at /home/runner/work/_actions/lukka/run-cmake/v10/dist/index.js:4010:71
    at new Promise (<anonymous>)
    at module.exports.214.__awaiter (/home/runner/work/_actions/lukka/run-cmake/v10/dist/index.js:4006:12)
    at /home/runner/work/_actions/lukka/run-cmake/v10/dist/index.js:4041:111
    at Object.using (/home/runner/work/_actions/lukka/run-cmake/v10/dist/index.js:12975:18)

Since I'm using 'configurePresetCmdString', I simply put a random string as input to 'configurePreset' to make it work (and the action correctly uses the command string instead of the random configure preset). However, it would be nice if I didn't have to pass a random value to 'configurePreset'.

Same thing goes for 'buildPreset'.

Thanks!

[ENHANCEMENT] information of CMakeSettings.json

When run-cmake starts there is information about the build, that information does not correspond to the CMakeSettings.json and is to be overrided in the json file.

image

And the CMakeSettings.json doesnt show information about the config

image

Well, i think that these features are under developmemnt.

Semicolons in cmakeAppendedArgs

The following does not work as I expected on Linux and macOS runners.

- name: test
  uses: lukka/[email protected]
  with:
    cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
    ...
    cmakeAppendedArgs: '-GNinja -DFOO_BAR="foo meow;bar hiss"'

It appears argStringToArray strips off double quotes, and I suspect the cmake command line ends up with an unquoted semicolon which acts as a command terminator and therefore in the log:

  CMake Warning:
    No source or binary directory provided.  Both will be assumed to be the
    same as the current working directory, but note that this warning will
    become a fatal error in future CMake releases.

The hint was that on Windows runners this works fine, because ; isn't special.

I've attempted to work around it for now by:

    cmakeAppendedArgs: '-GNinja "-DFOO_BAR=\"foo meow;bar hiss\""'

But that doesn't feel right to me, and doesn't work on Windows runners (I haven't worked out why yet...).

Windows -> Must define a target architecture

Finally got to the part of building my application.
I'm trying to compile it and it almost finishes and then ultimately fails upon building my resource file:

2022-04-07T20:28:18.7563698Z [147/154] Building RC object game\CMakeFiles\performous.dir\__\performous.rc.res
2022-04-07T20:28:18.7565108Z FAILED: game/CMakeFiles/performous.dir/__/performous.rc.res 
2022-04-07T20:28:18.7580156Z C:/PROGRA~1/CMake/bin/cmcldeps.exe RC D:\a\performous\performous\build\x64-debug\performous.rc game\CMakeFiles\performous.dir\__\performous.rc.res.d game\CMakeFiles\performous.dir\__\performous.rc.res "Note: including file: " "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe" C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\rc.exe -DEPOXY_SHARED -DHAVE_BLAS=1 -DHAVE_C99_VARARGS_MACROS=1 -DHAVE_FFTW3=1 -DHAVE_FFTW3F=1 -DHAVE_LIMITS_H=1 -DHAVE_MATH_H=1 -DHAVE_OPENBLAS_CBLAS_H=1 -DHAVE_STDARG_H=1 -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DUSE_OPENCV -DUSE_PORTMIDI -I D:\a\performous\performous\build\x64-debug\game -I D:\a\performous\performous\game -I D:\a\performous\performous\build\x64-debug\ced-src -I D:\a\performous\performous\build\x64-debug\_deps\aubio-sources-build\include -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\include -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\include\SDL2 -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\include\cairo -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\include\gdk-pixbuf-2.0 -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\debug\include\..\lib\libxml++-5.0\include -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\include\libxml++-5.0 -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\include\libxml2 -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\debug\include\..\lib\glibmm-2.68\include -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\include\glibmm-2.68 -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\include\sigc++-3.0 -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\debug\include\..\lib\sigc++-3.0\include -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\debug\..\include\pango-1.0 -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\debug\..\include\harfbuzz -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\debug\..\include -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\debug\..\include\glib-2.0 -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\debug\lib\glib-2.0\include -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\debug\..\include\libpng16 -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\debug\..\include\fribidi -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\debug\..\include\cairo -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\debug\..\include\lzo -I D:\a\performous\performous\build\x64-debug\vcpkg_installed\x64-windows\debug\..\include\pixman-1 -DWIN32 -D_DEBUG /fo game\CMakeFiles\performous.dir\__\performous.rc.res D:\a\performous\performous\build\x64-debug\performous.rc
2022-04-07T20:28:18.7588166Z cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
2022-04-07T20:28:18.7588802Z 
2022-04-07T20:28:18.7590671Z ##[error]C:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um\winnt.h(253): fatal error C1189: #error:  Must define a target architecture.
2022-04-07T20:28:18.7591830Z 

any idea why this is the case? I'm building with Ninja as generator.

This is the relevant section in our actions:

- uses: lukka/[email protected]
        with:
          vcpkgGitCommitId: '71d274d7ce32d7f2508062a70e0a5ebe981319eb'

      - uses: lukka/run-cmake@v10
        env:
          PKG_CONFIG_EXECUTABLE: D:/a/performous/performous/pkg-config-lite-0.28-1/bin/pkg-config.exe
        with:
          configurePreset: 'x64-debug'
          buildPreset: 'x64-debug'

our presets file looks like this:

{
  "version": 2,
  "configurePresets": [
    {
      "name": "windows-base",
      "description": "Target Windows with the Visual Studio development environment.",
      "hidden": true,
      "generator": "Ninja",
      "binaryDir": "${sourceDir}/build/${presetName}",
      "cacheVariables": {
        "CMAKE_C_COMPILER": "cl.exe",
        "CMAKE_CXX_COMPILER": "cl.exe",
        "BUILD_SHARED_LIBS": "ON",
        "ENABLE_WEBSERVER": "OFF",
        "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/${presetName}-install",
        "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
      }
    }
  ]
"buildPresets": [
    {
      "name": "x64-debug",
      "configurePreset": "x64-debug",
      "displayName": "Build x64-debug with Ninja",
      "description": "Build x64-debug with Ninja"
    }
]

generated output summary in GH-actions
image

How to run tests?

I'm looking at running tests - what's the best way to do that? On the CLI, I can either run ctest or make test to run them.

Should I have a separate run action, or can cmakeAppendedArgs be massaged somehow to run and test at once?

Changes in environment variables

Hi,

We have been using parts of your build system, and we find it easy to use and maintain. Last week, GitHub updated the CI servers, and our build started to break. The reason was that the path to Python executable was no longer available.

It seems to me that the propagation of path from the CI server to the build process in Visual Studio is not working as expected now.

Here is a reference to a build that ran without issues before the upgrade last week. As you can see, python is no longer available from the build job in Visual Studio.

Failing build
https://github.com/OPM/ResInsight/runs/536161809?check_suite_focus=true

Successful build
https://github.com/OPM/ResInsight/runs/533332280?check_suite_focus=true

As a workaround we will use command line config of CMake directly.

Any clue why this happens?

Regards
Magne

Environment vars in command-line

Hi!

I'm not sure if this issue is related to the action itself, but when I try to use an environment var on the CMAKE arguments, it's not recognized.

I've tested setting the -DCMAKE_TOOLCHAIN_FILE using the ANDROID_SDK_ROOT environment variable in two ways, but no one have worked:

Just to clarify, I've already ensured the given toolchain file is on the runner image.

https://github.com/rickomax/assimp/runs/479700678?check_suite_focus=true
https://github.com/rickomax/assimp/runs/479685226?check_suite_focus=true

Add support for cmake/ninja --install

Hi,

I am currently using the action to build my project and everything works fine. However, my project does not only contain source files that need to be build, but rather uses install to put everything in place (e.g. raw files, artifacts, headers, etc.). It would be quite convenient, if run-cmake could be configured to automatically run ninja install or cmake --install after a successful build. For ninja, the install directory is stored in the CMakeSettings.json file. The action could treat it just as it does with the buildRoot directory (i.e. ignore and set to a default; maybe make it configurable).

Do you think this is possible?

Thanks and regards,
Carsten.

Error on run

Hi!

I'm getting an error message while running the CMAKE action.
It was working fine before.

Download action repository 'lukka/run-cmake@v0'
##[error](Line: 34, Col: 14):
##[error](Line: 34, Col: 14): Unrecognized named-value: 'env'. Located at position 1 within expression: env.RUNVCPKG_VCPKG_TRIPLET
##[error]Fail to load /home/runner/work/_actions/lukka/run-cmake/v0/action.yml

Edit: was pointing out to a private repository, removed.

Windows MSVC build has cache hit but vcpkg still rebuilds every package?

I have 4 jobs: Linux, MacOS, Windows MinGW and Windows MSVC. All using get-cmake, run-vcpkg and run-cmake. In fact, the job is basically identical for all four of them. But for the MSVC build the packages from vcpkg are being rebuilt every single time, even though there's a cache hit. So I'm really not sure what is going wrong.

From run-vcpkg:

Restore vcpkg and its artifacts from cache
  Cache key: 'runnerOS=win2220220626.1-vcpkgGitCommit=da70d4586c9534cdc2ff656aadb5a23d33e30086_vcpkgJson=872885daeddf2fdbf652ce45167027a4bb411b4a366a0eeca5bea7c37987be21'
  Cache restore keys: 'runnerOS=win2220220626.1-vcpkgGitCommit=da70d4586c9534cdc2ff656aadb5a23d33e30086'
  Cached paths: 'D:/a/endless-sky/b/vcpkg_cache,D:\a\endless-sky\endless-sky\vcpkg,!D:\a\endless-sky\endless-sky\vcpkg\installed,!D:\a\endless-sky\endless-sky\vcpkg\vcpkg_installed,!D:\a\endless-sky\endless-sky\vcpkg\packages,!D:\a\endless-sky\endless-sky\vcpkg\buildtrees,!D:\a\endless-sky\endless-sky\vcpkg\downloads'
  Cache Size: ~99 MB (103798965 B)
  C:\Windows\System32\tar.exe -z -xf D:/a/_temp/c722812d-2d84-4efa-9cd6-5996c6f27b66/cache.tgz -P -C D:/a/endless-sky/endless-sky
  Cache hit, key = 'runnerOS=win2220220626.1-vcpkgGitCommit=da70d4586c9534cdc2ff656aadb5a23d33e30086_vcpkgJson=872885daeddf2fdbf652ce45167027a4bb411b4a366a0eeca5bea7c37987be21'.

Which as far as I understand successfully downloads the cache. But then in run-cmake:

Additional packages (*) will be modified to complete this operation.
  Restored 2 packages from D:\a\endless-sky\b\vcpkg_cache in 25.29 ms. Use --debug to see more details.
  Installing 1/10 vcpkg-cmake-config:x64-windows...
  Elapsed time to handle vcpkg-cmake-config:x64-windows: 3.927 ms
  Installing 2/10 vcpkg-cmake:x64-windows...
  Elapsed time to handle vcpkg-cmake:x64-windows: 3.773 ms
  Installing 3/10 opengl:x64-windows...
  Building opengl[core]:x64-windows...

It starts building. It seems to have found 2 packages, but the rest is gone or something. (--debug would be helpful but I don't know how to specify it).

Here's a run (all green) that erroneously rebuilds the packages: https://github.com/quyykk/endless-sky/runs/7221991331
Here's the run right after that one that also fails to rebuild: https://github.com/quyykk/endless-sky/runs/7222278448

What could be going wrong? Is it an error on my end? Thanks!

Expand-Archive : is not a supported archive file format.

I am getting this error while trying to make a cmake update action. How can I get rid of it? in my YAML file I am using the following configurations. Thank you in advance.

env:
CONFIGURATION: Debug
jobs:
Build:
runs-on: [ self-hosted, Windows, Build ]
timeout-minutes: 30
strategy:
matrix:
TARGET: [ 'Windows' ]
MSVC_TOOLSET_VERSION:
- 14.00
- 14.16
- 14.29
- 14.30
- 14.31
- 14.32
steps:
- uses: actions/[email protected]
- uses: ilammy/[email protected]
with:
arch: x64
toolset: $ {{ matrix.MSVC_TOOLSET_VERSION }}
- uses: lukka/[email protected]
- uses: lukka/[email protected]
with:
configurePreset: $ {{ matrix.TARGET }}-${{ env.CONFIGURATION }}
buildPreset: $ {{ matrix.TARGET }}-${{ env.CONFIGURATION }}

Error:

C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath 'C:\actions-runner_work_temp\834f221e-b5a4-418c-aa96-71d4f1cbe900' -DestinationPath 'C:\actions-runner_work_temp-1001380349' -Force } else {[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\actions-runner_work_temp\834f221e-b5a4-418c-aa96-71d4f1cbe900', 'C:\actions-runner_work_temp-1001380349', $true) }"

48 Expand-Archive : is not a supported archive file format. The only supported archive file format is .zip.
49 At line:1 char:210
50 + ... Ignore)) { Expand-Archive -LiteralPath 'C:\actions-runner_work_tem ...
51 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52 + CategoryInfo : InvalidArgument: (:String) [Expand-Archive], IOException
53 + FullyQualifiedErrorId : NotSupportedArchiveFileExtension,Expand-Archive

cmake -G Ninja fails on windows runner if CMakeLists.txt includes add_subdirectory()

First, thanks for this great github action!

Second, I've been trying to get a windows runner to work with add_subdirector() in CMakeLists.txt, and have not been able get things to work with the Ninja generator. I've distilled things down to a minimal setup here: https://github.com/ugermann/run-cmake-fails-on-windows-runner/runs/2453647696?check_suite_focus=true. The problem is in line 34 of the output. Path prefix and the added subdirectory are concatenated in the wrong order.

I've been battling this for a few days now and have run out of ideas to try. Any suggestions?

wrong parsing paths in configurePresetAdditionalArgs on Windows CI

If I want to pass

configurePresetAdditionalArgs: "[ '-DD3D9_INCLUDE_DIR=${{ github.workspace }}/cache/Include' ]"

I'll get good enough string in github gui log:

Run lukka/run-cmake@v10
  with:
    cmakeListsTxtPath: D:\a\nine-tests\nine-tests/NineTests/CMakeLists.txt
    configurePreset: default
    configurePresetAdditionalArgs: ['-DD3D9_INCLUDE_DIR=D:\a\nine-tests\nine-tests/cache/Include']

But in raw log I'll see broken/splites lines and build will fail:

2023-04-12T08:47:12.2545415Z Running command '"C:\Program Files\CMake\bin\cmake.exe"' with args '^"--preset^",^"default^",^"-DD3D9_INCLUDE_DIR=D:a
2023-04-12T08:47:12.2545798Z ine-tests
2023-04-12T08:47:12.2546177Z ine-tests/cache/Include^

Full log here: build-log.txt

I also tried different variants of quotation marks:

configurePresetAdditionalArgs: "[ '-DD3D9_INCLUDE_DIR=${{ github.workspace }}/cache/Include' ]"
configurePresetAdditionalArgs: "[ `-DD3D9_INCLUDE_DIR=${{ github.workspace }}/cache/Include` ]"
configurePresetAdditionalArgs: '[ "-DD3D9_INCLUDE_DIR=${{ github.workspace }}/cache/Include" ]`
configurePresetAdditionalArgs: '[ `-DD3D9_INCLUDE_DIR="${{ github.workspace }}/cache/Include"` ]'

But got same problem.

Here is example:
https://github.com/q4a/nine-tests/blob/cc0e8b9c12031a44991c11bbb48bbd3b7b8d6d5f/.github/workflows/ci_windows.yml#L37
Gui build log:
https://github.com/q4a/nine-tests/actions/runs/4676508343/jobs/8282902807
Raw build log:
https://github.com/q4a/nine-tests/commit/cc0e8b9c12031a44991c11bbb48bbd3b7b8d6d5f/checks/12685199096/logs

Set RUNVCPKG_NO_CACHE on configure failure

To prevent a partial cache store, the RUNVCPKG_NO_CACHE needs to be set if the run is cancelled or fails. The docs for run-vcpkg mention doing it as an additional step, however this means that any failure at any stage of the job results in no cache being saved, which is less than ideal.

run-cmake should set this environment variable automatically iff the configure preset fails.

Is a GitHub action really necessary to build a C++ based project?

Introduction

In an ideal world, a mature ecosystem around the 30 years old C++ language would have standard and multi platform tools handling the dependency management, the building, the testing and so forth. Such as:

cpp install && cpp build && cpp test

Ideally those exact commands would be run locally on the developer machine, or remotely on the build/test machines, in order to obtain a perfectly reproducible software development process that can be run anywhere without any difference and no surprises.

Reality is that (I can speak for Azure DevOps or GitHub workflows) server side workflows require Tasks or Actions, which are essentially something the developer cannot run locally on the development machine.

In short, the problem is the lack of 100% reproducible software development processes: the build/test process run by the developer on the local machine is not exactly identical to the one run on the server side workflow.

Let's create a reproducible workflow, not polluted with code the developer cannot run!

In this pure workflow, it is presented how to create a workflow that is as close as possible to what the developer would run locally on the development machine.
The final intention is to give the developer the power to:

  • having a reproducible workflow based on well known tools (i.e. CMake, Ninja, vcpkg).
  • provide to the developer the knowledge to create a workflow without relying on any magic GitHub action.

The pure workflow is based on:

  • absence of unneeded GitHub actions.
  • the fact that vcpkg can be bootstrapped (i.e .building the vcpkg executable) when the vcpkg's toolchain file is passed in at CMake's project file generation time.
  • the vcpkg.json manifest file that specifies declaratively the dependencies to be installed.

Developers must own the knowledge and the choices

This information must be provided to the users in the readme.md files of run-vcpkg and run-cmake: users must own the knowledge and take a conscious decision about whether any GitHub action is necessary.

The future is even brighter

  • CMake (already) supports a CMakePresets.json file to ease having a matching local and server side experience when configuring and building a project. This file is consumed directly by CMake when running, so it makes configuring a project exactly in the same way on the dev machine and on the build server machine a breeze.
  • according to its Roadmap, vcpkg will be distributed as a standalone binary (not yet done as of 4th Jan 2021) which would not require anymore to bootstrap it (i.e. building it). As of today the vcpkg tool executable can only install packages included in the same Git repository (i.e. same commit id) it was built from. To rephrase, the vcpkg tool and the data must exactly match and come from the same Git commit id.

Added values of a GitHub Action

There are still useful features provided by the actions that cannot be covered by tools, e.g.:

  • solving task automatically that the user does not have to think about. e.g. run-vcpkg automatically caches the artifacts. or get-cmake caches automatically Ninja and CMake.
  • providing error and warning matchers (aka problem matchers).

Fails to build an RC object

I'm migrating DevilutionX MSVC build from AppVeyor to GitHub Actions (diasurgical/devilutionX#4947) and I've hit the following error:

  add_executable(${BIN_TARGET}
    WIN32
    MACOSX_BUNDLE
    Source/main.cpp
    Packaging/windows/devilutionx.exe.manifest
    Packaging/windows/devilutionx.rc
    Packaging/apple/AppIcon.icns
    Packaging/apple/LaunchScreen.storyboard)
[186/593] Building RC object CMakeFiles\devilutionx.dir\Packaging\windows\devilutionx.rc.res
  FAILED: CMakeFiles/devilutionx.dir/Packaging/windows/devilutionx.rc.res 
  C:/ProgramData/chocolatey/bin/ccache.exe D:/a/_temp/125992~1/CMAKE-~1.0-W/bin/cmcldeps.exe RC D:\a\devilutionX\devilutionX\Packaging\windows\devilutionx.rc CMakeFiles\devilutionx.dir\Packaging\windows\devilutionx.rc.res.d CMakeFiles\devilutionx.dir\Packaging\windows\devilutionx.rc.res "Note: including file: " "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe" C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe -DASIO_STANDALONE -DBUILD_TESTING -DDEVILUTIONX_DEFAULT_RESAMPLER=Speex -DDEVILUTIONX_PALETTE_TRANSPARENCY_BLACK_16_LUT -DDEVILUTIONX_RESAMPLER_SDL -DDEVILUTIONX_RESAMPLER_SPEEX -DFMT_LOCALE -DFMT_SHARED -DPACKET_ENCRYPTION -D_CRT_SECURE_NO_WARNINGS -D_DEBUG -I D:\a\devilutionX\devilutionX\Source -I D:\a\devilutionX\devilutionX\build-ninja-vcpkg-debug\Source -I D:\a\devilutionX\devilutionX\3rdParty\PKWare\. -I D:\a\devilutionX\devilutionX\build-ninja-vcpkg-debug\_deps\libmpq-src -I D:\a\devilutionX\devilutionX\build-ninja-vcpkg-debug\_deps\libsmacke...
  cl : Command line warning D9002 : ignoring unknown option '/fo'
  c1: fatal error C1083: Cannot open source file: 'CMakeFiles\devilutionx.dir\Packaging\windows\devilutionx.rc.res.dep.obj ': No such file or directory
  devilutionx.rc

https://github.com/diasurgical/devilutionX/runs/7271331869?check_suite_focus=true

Extract project version

Would be useful to automatically extract and store the project version to a variable. This should be done via FileApi to ensure that it is set even if it is dynamically defined outside project().

Usage I think it is obvious in that it is for uploading tags and github releases.

Overlay triplets appear not to work

See https://github.com/zig-for/snfm/actions/runs/2646107112

I've set

        "VCPKG_TARGET_TRIPLET": "x64-windows-static-release",
        "VCPKG_OVERLAY_TRIPLES": "${sourceDir}",

in my CMakePresets.json and added the new triplet file to the root of my source directory. When I run this locally, it works just fine, both through visual studio and through the command line. When I run through github actions, it doesn't work. I'm happy to try and debug this, but I've no idea where to go from here.

Failure of tests on Windows agents due to NPM_CONFIG_CACHE defined multiple time and different casing

Functional test using VS generator fails with the following error.
The problem is that during the execution of the workflow, the NPM_CONFIG_CACHE environment variable gets defined with different casing multiple time, and starting a process in .NET fails at using an environment having the same variable defined multiple time (and with different casing).

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(234,5): error MSB6001: Invalid command line switch for "cmd.exe". System.ArgumentException: Item has already been added. Key in dictionary: 'NPM_CONFIG_CACHE'  Key being added: 'npm_config_cache' [D:\a\run-cmake\run-cmake\__tests__\build Directory\VS-x64-Release\ZERO_CHECK.vcxproj]
2020-09-05T05:47:19.3838789Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(234,5): error MSB6001:    at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) [D:\a\run-cmake\run-cmake\__tests__\build Directory\VS-x64-Release\ZERO_CHECK.vcxproj]
2020-09-05T05:47:19.3839853Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(234,5): error MSB6001:    at System.Collections.Hashtable.Add(Object key, Object value) [D:\a\run-cmake\run-cmake\__tests__\build Directory\VS-x64-Release\ZERO_CHECK.vcxproj]
2020-09-05T05:47:19.3841250Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(234,5): error MSB6001:    at System.Collections.Specialized.StringDictionaryWithComparer.Add(String key, String value) [D:\a\run-cmake\run-cmake\__tests__\build Directory\VS-x64-Release\ZERO_CHECK.vcxproj]
2020-09-05T05:47:19.3842298Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(234,5): error MSB6001:    at System.Diagnostics.ProcessStartInfo.get_EnvironmentVariables() [D:\a\run-cmake\run-cmake\__tests__\build Directory\VS-x64-Release\ZERO_CHECK.vcxproj]
2020-09-05T05:47:19.3843763Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(234,5): error MSB6001:    at Microsoft.Build.Utilities.ToolTask.GetProcessStartInfo(String pathToTool, String commandLineCommands, String responseFileSwitch) [D:\a\run-cmake\run-cmake\__tests__\build Directory\VS-x64-Release\ZERO_CHECK.vcxproj]
2020-09-05T05:47:19.3845031Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(234,5): error MSB6001:    at Microsoft.Build.Utilities.ToolTask.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [D:\a\run-cmake\run-cmake\__tests__\build Directory\VS-x64-Release\ZERO_CHECK.vcxproj]
2020-09-05T05:47:19.3846428Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(234,5): error MSB6001:    at Microsoft.Build.CPPTasks.TrackedVCToolTask.TrackerExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [D:\a\run-cmake\run-cmake\__tests__\build Directory\VS-x64-Release\ZERO_CHECK.vcxproj]
2020-09-05T05:47:19.3847758Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(234,5): error MSB6001:    at Microsoft.Build.CPPTasks.CustomBuild.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [D:\a\run-cmake\run-cmake\__tests__\build Directory\VS-x64-Release\ZERO_CHECK.vcxproj]
2020-09-05T05:47:19.3848715Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(234,5): error MSB6001:    at Microsoft.Build.Utilities.ToolTask.Execute() [D:\a\run-cmake\run-cmake\__tests__\build Directory\VS-x64-Release\ZERO_CHECK.vcxproj]

Got a 64bit build despite requesting VS16Win32

Hi and thanks for your work.

I requested VS16Win32 for the generator, and yet the result was a 64bit build.

Is there something I'm missing, or is this an unexpected result?

For the record, the full log is this:

Run lukka/run-cmake@v2
  with:
    cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
    cmakeListsTxtPath: D:\a\fast_float\fast_float/CMakeLists.txt
    buildDirectory: D:\a\fast_float\fast_float/../../_temp/windows
    cmakeBuildType: Release
    buildWithCMake: true
    cmakeGenerator: VS16Win32
    cmakeAppendedArgs: -DFASTFLOAT_TEST=ON
    buildWithCMakeArgs: --config Release
    cmakeSettingsJsonPath: D:\a\fast_float\fast_float//CMakeSettings.json
    useVcpkgToolchainFile: false
    configurationRegexFilter: .*
    useShell: true
tool: C:\Program Files\CMake\bin\cmake.exe
Generate project files with CMake
  -- Building for: Visual Studio 16 2019
  -- The CXX compiler identification is MSVC 19.27.29112.0
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- No build type selected, default to Release
  -- Configuring done
  -- Generating done
  -- Build files have been written to: D:/a/_temp/windows

[Question] Use msys2 shell?

For Windows builds, I need the msys2 shell, without it cmake is not able to find the packages for msys2.

Usually it can be specified like this (using https://github.com/msys2/setup-msys2 ):

- shell: msys2 {0}
    run: |
      echo "This runs in msys2

I saw that the action has a useShell parameter, however it is a boolean and the description is not clear for me:
It also can be an absolute with arguments of the shell to spawn commands with.

So how can I specify, that the run-cmake action uses msys2?

Unrecognized named-value: 'env'

Sometime within the last few days all attempts to use run-cmake are failing with this error:

Current runner version: '2.168.0'
Operating System
Virtual Environment
Prepare workflow directory
Prepare all required actions
Download action repository 'actions/checkout@v1'
Download action repository 'actions/cache@v1'
Download action repository 'lukka/run-vcpkg@v1'
Download action repository 'lukka/run-cmake@v1'
##[error](Line: 34, Col: 14):
##[error](Line: 34, Col: 14): Unrecognized named-value: 'env'. Located at position 1 within expression: env.RUNVCPKG_VCPKG_TRIPLET
##[error]Fail to load /home/runner/work/_actions/lukka/run-cmake/v1/action.yml

CMakeSettings.json workflow

How it is supposed to write a CMakeSettings.json to make the configurations of the build. My actual build is working, but it is because run-cmake is choosing a default config to use in linux.

Linux build for Visual Studio requires a remote machine, so what information run-cmake recollects from that cmake settings schema for Visual Studio?

Invalid cache gets saved and never overwritten if project generation fails

If the project generation fails for any reason (error in CMakeLists, manually cancelling the workflows, etc.), then the run-vcpkg action saves its cache. However, that cache might be incomplete. Subsequent runs of the workflow use that incomplete cache and if they succeed never update it with actual correct and complete cache.

I'm not very knowledgeable when it comes to caches, but it seems like it would be possible save caches when run-cmake fails under a different (restore) cache key.

Thanks!

Update the v10 branch with node16

The v10 branch still uses node12. It would be nice if either the v10 branch would get synced with main or a new release would be created.

Support workflow presets

CMake 3.25 adds a new preset, the workflow preset, which is very useful in CI because it describes an arbitrary sequence of build and test (and package) presets.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.