Commit cae760fa authored by Millian Poquet's avatar Millian Poquet

[ci] improve SoC: dedicated scripts in ./ci/

parent a9d7c0f7
......@@ -14,3 +14,4 @@ dump.rdb
.sshkeys
*.swp
*.dia~
.nixdeps
......@@ -3,25 +3,33 @@ image: oarteam/batsim_ci
variables:
GIT_SUBMODULE_STRATEGY: none
stages:
- dependencies
- build
- test
- deploy
###############################################################################
# Dependencies stage
###############################################################################
update_batsim_dependencies:
stage: dependencies
script:
- ./ci/generate-dependencies-paths.bash
- ./ci/update-dependencies-cache.bash
###############################################################################
# Build stage
###############################################################################
build:
stage: build
script:
- mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build
- |
nix-shell ${CI_PROJECT_DIR}/.ci-shell.nix \
--command "cmake .. \
-DCMAKE_BUILD_TYPE=Debug \
-Denable_warnings=ON \
-Dtreat_warnings_as_errors=OFF"
- nix-shell ${CI_PROJECT_DIR}/.ci-shell.nix --command "make"
- ./ci/build.bash
artifacts:
paths:
- /builds/batsim/batsim/build
dependencies:
- update_batsim_dependencies
###############################################################################
# Test stage
......@@ -41,23 +49,14 @@ test_doc:
test_test:
stage: test
script:
# Run the redis server
- nix-shell .ci-shell.nix --command "redis-server>/dev/null &"
- sleep 1
# Finally run the tests
- export PATH=${CI_PROJECT_DIR}/build:${PATH}
- |
nix-shell ${CI_PROJECT_DIR}/.ci-shell.nix \
--command "ctest --output-on-failure"
- ./ci/run-tests.bash
dependencies:
- build
test_unittest:
stage: test
script:
# Run unit tests
- ${CI_PROJECT_DIR}/build/batsim --unittest
- ./ci/run-tests.bash
dependencies:
- build
......
#!/usr/bin/env nix-shell
#! nix-shell -i bash ./default.nix
set -eux
# Start from a clean build directory
rm -rf ./build
mkdir -p ./build
# Usual cmake build stuff
cd ./build
cmake .. \
-DCMAKE_BUILD_TYPE=Debug \
-Denable_warnings=ON \
-Dtreat_warnings_as_errors=OFF
make -j $(nproc)
......@@ -10,7 +10,9 @@ with pkgs;
(batsim_dev.override {}).overrideAttrs (attrs: rec {
name = "batsim-ci";
src = ./.;
src = ../.;
enableParallelBuilding = true;
doCheck = false;
nativeBuildInputs = attrs.nativeBuildInputs ++ [nix];
})
#!/usr/bin/env nix-shell
#! nix-shell --pure -i bash ./default.nix
set -eu
# Remove previously generated dependencies
rm -f .nixdeps
# Retrieve the paths of the dependencies of the current shell
nix-env --query --out-path \
| sed -n -E 'sW^.*(/nix/store/[a-zA-Z0-9]{32}-[^ ]+).*$W\1Wp' \
> .nixdeps
# Print info
printf "Generated dependencies in .nixdeps:\n$(cat .nixdeps)\n"
#!/usr/bin/env nix-shell
#! nix-shell -i bash ./default.nix
# TODO: manage redis-server here
# Add built batsim in PATH
export PATH=$(realpath ./build):${PATH}
# Execute the tests
cd build
ctest
#!/usr/bin/env nix-shell
#! nix-shell -i bash ./default.nix
set -eux
# Execute the unit tests
./build/batsim --unittest
#!/usr/bin/env nix-shell
#! nix-shell -i bash ./default.nix
set -eu
# Avoid pushing everything on the binary cache
excluder='texlive|biber|pdftk|qpdf|pdfdiff|gitflow|cachix|nox|nix-2|dia|asymptote|direnv|yamldiff'
deps=$(cat .nixdeps | grep -E -v ${excluder})
printf "About to push paths:\n${deps}\n\n"
# Push non-excluded paths to the remote cache
cachix push batsim $(echo ${deps} | tr '\n' ' ')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment