今天来配置nodeJs的ci
1.配置yml
前端同事给的前端框架编译命令如下,不太懂,不管:
# install dependencies
$ npm install # Or yarn install
# serve with hot reload at localhost:3000
$ npm run dev
# build for production and launch server
$ npm run build
$ npm start
# generate static project
$ npm run generate
直接gitLab中找到项目,setup-ci
stages:
- compile
- test-deploy
- deploy
before_script:
- echo 'no redis'
- echo 'no DB'
- npm install
compile_codes:
stage: compile
script:
- npm run build
test_deploy:
stage: test-deploy
script:
- npm run lint
allow_failure: true
only:
- test
deploy:
stage: deploy
script:
- echo 'deployd!'
only:
- master
2.安装一个新的runner,专门给node项目使用
添加源
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.rpm.sh | sudo bash
安装