Reputation: 52
https://github.com/blguru20/capicxx-core-runtime/commit/d6a25e2873deed1fe7bb924fa8edd6872f03f17a
My learn-github-actions.yml file:
name: learn-github-actions
on: [push]
jobs:
check-bats-version:
runs-on: ubuntu-latest
steps:
- name : "create and enter build dir"
run: |
mkdir build
cd build
- name : "run cmake "
run: cmake ..
- name : "run make "
run: make
"cmake .. " failing though the corresponding folder contains CMakeLists.txt file.
Here is the error as shown on GitHub actions
2s
Run cmake ..
CMake Error: The source directory "/home/runner/work/capicxx-core-runtime" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
Error: Process completed with exit code 1.
Link to the repository :
https://github.com/blguru20/capicxx-core-runtime
This works in local machine
What is the issue with yml file?
Upvotes: 1
Views: 3100
Reputation: 6724
You are missing the checkout step of your repo. Also note the multiline command usage in the run section.
So your original script would look like this:
name: learn-github-actions
on: [push]
jobs:
check-bats-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: "create and enter build dir"
run: |
mkdir build
cd build
- name: "run cmake "
run: cmake ..
- name: "run make "
run: make
Additional to that you don't need to fiddle with creating a build dir and changing to it, CMake will do that for you. And using CMake's --build
command you are able to abstract the build tool call. When creating workflows try to be explicit with the CMake generator.
Your GitHub action script would then look like this:
name: learn-github-actions
on: [push]
jobs:
check-bats-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: "Create build directory and run CMake"
run: cmake -S . -B build -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
- name: "Build Project"
run: cmake --build build --target all --config Release -- -j4
Upvotes: 4