Skip to content

Instantly share code, notes, and snippets.

@anushshukla
Created September 29, 2020 20:52
Show Gist options
  • Select an option

  • Save anushshukla/f6dcba1dbbb64549af32de58b86dc62d to your computer and use it in GitHub Desktop.

Select an option

Save anushshukla/f6dcba1dbbb64549af32de58b86dc62d to your computer and use it in GitHub Desktop.
image: node:10.13.0
stages:
- setup
- lint
- coverage
- deploy
cache:
untracked: true
key:
files:
- package.json
paths:
- node_modules/
install_dependencies:
stage: setup
script:
- npm install
only:
- merge_request
lint_check:
stage: lint
only:
- merge_request
before_script:
- echo ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
- echo ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}
- export CHANGED_FILES=`git diff --name-only --diff-filter=d origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}..origin/${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} -- '*.js'`
- echo ${CHANGED_FILES}
script:
- npm run lint-only ${CHANGED_FILES}
coverage:
stage: coverage
script:
- npm run test:coverage
artifacts:
paths:
- coverage/
expire_in: 1 year
allow_failure: true
only:
- merge_request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment