I have a two-stage CI flow which will build code automatically and run the unit test.
The first stage works well but I got an error in stage two.
Any hint for this?
Suppose the container remains exist in the second stage, and it can access cloned branch and built files there.
<code>stages:
- build
- test
build-code:
stage: build
tags:
- docker
script:
- echo "Current working directory:"
- pwd
- cd cpp
- mkdir -p build
- cd build
- cmake ..
- make -j12
cache:
paths:
- cpp/build
run-unittest:
stage: test
tags:
- docker
script:
- git clone https://github.com/google/googletest/
- cd googletest
- mkdir build
- cd build
- cmake ..
- make -j12
- sudo make install
- ls
</code>
<code>stages:
- build
- test
build-code:
stage: build
tags:
- docker
script:
- echo "Current working directory:"
- pwd
- cd cpp
- mkdir -p build
- cd build
- cmake ..
- make -j12
cache:
paths:
- cpp/build
run-unittest:
stage: test
tags:
- docker
script:
- git clone https://github.com/google/googletest/
- cd googletest
- mkdir build
- cd build
- cmake ..
- make -j12
- sudo make install
- ls
</code>
stages:
- build
- test
build-code:
stage: build
tags:
- docker
script:
- echo "Current working directory:"
- pwd
- cd cpp
- mkdir -p build
- cd build
- cmake ..
- make -j12
cache:
paths:
- cpp/build
run-unittest:
stage: test
tags:
- docker
script:
- git clone https://github.com/google/googletest/
- cd googletest
- mkdir build
- cd build
- cmake ..
- make -j12
- sudo make install
- ls