dvmp:jpsi_central:generate:
  image: eicweb.phy.anl.gov:4567/monte_carlo/lager/lager:unstable
  stage: generate
  needs: []
  timeout: 1 hours
  cache:
    key:
      files:
        - dvmp/generator/jpsi_central.json
        - dvmp/scripts/jpsi_central-generate.sh
      prefix: "$CI_COMMIT_REF_SLUG"
    paths:
      - results/dvmp
  artifacts:
    paths:
      - results
  script:
    - ./dvmp/scripts/generate.sh --ebeam 10 --pbeam 100 --config jpsi_central --decay muon --decay electron

dvmp:jpsi_central:process:
  stage: process
  needs: ["detector", "dvmp:jpsi_central:generate"]
  dependencies:
    - detector
    - dvmp:jpsi_central:generate
  timeout: 1 hour
  script:
    - echo "Running the detector simulation"
    - touch results/dvmp/sim-stub
    - echo "Running the reconstruction"
    - touch results/dvmp/rec-stub
  artifacts:
    paths:
      - results

dvmp:jpsi_central:dummy_test:
  stage: analyze
  needs: ["dvmp:jpsi_central:process"]
  dependencies:
    - dvmp:jpsi_central:process
  script:
    - dvmp/scripts/dummy_test.sh

dvmp:jpsi_central:dummy_test2:
  stage: analyze
  needs: ["dvmp:jpsi_central:process"]
  dependencies:
    - dvmp:jpsi_central:process
  script:
    - dvmp/scripts/dummy_test2.sh

dvmp:jpsi_central:dummy_fail_test:
  stage: analyze
  needs: ["dvmp:jpsi_central:process"]
  dependencies:
    - dvmp:jpsi_central:process
  allow_failure: true
  script:
    - dvmp/scripts/dummy_fail_test.sh

dvmp:results:
  stage: collect
  needs: ["dvmp:jpsi_central:dummy_test",
          "dvmp:jpsi_central:dummy_test2",
          "dvmp:jpsi_central:dummy_fail_test"]
  script:
    - echo "All DVMP benchmarks successful"
