Skip to content

Instantly share code, notes, and snippets.

@thornbill
Created November 22, 2016 21:29
Show Gist options
  • Star 65 You must be signed in to star a gist
  • Fork 19 You must be signed in to fork a gist
  • Save thornbill/b4f44ac81106fd539d5f493a269bf25b to your computer and use it in GitHub Desktop.
Save thornbill/b4f44ac81106fd539d5f493a269bf25b to your computer and use it in GitHub Desktop.
Example Node GitLab CI Yamlfile
# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/node/tags/
image: node:6
before_script:
- npm install
# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
paths:
- node_modules/
test:lint:
script:
- npm run lint
test:vulnerabilities:
script:
- npm run vuln-test
# Supported node versions can be found here:
# https://github.com/nodejs/LTS#lts_schedule
# jest does not support node < 4
# https://facebook.github.io/jest/docs/troubleshooting.html#compatibility-issues
test:node:6:
script:
- npm install -g codecov
- npm run build
- npm test && codecov
test:node:7:
image: node:7
script:
- npm run build
- npm test
test:node:4:
image: node:4
script:
- npm run build
- npm test
# Publish tagged versions to npm
publish:
stage: deploy
only:
- tags
- triggers
script:
- npm run build
- echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}'>.npmrc
- npm publish
@dasra
Copy link

dasra commented Nov 10, 2017

the gitlab says that the configuration is not valid when I upload this file. It shows error the error " This GitLab CI configuration is invalid: (): did not find expected key while parsing a block mapping at line 3 column 1 Learn more". COuld you please help?

@bluemanos
Copy link

@thornbill can you share with us the package.json file. I'm interested in a scripts for lint and vuln-test

@Organizzzm
Copy link

Organizzzm commented Oct 11, 2018

And what about npm version and git push --follow-tags?

@feupeu
Copy link

feupeu commented Jul 18, 2019

@jeffhuys
Copy link

jeffhuys commented Nov 7, 2019

@Izhaki it might be that building in a different environment may not work / produce different results.
So, this is a good test to:

  1. check if that environment supports building this code at all / without any errors
  2. check if the code that this environments' build produces, works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment