[PR #405] [CLOSED] Special handling of cmake scripts #1436

Closed
opened 2026-03-01 21:51:10 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/405
Author: @winksaville
Created: 11/1/2020
Status: Closed

Base: masterHead: Special-handling-cmake-scripts


📝 Commits (1)

  • 4820769 Special handling of cmake scripts

📊 Changes

1 file changed (+6 additions, -3 deletions)

View changed files

📝 pkg/runner/step_context.go (+6 -3)

📄 Description

This fix only works with cmake, but I suspect other scripting languages
would have similar problems. I'm hoping there is a better solution, but
something like this does work for my particular problem.

The problem is having the first line of scripts be: Path="xxx:${PATH}"
where xxx is rc.ExtraPath, does not work for all scripting languages.
For example: 'cmake -P {0}' is used by Cristian Adam HelloWorld:
https://github.com/cristianadam/HelloWorld/blob/master/.github/workflows/build_cmake.yml#:~:text=shell:

Here is some test code:

name: CMake Build Matrix

on: [push, pull_request]

env:
CMAKE_VERSION: 3.18.3
NINJA_VERSION: 1.10.1
BUILD_TYPE: Release
CCACHE_VERSION: 3.7.7

jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu Latest GCC",
artifact: "Linux.7z",
os: ubuntu-latest,
cc: "gcc",
cxx: "g++",
}

steps:
  - uses: actions/checkout@v1

  - name: Test bash
    shell: bash
    run: |
      echo Using host CMake version: ${CMAKE_VERSION}

  - name: Test cmake
    shell: cmake -P {0}
    run: |
      message(STATUS "hello from cmake script")

Executing the above results in the following error:

$ ~/prgs/nektos/forks/act/act
[CMake Build Matrix/Ubuntu Latest GCC] 🧪 Matrix: map[config:map[artifact:Linux.7z cc:gcc cxx:g++ name:Ubuntu Latest GCC os:ubuntu-latest]]
[CMake Build Matrix/Ubuntu Latest GCC] 🚀 Start image=ubuntu-with-hello
[CMake Build Matrix/Ubuntu Latest GCC] 🐳 docker run image=ubuntu-with-hello entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[CMake Build Matrix/Ubuntu Latest GCC] 🐳 docker cp src=/home/wink/prgs/cmake/projects/gha-cmake-HelloWorld/. dst=/github/workspace
[CMake Build Matrix/Ubuntu Latest GCC] Run actions/checkout@v1
[CMake Build Matrix/Ubuntu Latest GCC] Success - actions/checkout@v1
[CMake Build Matrix/Ubuntu Latest GCC] Run Test bash
| Using host CMake version: 3.18.3
[CMake Build Matrix/Ubuntu Latest GCC] Success - Test bash
[CMake Build Matrix/Ubuntu Latest GCC] Run Test cmake
| CMake Error at /github/workflow/2:1:
| Parse error. Expected a command name, got unquoted argument with text
| "PATH=":${PATH}"".
|
|
| CMake Error: Error processing file: /github/workflow/2
[CMake Build Matrix/Ubuntu Latest GCC] Failure - Test cmake
Error: exit with FAILURE: 1

With this change the output is:

$ ~/prgs/nektos/forks/act/act
[CMake Build Matrix/Ubuntu Latest GCC] 🧪 Matrix: map[config:map[artifact:Linux.7z cc:gcc cxx:g++ name:Ubuntu Latest GCC os:ubuntu-latest]]
[CMake Build Matrix/Ubuntu Latest GCC] 🚀 Start image=ubuntu-with-hello
[CMake Build Matrix/Ubuntu Latest GCC] 🐳 docker run image=ubuntu-with-hello entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[CMake Build Matrix/Ubuntu Latest GCC] 🐳 docker cp src=/home/wink/prgs/cmake/projects/gha-cmake-HelloWorld/. dst=/github/workspace
[CMake Build Matrix/Ubuntu Latest GCC] Run actions/checkout@v1
[CMake Build Matrix/Ubuntu Latest GCC] Success - actions/checkout@v1
[CMake Build Matrix/Ubuntu Latest GCC] Run Test bash
| Using host CMake version: 3.18.3
[CMake Build Matrix/Ubuntu Latest GCC] Success - Test bash
[CMake Build Matrix/Ubuntu Latest GCC] Run Test cmake
| -- hello from cmake script
[CMake Build Matrix/Ubuntu Latest GCC] Success - Test cmake


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/nektos/act/pull/405 **Author:** [@winksaville](https://github.com/winksaville) **Created:** 11/1/2020 **Status:** ❌ Closed **Base:** `master` ← **Head:** `Special-handling-cmake-scripts` --- ### 📝 Commits (1) - [`4820769`](https://github.com/nektos/act/commit/4820769ba13144ee9cdfd994162555fe9997778d) Special handling of cmake scripts ### 📊 Changes **1 file changed** (+6 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `pkg/runner/step_context.go` (+6 -3) </details> ### 📄 Description This fix only works with cmake, but I suspect other scripting languages would have similar problems. I'm hoping there is a better solution, but something like this does work for my particular problem. The problem is having the first line of scripts be: Path="xxx:${PATH}" where xxx is rc.ExtraPath, does not work for all scripting languages. For example: 'cmake -P {0}' is used by Cristian Adam HelloWorld: https://github.com/cristianadam/HelloWorld/blob/master/.github/workflows/build_cmake.yml#:~:text=shell: Here is some test code: name: CMake Build Matrix on: [push, pull_request] env: CMAKE_VERSION: 3.18.3 NINJA_VERSION: 1.10.1 BUILD_TYPE: Release CCACHE_VERSION: 3.7.7 jobs: build: name: ${{ matrix.config.name }} runs-on: ${{ matrix.config.os }} strategy: fail-fast: false matrix: config: - { name: "Ubuntu Latest GCC", artifact: "Linux.7z", os: ubuntu-latest, cc: "gcc", cxx: "g++", } steps: - uses: actions/checkout@v1 - name: Test bash shell: bash run: | echo Using host CMake version: ${CMAKE_VERSION} - name: Test cmake shell: cmake -P {0} run: | message(STATUS "hello from cmake script") Executing the above results in the following error: $ ~/prgs/nektos/forks/act/act [CMake Build Matrix/Ubuntu Latest GCC] 🧪 Matrix: map[config:map[artifact:Linux.7z cc:gcc cxx:g++ name:Ubuntu Latest GCC os:ubuntu-latest]] [CMake Build Matrix/Ubuntu Latest GCC] 🚀 Start image=ubuntu-with-hello [CMake Build Matrix/Ubuntu Latest GCC] 🐳 docker run image=ubuntu-with-hello entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [CMake Build Matrix/Ubuntu Latest GCC] 🐳 docker cp src=/home/wink/prgs/cmake/projects/gha-cmake-HelloWorld/. dst=/github/workspace [CMake Build Matrix/Ubuntu Latest GCC] ⭐ Run actions/checkout@v1 [CMake Build Matrix/Ubuntu Latest GCC] ✅ Success - actions/checkout@v1 [CMake Build Matrix/Ubuntu Latest GCC] ⭐ Run Test bash | Using host CMake version: 3.18.3 [CMake Build Matrix/Ubuntu Latest GCC] ✅ Success - Test bash [CMake Build Matrix/Ubuntu Latest GCC] ⭐ Run Test cmake | CMake Error at /github/workflow/2:1: | Parse error. Expected a command name, got unquoted argument with text | "PATH=":${PATH}"". | | | CMake Error: Error processing file: /github/workflow/2 [CMake Build Matrix/Ubuntu Latest GCC] ❌ Failure - Test cmake Error: exit with `FAILURE`: 1 With this change the output is: $ ~/prgs/nektos/forks/act/act [CMake Build Matrix/Ubuntu Latest GCC] 🧪 Matrix: map[config:map[artifact:Linux.7z cc:gcc cxx:g++ name:Ubuntu Latest GCC os:ubuntu-latest]] [CMake Build Matrix/Ubuntu Latest GCC] 🚀 Start image=ubuntu-with-hello [CMake Build Matrix/Ubuntu Latest GCC] 🐳 docker run image=ubuntu-with-hello entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [CMake Build Matrix/Ubuntu Latest GCC] 🐳 docker cp src=/home/wink/prgs/cmake/projects/gha-cmake-HelloWorld/. dst=/github/workspace [CMake Build Matrix/Ubuntu Latest GCC] ⭐ Run actions/checkout@v1 [CMake Build Matrix/Ubuntu Latest GCC] ✅ Success - actions/checkout@v1 [CMake Build Matrix/Ubuntu Latest GCC] ⭐ Run Test bash | Using host CMake version: 3.18.3 [CMake Build Matrix/Ubuntu Latest GCC] ✅ Success - Test bash [CMake Build Matrix/Ubuntu Latest GCC] ⭐ Run Test cmake | -- hello from cmake script [CMake Build Matrix/Ubuntu Latest GCC] ✅ Success - Test cmake --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-01 21:51:10 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#1436
No description provided.