For this activity, we are going to use the gitlab environment to set up a CI (Continuous Integration) test environment.
Create a file named exactly .gitlab-ci.yml
at the top level of your repo. Note the .
at as the first character of the name!
Below, we show the content in the file. Copy this content into the file
image:
name: kalrabb/docker-swen-250-identifier-convention-chkr-img:latest
variables:
PROJECT_FOLDER: csv #Change this to your current folder/ project
BUILD_CMD: gcc -g -Wall -o test csv.c unit_tests.c #If you don't have a Makefile, put the build command here, else just call 'make'
RUN_CMD: valgrind --leak-check=full ./test #Assume the executable file is called 'test'
before_script:
- cat /etc/lsb-release
- which gcc
- which g++
- which valgrind
- which make
- cd $PROJECT_FOLDER
- pwd
- ulimit -n 1048576
- ulimit -a
testrunner:
script:
- echo "**Start build**"
- $BUILD_CMD #Runs make, or custom command
- $RUN_CMD #Runs the executable against valgrind
- echo "**Done**"
stage: test
Review the .yml file, and check the names for the $PROJECT_FOLDER, $BUILD_CMD and $RUN_CMD. The sample is set up for the assignment csv
. For other assignments, you would
need to change those variables to match the correct values.
Save the file, and run git status
. You should see the new .gitlab-ci.yml file
Go ahead and add, commit, push the file.
Go to gitlab, and find the CI/ CD menu (in the left side menu-bar)
You should see a button saying (hopefully) running or completed. Click on the button and look at the output