Skip to content

Instantly share code, notes, and snippets.

@AliMD
Created July 17, 2016 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AliMD/347c6f2a7509fafef6bc82e5f35be6f6 to your computer and use it in GitHub Desktop.
Save AliMD/347c6f2a7509fafef6bc82e5f35be6f6 to your computer and use it in GitHub Desktop.
Gitlab CI Build Configuration
# http://docs.gitlab.com/ce/ci/yaml/README.html
image: node:6
#services:
# - postgres
before_script:
- npm i
#after_script
#requires Gitlab Runner v1.2
stages:
# - build
- test
# - deploy
#1. First all jobs of build are executed in parallel.
#2. If all jobs of build succeed, the test jobs are executed in parallel.
#3. If all jobs of test succeed, the deploy jobs are executed in parallel.
#4. If all jobs of deploy succeed, the commit is marked as success.
#5. If any of the previous jobs fails, the commit is marked as failed and no jobs of further stage are executed.
variables:
#Variables can be also defined on job level.
GIT_STRATEGY: fetch
# or clone
# clone is slower, but makes sure you have a clean directory before every build
# fetch or clone only the last 3 commits
GIT_DEPTH: "3"
#You can also use ci vars in your scripts like $CI_BUILD_STAGE
#http://docs.gitlab.com/ce/ci/variables/README.html
#Cache all Git untracked files and files in build
cache:
#key: "$CI_BUILD_NAME"
untracked: true
paths:
- build/
#Jobs that start with a dot (.) will be not processed by GitLab CI
.job_sample:
stage: test
script:
- npm test
tags:
- docker
- node
only:
- master
- develope
cache:
#Locally defined cache overwrites globally defined options
paths:
- bower_components/
#Introduced in GitLab 8.9
#environment: development
#variables:
# DEBUG: "*"
#before_script:
# - echo 'Hello ;)'
#after_script:
# - echo 'Made with ♥ by ali.md'
job_test:
stage: test
script:
- npm test
tags:
- docker
- node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment