Skip to content
Snippets Groups Projects
.gitlab-ci.yml 3.35 KiB
# CI pipeline configuration

default:
   image: gcc
   tags: development

# Switch from branch pipelines to merge request pipelines when a merge request is created
workflow:
  rules:
    # Ensures next rules do not block triggered pipelines
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
      when: never
    # always run for merge requests
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    # never run a branch pipeline if there is an open merge request for that branch
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
      when: never
    # the only allowed branch pipeline is that on the default branch
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

stages:
   - build
   - run
   - test

building_stage:
   stage: build
   allow_failure: false
   artifacts:
      paths:
         - build/cluster/*
         - build/sphere/*
         #- build/trapping/*
      exclude:
         - ".git*"
         - ".git/**/*"
      expire_in: 2 hours
   script:
      # bash commands to be executed
      - pwd
      - hostname
      - echo $CI_COMMIT_SHA
      - echo $CI_COMMIT_BRANCH
      - echo "Getting system info ..."
      - cat /etc/os-release
      - echo "/bin/g*"
      - ls /bin/g*
      - echo "/usr/bin/g*"
      - ls /usr/bin/g*
      - echo "/usr/local/bin/g*"
      - ls /usr/local/bin/g*
      #- cd src/sphere
      #- echo "Building SPHERE ..."
      #- gcc -O2 -lstdc++ -lm np_sphere.cpp sphere.cpp ../libnptm/Commons.cpp ../libnptm/Configuration.cpp ../libnptm/Parsers.cpp -o ../../build/sphere/np_sphere
      #- cd ../cluster
      #- echo "Building CLUSTER ..."
      #- gcc -O2 -lstdc++ -lm np_cluster.cpp cluster.cpp ../libnptm/Commons.cpp ../libnptm/Configuration.cpp ../libnptm/Parsers.cpp ../sphere/sphere.cpp -o ../../build/cluster/np_cluster

running_stage:
   stage: run
   allow_failure: false
   needs:
      - job: building_stage
   dependencies:
      - building_stage
   artifacts:
      paths:
         - build/cluster/c_*
         - build/sphere/c_*
         #- build/trapping/*