Commit 0d287b06 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch '17521-gitlab-ci-yml-templates' into 'master'

GitLab CI Yaml template dropdown

## What does this MR do?
Make it possible to select a dropdown for an easy start with GitLab CI.

## What are the relevant issue numbers?
Closes #17521

## TODO
- [ ] Backend
  - [x] CHANGELOG item
  - [x] Fix rubocop failure
  - [x] API Support
  - [x] New tests
  - [x] Add disclaimer to the top of the gitlab-ci.yml
- [ ] Frontend
  - [x] New tests

See merge request !4411
parents f90c8c62 35383f33
......@@ -105,6 +105,7 @@ v 8.9.0 (unreleased)
- An indicator is now displayed at the top of the comment field for confidential issues.
- Show categorised search queries in the search autocomplete
- RepositoryCheck::SingleRepositoryWorker public and private methods are now instrumented
- Dropdown for `.gitlab-ci.yml` templates
- Improve issuables APIs performance when accessing notes !4471
- Add sorting dropdown to tags page !4423
- External links now open in a new tab
......
......@@ -7,6 +7,7 @@
labelsPath: "/api/:version/projects/:id/labels"
licensePath: "/api/:version/licenses/:key"
gitignorePath: "/api/:version/gitignores/:key"
gitlabCiYmlPath: "/api/:version/gitlab_ci_ymls/:key"
group: (group_id, callback) ->
url = Api.buildUrl(Api.groupPath)
......@@ -110,6 +111,12 @@
$.get url, (gitignore) ->
callback(gitignore)
gitlabCiYml: (key, callback) ->
url = Api.buildUrl(Api.gitlabCiYmlPath).replace(':key', key)
$.get url, (file) ->
callback(file)
buildUrl: (url) ->
url = gon.relative_url_root + url if gon.relative_url_root?
return url.replace(':version', gon.api_version)
#= require blob/template_selector
class @BlobCiYamlSelector extends TemplateSelector
requestFile: (query) ->
Api.gitlabCiYml query.name, @requestFileSuccess.bind(@)
class @BlobCiYamlSelectors
constructor: (opts) ->
{
@$dropdowns = $('.js-gitlab-ci-yml-selector')
@editor
} = opts
@$dropdowns.each (i, dropdown) =>
$dropdown = $(dropdown)
new BlobCiYamlSelector(
pattern: /(.gitlab-ci.yml)/,
data: $dropdown.data('data'),
wrapper: $dropdown.closest('.js-gitlab-ci-yml-selector-wrap'),
dropdown: $dropdown,
editor: @editor
)
......@@ -15,6 +15,7 @@ class @EditBlob
new BlobLicenseSelectors { @editor }
new BlobGitignoreSelectors { @editor }
new BlobCiYamlSelectors { @editor }
initModePanesAndLinks: ->
@$editModePanes = $(".js-edit-mode-pane")
......
......@@ -60,13 +60,14 @@
.encoding-selector,
.license-selector,
.gitignore-selector {
.gitignore-selector,
.gitlab-ci-yml-selector {
display: inline-block;
vertical-align: top;
font-family: $regular_font;
}
.gitignore-selector, .license-selector {
.gitignore-selector, .license-selector, .gitlab-ci-yml-selector {
.dropdown {
line-height: 21px;
}
......@@ -76,4 +77,10 @@
width: 220px;
}
}
.gitlab-ci-yml-selector {
.dropdown-menu-toggle {
width: 250px;
}
}
}
......@@ -186,12 +186,16 @@ module BlobHelper
end
def gitignore_names
return @gitignore_names if defined?(@gitignore_names)
@gitignore_names ||=
Gitlab::Template::Gitignore.categories.keys.map do |k|
[k, Gitlab::Template::Gitignore.by_category(k).map { |t| { name: t.name } }]
end.to_h
end
@gitignore_names = {
Global: Gitlab::Gitignore.global.map { |gitignore| { name: gitignore.name } },
# Note that the key here doesn't cover it really
Languages: Gitlab::Gitignore.languages_frameworks.map{ |gitignore| { name: gitignore.name } }
}
def gitlab_ci_ymls
@gitlab_ci_ymls ||=
Gitlab::Template::GitlabCiYml.categories.keys.map do |k|
[k, Gitlab::Template::GitlabCiYml.by_category(k).map { |t| { name: t.name } }]
end.to_h
end
end
......@@ -17,6 +17,8 @@
= dropdown_tag("Choose a License template", options: { toggle_class: 'js-license-selector', title: "Choose a license", filter: true, placeholder: "Filter", data: { data: licenses_for_select, project: @project.name, fullname: @project.namespace.human_name } } )
.gitignore-selector.js-gitignore-selector-wrap.hidden
= dropdown_tag("Choose a .gitignore template", options: { toggle_class: 'js-gitignore-selector', title: "Choose a template", filter: true, placeholder: "Filter", data: { data: gitignore_names } } )
.gitlab-ci-yml-selector.js-gitlab-ci-yml-selector-wrap.hidden
= dropdown_tag("Choose a GitLab CI Yaml template", options: { toggle_class: 'js-gitlab-ci-yml-selector', title: "Choose a template", filter: true, placeholder: "Filter", data: { data: gitlab_ci_ymls } } )
.encoding-selector
= select_tag :encoding, options_for_select([ "base64", "text" ], "text"), class: 'select2'
......
......@@ -57,6 +57,10 @@
%li.missing
= link_to add_special_file_path(@project, file_name: 'CONTRIBUTING.md', commit_message: 'Add contribution guide') do
Add Contribution guide
- unless @repository.gitlab_ci_yml
%li.missing
= link_to add_special_file_path(@project, file_name: '.gitlab-ci.yml') do
Set up CI
- if @repository.commit
.content-block.second-block.white
......
......@@ -33,7 +33,6 @@ module API
mount ::API::Commits
mount ::API::DeployKeys
mount ::API::Files
mount ::API::Gitignores
mount ::API::GroupMembers
mount ::API::Groups
mount ::API::Internal
......@@ -58,6 +57,7 @@ module API
mount ::API::Subscriptions
mount ::API::SystemHooks
mount ::API::Tags
mount ::API::Templates
mount ::API::Triggers
mount ::API::Users
mount ::API::Variables
......
......@@ -473,11 +473,11 @@ module API
expose :content
end
class GitignoresList < Grape::Entity
class TemplatesList < Grape::Entity
expose :name
end
class Gitignore < Grape::Entity
class Template < Grape::Entity
expose :name, :content
end
end
......
module API
class Gitignores < Grape::API
# Get the list of the available gitignore templates
#
# Example Request:
# GET /gitignores
get 'gitignores' do
present Gitlab::Gitignore.all, with: Entities::GitignoresList
end
# Get the text for a specific gitignore
#
# Parameters:
# name (required) - The name of a license
#
# Example Request:
# GET /gitignores/Elixir
#
get 'gitignores/:name' do
required_attributes! [:name]
gitignore = Gitlab::Gitignore.find(params[:name])
not_found!('.gitignore') unless gitignore
present gitignore, with: Entities::Gitignore
end
end
end
module API
class Templates < Grape::API
TEMPLATE_TYPES = {
gitignores: Gitlab::Template::Gitignore,
gitlab_ci_ymls: Gitlab::Template::GitlabCiYml
}.freeze
TEMPLATE_TYPES.each do |template, klass|
# Get the list of the available template
#
# Example Request:
# GET /gitignores
# GET /gitlab_ci_ymls
get template.to_s do
present klass.all, with: Entities::TemplatesList
end
# Get the text for a specific template
#
# Parameters:
# name (required) - The name of a template
#
# Example Request:
# GET /gitignores/Elixir
# GET /gitlab_ci_ymls/Ruby
get "#{template}/:name" do
required_attributes! [:name]
new_template = klass.find(params[:name])
not_found!(template.to_s.singularize) unless new_template
present new_template, with: Entities::Template
end
end
end
end
module Gitlab
class Gitignore
FILTER_REGEX = /\.gitignore\z/.freeze
def initialize(path)
@path = path
end
def name
File.basename(@path, '.gitignore')
end
def content
File.read(@path)
end
class << self
def all
languages_frameworks + global
end
def find(key)
file_name = "#{key}.gitignore"
directory = select_directory(file_name)
directory ? new(File.join(directory, file_name)) : nil
end
def global
files_for_folder(global_dir).map { |file| new(File.join(global_dir, file)) }
end
def languages_frameworks
files_for_folder(gitignore_dir).map { |file| new(File.join(gitignore_dir, file)) }
end
private
def select_directory(file_name)
[gitignore_dir, global_dir].find { |dir| File.exist?(File.join(dir, file_name)) }
end
def global_dir
File.join(gitignore_dir, 'Global')
end
def gitignore_dir
Rails.root.join('vendor/gitignore')
end
def files_for_folder(dir)
Dir.glob("#{dir.to_s}/*.gitignore").map { |file| file.gsub(FILTER_REGEX, '') }
end
end
end
end
module Gitlab
module Template
class BaseTemplate
def initialize(path)
@path = path
end
def name
File.basename(@path, self.class.extension)
end
def content
File.read(@path)
end
class << self
def all
self.categories.keys.flat_map { |cat| by_category(cat) }
end
def find(key)
file_name = "#{key}#{self.extension}"
directory = select_directory(file_name)
directory ? new(File.join(category_directory(directory), file_name)) : nil
end
def categories
raise NotImplementedError
end
def extension
raise NotImplementedError
end
def base_dir
raise NotImplementedError
end
def by_category(category)
templates_for_directory(category_directory(category))
end
def category_directory(category)
File.join(base_dir, categories[category])
end
private
def select_directory(file_name)
categories.keys.find do |category|
File.exist?(File.join(category_directory(category), file_name))
end
end
def templates_for_directory(dir)
dir << '/' unless dir.end_with?('/')
Dir.glob(File.join(dir, "*#{self.extension}")).select { |f| f =~ filter_regex }.map { |f| new(f) }
end
def filter_regex
@filter_reges ||= /#{Regexp.escape(extension)}\z/
end
end
end
end
end
module Gitlab
module Template
class Gitignore < BaseTemplate
class << self
def extension
'.gitignore'
end
def categories
{
"Languages" => '',
"Global" => 'Global'
}
end
def base_dir
Rails.root.join('vendor/gitignore')
end
end
end
end
end
module Gitlab
module Template
class GitlabCiYml < BaseTemplate
def content
explanation = "# This file is a template, and might need editing before it works on your project."
[explanation, super].join("\n")
end
class << self
def extension
'.gitlab-ci.yml'
end
def categories
{
"General" => '',
"Pages" => 'Pages'
}
end
def base_dir
Rails.root.join('vendor/gitlab-ci-yml')
end
end
end
end
end
namespace :gitlab do
desc "GitLab | Update gitignore"
task :update_gitignore do
unless clone_gitignores
puts "Cloning the gitignores failed".color(:red)
return
end
remove_unneeded_files(gitignore_directory)
remove_unneeded_files(global_directory)
puts "Done".color(:green)
end
def clone_gitignores
FileUtils.rm_rf(gitignore_directory) if Dir.exist?(gitignore_directory)
FileUtils.cd vendor_directory
system('git clone --depth=1 --branch=master https://github.com/github/gitignore.git')
end
# Retain only certain files:
# - The LICENSE, because we have to
# - The sub dir global
# - The gitignores themself
# - Dir.entires returns also the entries '.' and '..'
def remove_unneeded_files(path)
Dir.foreach(path) do |file|
FileUtils.rm_rf(File.join(path, file)) unless file =~ /(\.{1,2}|LICENSE|Global|\.gitignore)\z/
end
end
private
def vendor_directory
Rails.root.join('vendor')
end
def gitignore_directory
File.join(vendor_directory, 'gitignore')
end
def global_directory
File.join(gitignore_directory, 'Global')
end
end
namespace :gitlab do
desc "GitLab | Update templates"
task :update_templates do
TEMPLATE_DATA.each { |template| update(template) }
end
def update(template)
sub_dir = template.repo_url.match(/([a-z-]+)\.git\z/)[1]
dir = File.join(vendor_directory, sub_dir)
unless clone_repository(template.repo_url, dir)
puts "Cloning the #{sub_dir} templates failed".red
return
end
remove_unneeded_files(dir, template.cleanup_regex)
puts "Done".green
end
def clone_repository(url, directory)
FileUtils.rm_rf(directory) if Dir.exist?(directory)
system("git clone #{url} --depth=1 --branch=master #{directory}")
end
# Retain only certain files:
# - The LICENSE, because we have to
# - The sub dirs so we can organise the file by category
# - The templates themself
# - Dir.entries returns also the entries '.' and '..'
def remove_unneeded_files(directory, regex)
Dir.foreach(directory) do |file|
FileUtils.rm_rf(File.join(directory, file)) unless file =~ regex
end
end
private
Template = Struct.new(:repo_url, :cleanup_regex)
TEMPLATE_DATA = [
Template.new(
"https://github.com/github/gitignore.git",
/(\.{1,2}|LICENSE|Global|\.gitignore)\z/
),
Template.new(
"https://gitlab.com/gitlab-org/gitlab-ci-yml.git",
/(\.{1,2}|LICENSE|Pages|\.gitlab-ci.yml)\z/
)
]
def vendor_directory
Rails.root.join('vendor')
end
end
require 'spec_helper'
feature 'User wants to add a .gitlab-ci.yml file', feature: true do
include WaitForAjax
before do
user = create(:user)
project = create(:project)
project.team << [user, :master]
login_as user
visit namespace_project_new_blob_path(project.namespace, project, 'master', file_name: '.gitlab-ci.yml')
end
scenario 'user can see .gitlab-ci.yml dropdown' do
expect(page).to have_css('.gitlab-ci-yml-selector')
end
scenario 'user can pick a template from the dropdown', js: true do
find('.js-gitlab-ci-yml-selector').click
wait_for_ajax
within '.gitlab-ci-yml-selector' do
find('.dropdown-input-field').set('jekyll')
find('.dropdown-content li', text: 'jekyll').click
end
wait_for_ajax
expect(page).to have_content('This file is a template, and might need editing before it works on your project')
expect(page).to have_content('jekyll build -d test')
end
end
require 'spec_helper'
describe Gitlab::Gitignore do
subject { Gitlab::Gitignore }
describe Gitlab::Template::Gitignore do
subject { described_class }
describe '.all' do
it 'strips the gitignore suffix' do
......@@ -24,7 +24,7 @@ describe Gitlab::Gitignore do
it 'returns the Gitignore object of a valid file' do
ruby = subject.find('Ruby')
expect(ruby).to be_a Gitlab::Gitignore
expect(ruby).to be_a Gitlab::Template::Gitignore
expect(ruby.name).to eq('Ruby')
end
end
......
require 'spec_helper'
describe API::Gitignores, api: true do
describe API::Templates, api: true do
include ApiHelpers
describe 'Entity Gitignore' do
describe 'the Template Entity' do
before { get api('/gitignores/Ruby') }
it { expect(json_response['name']).to eq('Ruby') }
it { expect(json_response['content']).to include('*.gem') }
end
describe 'Entity GitignoresList' do
describe 'the TemplateList Entity' do
before { get api('/gitignores') }
it { expect(json_response.first['name']).not_to be_nil }
it { expect(json_response.first['content']).to be_nil }
end
describe 'GET /gitignores' do
it 'returns a list of available license templates' do
get api('/gitignores')
context 'requesting gitignores' do
describe 'GET /gitignores' do
it 'returns a list of available gitignore templates' do
get api('/gitignores')
expect(response.status).to eq(200)
expect(json_response).to be_an Array
expect(json_response.size).to be > 15
end
end
end
context 'requesting gitlab-ci-ymls' do
describe 'GET /gitlab_ci_ymls' do
it 'returns a list of available gitlab_ci_ymls' do
get api('/gitlab_ci_ymls')
expect(response.status).to eq(200)
expect(json_response).to be_an Array
expect(json_response.first['name']).not_to be_nil
end
end
end
describe 'GET /gitlab_ci_ymls/Ruby' do
it 'adds a disclaimer on the top' do
get api('/gitlab_ci_ymls/Ruby')
expect(response.status).to eq(200)
expect(json_response).to be_an Array
expect(json_response.size).to be > 15
expect(json_response['content']).to start_with("# This file is a template,")
end
end
end
......@@ -2,7 +2,7 @@
*.apk
*.ap_
# Files for the Dalvik VM
# Files for the ART/Dalvik VM
*.dex
# Java class files
......@@ -34,6 +34,7 @@ captures/
# Intellij
*.iml
.idea/workspace.xml
# Keystore files
*.jks
......@@ -15,6 +15,7 @@
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
......
......@@ -4,3 +4,4 @@ CMakeScripts
Makefile
cmake_install.cmake
install_manifest.txt
CTestTestfile.cmake
......@@ -18,3 +18,7 @@
.dub
docs.json
__dummy.html
docs/
# Code coverage
*.lst
.DS_Store
*.DS_Store
.AppleDouble
.LSOverride
......@@ -15,6 +15,7 @@ Icon
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
......
## Globally Useful gitignores
This directory contains globally useful gitignores,
e.g. OS-specific and editor specific.
For more on global gitignores:
<https://help.github.com/articles/ignoring-files/#create-a-global-gitignore>
And a good blog post about 'em:
<http://augustl.com/blog/2009/global_gitignores>
......@@ -12,3 +12,16 @@
# sftp configuration file
sftp-config.json
# Package control specific files
Package Control.last-run
Package Control.ca-list
Package Control.ca-bundle
Package Control.system-ca-bundle
Package Control.cache/
Package Control.ca-certs/
bh_unicode_properties.cache
# Sublime-github package stores a github token in this file
# https://packagecontrol.io/packages/sublime-github
GitHub.sublime-settings
......@@ -16,3 +16,4 @@ cabal.sandbox.config
*.hp
*.eventlog
.stack-work/
cabal.project.local
*.jl.cov
*.jl.*.cov
*.jl.mem
deps/deps.jl
Copyright (c) 2016 GitHub, Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
......@@ -7,7 +7,6 @@ app/storage/
# Laravel 5 & Lumen specific
bootstrap/cache/
storage/
.env.*.php
.env.php
.env
......
......@@ -24,6 +24,8 @@ xcuserdata/
## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
# CocoaPods
#
......@@ -49,3 +51,10 @@ Carthage/Build
fastlane/report.xml
fastlane/screenshots
#Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode
iOSInjectionProject/
......@@ -34,5 +34,5 @@ Makefile*
*.qmlproject.user.*
# QtCtreator CMake
CMakeLists.txt.user
CMakeLists.txt.user*
# .gitignore templates
This directory contains language-specific .gitignore templates that are used by GitLab.
These files were automatically pulled from [this repository](https://github.com/github/gitignore).
Please submit pull requests to that repository. There is no need to edit the files in this directory.
## Bulk Update
To update this directory with the latest changes in the repository, run:
```sh
bundle exec rake gitlab:update_gitignore
```
......@@ -16,6 +16,10 @@ pickle-email-*.html
config/initializers/secret_token.rb
config/secrets.yml
# dotenv
# TODO Comment out this rule if environment variables can be committed
.env
## Environment normalization:
/.bundle
/vendor/bundle
......
......@@ -24,6 +24,8 @@ xcuserdata/
## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
## Playgrounds
timeline.xctimeline
......
......@@ -37,6 +37,7 @@
*.suo
*.opensdf
*.sdf
*.VC.db
*.VC.opendb
# Precompiled Assets
......
......@@ -42,6 +42,7 @@ dlldata.c
# DNX
project.lock.json
project.fragment.lock.json
artifacts/
*_i.c
......
# Official docker image.
image: docker:latest
build:
stage: build
script:
- docker build -t test .
# This template uses the non default language docker image
# The image already has Hex installed. You might want to consider to use `elixir:latest`
image: trenpixster/elixir:latest
# Pic zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-service
services:
- mysql:latest
- redis:latest
- postgres:latest
before_script:
- mix deps.get
mix:
script:
- mix test
The MIT License (MIT)
Copyright (c) 2016 GitLab.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/node/tags/
image: node:latest
# Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-service
services:
- mysql:latest
- redis:latest
- postgres:latest
# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
paths:
- node_modules/
test_async:
script:
- npm install
- node ./specs/start.js ./specs/async.spec.js
test_db:
script:
- npm install
- node ./specs/start.js ./specs/db-postgres.spec.js
# Full project: https://gitlab.com/pages/brunch
image: node:4.2.2
pages:
cache:
paths:
- node_modules/
script:
- npm install -g brunch
- brunch build --production
artifacts:
paths:
- public
only:
- master
# Full project: https://gitlab.com/pages/doxygen
image: alpine
pages:
script:
- apk update && apk add doxygen
- doxygen doxygen/Doxyfile
- mv doxygen/documentation/html/ public/
artifacts:
paths:
- public
only:
- master
# Full project: https://gitlab.com/pages/harp
image: node:4.2.2
pages:
cache:
paths:
- node_modules
script:
- npm install -g harp
- harp compile ./ public
artifacts:
paths:
- public
only:
- master
# Full project: https://gitlab.com/pages/hexo
image: python:2.7
cache:
paths:
- vendor/
test:
stage: test
script:
- pip install hyde
- hyde gen
except:
- master
pages:
stage: deploy
script:
- pip install hyde
- hyde gen -d public
artifacts:
paths:
- public
only:
- master
# Full project: https://gitlab.com/pages/plain-html
pages:
stage: deploy
script:
- mkdir .public
- cp -r * .public
- mv .public public
artifacts:
paths:
- public
only:
- master
# Full project: https://gitlab.com/pages/hugo
image: publysher/hugo
pages:
script:
- hugo
artifacts:
paths:
- public
only:
- master
# Full project: https://gitlab.com/pages/hyde
image: python:2.7
cache:
paths:
- vendor/
test:
stage: test
script:
- pip install hyde
- hyde gen
except:
- master
pages:
stage: deploy
script:
- pip install hyde
- hyde gen -d public
artifacts:
paths:
- public
only:
- master
# Full project: https://gitlab.com/pages/jekyll
image: ruby:2.3
test:
stage: test
script:
- gem install jekyll
- jekyll build -d test
artifacts:
paths:
- test
except:
- master
pages:
stage: deploy
script:
- gem install jekyll
- jekyll build -d public
artifacts:
paths:
- public
only:
- master
# Full project: https://gitlab.com/pages/hyde
image: python:2.7
pages:
script:
- pip install lektor
- lektor build --output-path public
artifacts:
paths:
- public
only:
- master
# Full project: https://gitlab.com/pages/metalsmith
image: node:4.2.2
pages:
cache:
paths:
- node_modules/
script:
- npm install -g metalsmith
- npm install
- make build
artifacts:
paths:
- public
only:
- master
# Full project: https://gitlab.com/pages/middleman
image: ruby:2.3
cache:
paths:
- vendor
test:
script:
- apt-get update -yqqq
- apt-get install -y nodejs
- bundle install --path vendor
- bundle exec middleman build
except:
- master
pages:
script:
- apt-get update -yqqq
- apt-get install -y nodejs
- bundle install --path vendor
- bundle exec middleman build
artifacts:
paths:
- public
only:
- master
# Full project: https://gitlab.com/pages/nanoc
image: ruby:2.3
pages:
script:
- bundle install -j4
- nanoc
artifacts:
paths:
- public
only:
- master
# Full project: https://gitlab.com/pages/octopress
image: ruby:2.3
pages:
script:
- apt-get update -qq && apt-get install -qq nodejs
- bundle install -j4
- bundle exec rake generate
- mv public .public
- mv .public/octopress public
artifacts:
paths:
- public
only:
- master
# Full project: https://gitlab.com/pages/pelican
image: python:2.7-alpine
pages:
script:
- pip install -r requirements.txt
- pelican -s publishconf.py
artifacts:
paths:
- public/
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/ruby/tags/
image: "ruby:2.3"
# Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-service
services:
- mysql:latest
- redis:latest
- postgres:latest
# This is a basic example for a gem or script which doesn't use
# services such as redis or postgres
before_script:
- gem install bundler # Bundler is not installed with the image
- bundle install -j $(nproc) # Install dependencies
rubocop:
script:
- rubocop
rspec:
script:
- rspec spec
rails:
script:
- rake db:migrate
- rspec spec
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment