stages:
    - prepare-ci
    - download
    - compile
    - run-small
    - run
    - validate

.runner: &runner
    tags:
        - alfred, occigen

.variables: &smilei
    <<: *runner
    variables: 
        APP_NAME: "Smilei" 
    only:
        - develop

.download-app: &download-app
    stage: download
    script:
        - cd ${SCRATCHDIR}/abs/${CI_COMMIT_SHORT_SHA}/${APP_NAME}
        - ./download.sh

.compile-app: &compile-app
    stage: compile
    script:
        - cd ${SCRATCHDIR}/abs/${CI_COMMIT_SHORT_SHA}/${APP_NAME}
        - ./compile.sh occigen-bdw

.run-small: &run-small
    stage: run-small
    script:
        - cd ${SCRATCHDIR}/abs/${CI_COMMIT_SHORT_SHA}/${APP_NAME}/testcase_small
        - ./prepare.sh occigen-bdw
        - ./run.sh
    when: manual

.validate-small: &validate-small
    stage: validate
    script:
        - cd ${SCRATCHDIR}/abs/${CI_COMMIT_SHORT_SHA}/${APP_NAME}/testcase_small
        - ./validate.sh
    when: manual

#GLOBAL WORKFLOW
copy-files: 
    <<: *runner
    stage: prepare-ci
    script:
        - mkdir -p ${SCRATCHDIR}/abs/${CI_COMMIT_SHORT_SHA} 
        - cp -rip . $SCRATCHDIR/abs/$CI_COMMIT_SHORT_SHA 

dl-smilei:
    <<: *smilei
    <<: *download-app
compile-smilei:
    <<: *smilei
    <<: *compile-app
small-smilei:
    <<: *smilei
    <<: *run-small
validate-small-smilei:
    <<: *smilei
    <<: *validate-small
 



