|
| 1 | +stages: |
| 2 | + - Install |
| 3 | + - Static Tests |
| 4 | + - e2e Tests |
| 5 | + - Build |
| 6 | + - After e2e Tests |
| 7 | + |
| 8 | +cache: |
| 9 | + key: ${CI_COMMIT_REF_SLUG} |
| 10 | + paths: |
| 11 | + - .npm/ |
| 12 | + |
| 13 | +before_script: |
| 14 | + - npm -v |
| 15 | + - node -v |
| 16 | + - npm install --cache .npm --prefer-offline |
| 17 | + |
| 18 | +Check Docker Compose: |
| 19 | + stage: Install |
| 20 | + interruptible: true |
| 21 | + resource_group: docker-compose |
| 22 | + before_script: |
| 23 | + - '' |
| 24 | + cache: {} |
| 25 | + script: |
| 26 | + - docker -v |
| 27 | + - docker-compose -v |
| 28 | + - echo "rebuild docker-compose ONLY if config was changed" |
| 29 | + - cmp --silent docker-compose.yml ~/.runner-cache/docker-compose.yml || |
| 30 | + bash -c 'docker-compose down |
| 31 | + && docker-compose build |
| 32 | + && docker-compose -f docker-compose.yml -f docker-compose.docker.yml up -d |
| 33 | + && mkdir -p ~/.runner-cache |
| 34 | + && rm -rf ~/.runner-cache/docker-compose.yml |
| 35 | + && cp docker-compose.yml ~/.runner-cache/' |
| 36 | + - bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' 127.0.0.1:3000)" != "200" ]]; do |
| 37 | + if [[ $i < 31 ]] ; |
| 38 | + then i=$((i+1)) && sleep 5 && echo "slep... $i"; |
| 39 | + else exit 1; fi |
| 40 | + ; done' |
| 41 | + - npm install --no-package-lock --no-save --quiet node-fetch --prefer-offline |
| 42 | + - npm run service-status |
| 43 | + needs: [] |
| 44 | + only: |
| 45 | + variables: |
| 46 | + - '$CI_EXTERNAL_PULL_REQUEST_IID == null' |
| 47 | + |
| 48 | +Static Tests: |
| 49 | + stage: Static Tests |
| 50 | + interruptible: true |
| 51 | + script: |
| 52 | + - npm run lint -- --quiet |
| 53 | + - npm run test:unit -- --forceExit |
| 54 | + needs: [] |
| 55 | + only: |
| 56 | + variables: |
| 57 | + - '$CI_EXTERNAL_PULL_REQUEST_IID == null' |
| 58 | + |
| 59 | +e2e Tests: |
| 60 | + stage: e2e Tests |
| 61 | + interruptible: true |
| 62 | + script: |
| 63 | + - npm run test:i |
| 64 | + needs: ["Check Docker Compose"] |
| 65 | + when: on_success |
| 66 | + retry: 2 |
| 67 | + only: |
| 68 | + variables: |
| 69 | + - '$CI_EXTERNAL_PULL_REQUEST_IID == null' |
| 70 | + |
| 71 | +Test Docker Services: |
| 72 | + stage: After e2e Tests |
| 73 | + interruptible: true |
| 74 | + before_script: |
| 75 | + - '' |
| 76 | + cache: {} |
| 77 | + script: |
| 78 | + - npm install --no-package-lock --no-save --quiet node-fetch --prefer-offline |
| 79 | + - npm run service-status |
| 80 | + - ./scripts/checkDaos.sh |
| 81 | + needs: [ "e2e Tests" ] |
| 82 | + when: on_success |
| 83 | + retry: 2 |
| 84 | + only: |
| 85 | + variables: |
| 86 | + - '$CI_EXTERNAL_PULL_REQUEST_IID == null' |
| 87 | + |
| 88 | +Build: |
| 89 | + stage: Build |
| 90 | + interruptible: true |
| 91 | + script: |
| 92 | + - npm run build-travis |
| 93 | + needs: ["Static Tests"] |
| 94 | + only: |
| 95 | + variables: |
| 96 | + - '$CI_EXTERNAL_PULL_REQUEST_IID == null' |
0 commit comments