# For Debian/Ubuntu/Mint
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash
# For RHEL/CentOS/Fedora
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | sudo bash
# install
# For Debian/Ubuntu/Mint
sudo apt-get install gitlab-runner
# For RHEL/CentOS/Fedora
sudo yum install gitlab-runner
# for DEB based systems
apt-cache madison gitlab-runner
sudo apt-get install gitlab-runner=10.0.0
# for RPM based systems
yum list gitlab-runner --showduplicates | sort -r
sudo yum install gitlab-runner-10.0.0-1
# 定义 stages
stages:
- update
- test
- build
# 创建node_modules缓存,不用每次都重新安装依赖了
cache:
key: ${CI_BUILD_REF_NAME}
paths:
- node_modules/
# 更新代码并安装依赖
update:
stage: update
script:
- npm install
tags:
- update
# 执行单元测试
test:
stage: test
script:
- npm run test
tags:
- test
# 打包
build:
stage: build
script:
- npm run build
tags:
- build
dist目录下index.html打开空白页的解决方案
# 可以在log看到如下提示
# Tip: built files are meant to be served over an HTTP server.
# Opening index.html over file:// won't work.
# 全局安装http-server
npm install -g http-server
# 进入dist目录,启用
cd dist && hs