# vim: set ts=4 sw=4 expandtab:
dramsys-gem5-build:
    stage: dramsys-gem5-build
    script:
        - git submodule sync
        - git submodule update --init --recursive
        - cd DRAMSys/tests/dramsys-gem5
        - git clone https://github.com/tukl-msd/gem5.TnT.git
        - cd gem5.TnT
        - ./get_essential_repos.sh
        - ./build_gem5.sh
        - export GEM5=${HOME}/gem5_tnt/gem5
        - export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${GEM5}/build/ARM
        - cd ../../../..
        - rm -rf build-dramsys-gem5
        - mkdir -p build-dramsys-gem5
        - cd build-dramsys-gem5
        - qmake ../DRAMSys/DRAMSys.pro
        - make -j$(cat /proc/cpuinfo | grep processor | wc -l) > build.log 2>&1
    cache:
        key: build
        paths:
            - build-dramsys-gem5/
            - DRAMSys/tests/dramsys-gem5/gem5.TnT
        policy: push

    # TODO: "allow_failure" should be removed as soon the server has
    # dependencies properly installed
    allow_failure: true

    artifacts:
        paths:
          - build-dramsys-gem5/build.log
        expire_in: 2 days

