.gitlab-ci.yml 1.83 KB
Newer Older
ashivani's avatar
ashivani committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
stages:
  - rails-update
  - test-baseline
  - submit-baseline

.aicrowd-setup: &aicrowd-setup
  image: python:3.8
  before_script:
    - git clone https://github.com/AIcrowd/aicrowd-cli.git && cd aicrowd-cli
    - pip install -r requirements.txt
    - python setup.py develop
    - cd ..
    - aicrowd evaluations login -e "${SUPER_USER_EMAIL}" -p "${SUPER_USER_PASSWORD}"

rails-update:
  stage: rails-update
  image: python:3.8-slim
  before_script:
    - pip install pyyaml requests markdown
  script:
    - python utils.py
  only:
    changes:
      - README.md
 
test-baseline: 
  stage: test-baseline
  image: python:3.8
  before_script: 
    - apt install curl
    - curl -o /usr/local/bin/jq http://stedolan.github.io/jq/download/linux64/jq && chmod +x /usr/local/bin/jq
    - pip install yq
    - pip install jupyter
  script:
    - export BASELINE=`yq -r .official_baseline aicrowd.yaml | awk -F. '{print $1}'`
    - jupyter nbconvert --to python baselines/${BASELINE}.ipynb
    - ipython baselines/${BASELINE}.py
  artifacts:
    paths:
      - submission.csv
  only:
    changes:
      - baselines/*

submit-baseline:
  stage: submit-baseline
  <<: *aicrowd-setup
  script:
    - apt install curl
    - curl -o /usr/local/bin/jq http://stedolan.github.io/jq/download/linux64/jq && chmod +x /usr/local/bin/jq
    - pip install yq
    - export CHALLENGE_NAME=`yq -r .challenge_name aicrowd.yaml`
    - export EVALUATIONS_API_TOKEN=`yq -r .aicrowd_evaluations_token ~/.aicrowd/config.yaml`
    - export GRADER_ID=`curl -k -X GET "https://evaluations-api.internal.k8s.aicrowd.com/v1/graders/?name=${CHALLENGE_NAME}" 
        -H "accept:application/json" 
        -H "AUTHORIZATION:${EVALUATIONS_API_TOKEN}" | jq '.[length-1].id'`  
    - aicrowd evaluations submission create --file ./submission.csv -g ${GRADER_ID} --wait
  only:
    changes:
      - baselines/*