I recently built a CI for my course project in C. I made 3 stages, to build docker image, compile my C sources and run the said project.
That said, i think i could've do way better here but i don't really know how. I don't have a really big experience with CI, and even if that one works i would like to hear about what you think about it.
What i would like to improve is scalability, generality (there probably will be a need at some point to separate my dockerfiles per subproject (main-atoi is a subproject), ...
Source code here : Gitlab
Docker file
FROM debian:stretch
RUN apt-get update \
&& apt-get install gcc g++ -y
ADD ./ /home
VOLUME /home/build /home/build
.gitlab-ci.yml
stages:
- build-image
- build
- run
before_script:
- docker info
build-image:
stage: build-image
tags:
- build-docker
script:
- docker build -t artandor/debian9-cpp:v1-tp1 .
build:
stage: build
tags:
- cours
script:
- docker run -v /home/build:/home/build --rm artandor/debian9-cpp:v1-tp1 gcc -Wall -Werror /home/main-atoi/myatoibase.c /home/main-atoi/main-atoi.c -o /home/build/main-test
run:
stage: run
dependencies:
- build
tags:
- cours
script:
- docker run -v /home/build:/home/build --rm artandor/debian9-cpp:v1-tp1 /home/build/main-test
- cp /home/build/main-test ./
artifacts:
name: "Main Atoi Binary - $CI_COMMIT_REF_NAME"
paths:
- ./main-test
:-)
. Thanks for including the code; I hope you get good reviews (I'm not sufficiently skilled with Docker or Gitlab to answer it myself, I'm afraid). \$\endgroup\$