Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.15 KiB
Newer Older
  • Learn to ignore specific revisions
  • image: python:3.8-buster
    
    David Trattnig's avatar
    David Trattnig committed
    
    stages:
    
    David Trattnig's avatar
    David Trattnig committed
      - bundle
    
    David Trattnig's avatar
    David Trattnig committed
      - deploy
    
    variables:
    
    David Trattnig's avatar
    David Trattnig committed
      API_ROOT_FILE: ./src/rest/swagger/swagger.yaml
    
    David Trattnig's avatar
    David Trattnig committed
      BUNDLED_JSON_FILE: ./public/api.json
    
    cache:
      paths:
        - ./node_modules
    
    bundle_and_test:
      stage: bundle
      before_script:
    
    David Trattnig's avatar
    David Trattnig committed
        - apt-get update
        - apt-get install -y curl
        - curl -sL https://deb.nodesource.com/setup_10.x | bash -
        - apt-get install -y nodejs
    
    David Trattnig's avatar
    David Trattnig committed
        - npm install -g @apidevtools/swagger-cli
    
      script:
        - mkdir public
        - swagger-cli bundle -t json $API_ROOT_FILE > $BUNDLED_JSON_FILE
        - swagger-cli validate $BUNDLED_JSON_FILE
    
      artifacts:
        paths:
          - public
        expire_in: 2 days
      only:
    
    David Trattnig's avatar
    David Trattnig committed
        - master
    
    David Trattnig's avatar
    David Trattnig committed
    # test_api:
    #   stage: test
    #   script:
    #     - pip3 install tox
    #     - tox
    
    David Trattnig's avatar
    David Trattnig committed
    pages:
      stage: deploy
      before_script:
    
        - apt-get update
        - apt-get install -y curl
        - curl -sL https://deb.nodesource.com/setup_10.x | bash -
        - apt-get install -y nodejs
    
    David Trattnig's avatar
    David Trattnig committed
        - npm install swagger-ui-dist@3.22.1
      script:
        - cp -rp node_modules/swagger-ui-dist/* ./public
        - 'sed -i "s@.*url.*@url: \"api.json\",@" ./public/index.html'
      artifacts:
        paths:
          - public
        expire_in: 2 days
      only:
    
    David Trattnig's avatar
    David Trattnig committed
        - master