I'm following this tutorial. I've done all the needed steps with no errors using below workflow (as shown in the tutorial):
name: C/C++ CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install cppunit
run: sudo apt install -y libcppunit-dev
- name: configure
run: ./configure
- name: make
run: make
- name: make test
run: make test
The Actions tab on my GitHub repo reports no errors.
Why is there no hello executable found in the repo while the workflow clearly includes the compilation step (g++ -std=c++17 hello.cpp -o hello
)? Since there was no errors, why isn't the executable file "produced" as a workflow "conclusion"?
Here is the Makefile
used:
all:
g++ -std=c++17 hello.cpp -o hello
g++ -std=c++17 helloTest.cpp -lcppunit -o helloTest
test:
chmod +x hello
./helloTest
clean:
$(RM) hello helloTest
Why is there no hello executable found in the repo while the workflow clearly includes the compilation step (g++ -std=c++17 hello.cpp -o hello)? Since there was no errors, why isn't the executable file "produced" as a workflow "conclusion"?
Like any untracked and uncommitted changes, they are simply thrown away.
You could commit them, but it's inappropriate to commit executables to a source repository. Instead, store them as "artifacts" attached to the workflow.
Add a call to upload-artifact
to your build-and-test job.
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: compiled executable
path: hello
You can then use the executable in other parts of your workflow, or download your executable as an artifact of the workflow.