Skip to content

Instantly share code, notes, and snippets.

@DevOpsKev
Forked from renefs/gitlab-ci.yml
Created April 8, 2021 19:27
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 DevOpsKev/02633a07240f6cf6a3915609b9912590 to your computer and use it in GitHub Desktop.
Save DevOpsKev/02633a07240f6cf6a3915609b9912590 to your computer and use it in GitHub Desktop.
Ember Continuous Integration with Gitlab CI
stages:
- prepare
- test
- build
- deploy
variables:
EMBER_CLI_VERSION: "2.16.2"
BOWER_VERSION: "1.8.2"
PHANTOMJS_VERSION: "2.1.15"
install_dependencies:
image: node:6.10.2
stage: prepare
tags:
- docker
cache:
paths:
- node_modules
- bower_components
before_script:
- npm config set spin false
- npm install ember-cli@${EMBER_CLI_VERSION}
- npm install bower@${BOWER_VERSION}
- npm install phantomjs-prebuilt@${PHANTOMJS_VERSION}
script:
- npm install
- $(npm bin)/bower install --allow-root
artifacts:
paths:
- node_modules/
- bower_components/
test:
image: node:6.10.2
stage: test
tags:
- docker
cache:
paths:
- node_modules
- bower_components
before_script:
- set -xe
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
- echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
# Update packages
- apt-get update -yqqq
# Install Chrome browser
- apt-get install -y google-chrome-stable
# Install Virtual Display emulator
- apt-get install -y xvfb
script:
- xvfb-run -a npm test
build_production:
image: node:6.10.2
stage: build
only:
- master
tags:
- docker
script:
- $(npm bin)/ember build --environment production
- rm -rf public
- mkdir public
# Copy the generated web to the local public/ directory
- cp -r $CI_PROJECT_DIR/dist/* public/
artifacts:
paths:
- public
# Deploy the pages generated to DFS
dfsdeploy:
# Executed during the deploy stage
stage: deploy
# Only when the master branch is pushed
only:
- master
# Custom docker image providing the needed tools to deploy in DFS
image: gitlab-registry.cern.ch/ci-tools/ci-web-deployer:latest
script:
# Script that performs the deploy to DFS. Makes use of the variables defined in the project
# It will not sync the generated content with the folder in DFS (risk of deleting DFS management files)
# It will just override the contents of DFS or copy new files
- deploy-dfs
# do not run any globally defined before_script or after_script for this step
before_script: []
after_script: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment