forgeplus/lib/tasks/dev_ops_languages.rake

753 lines
10 KiB
Ruby
Raw Normal View History

2020-07-14 15:06:09 +08:00
desc "Initialize the data for dev ops languages"
namespace :dev_ops_languages do
task init: :environment do
# DevOps::Language.bulk_insert do |worker|
# languages.each do |attrs|
# worker.add(attrs)
# end
# end
languages.each do |l|
content = Base64.encode64 l[:content]
2020-10-21 18:14:06 +08:00
Ci::Language.create!(name: l[:name], content: content)
2020-07-14 15:06:09 +08:00
end
end
def languages
[
{
name: "C",
2020-10-21 18:07:18 +08:00
content: "
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: gcc
commands:
- ./configure
- make
- make test"
2020-07-14 15:06:09 +08:00
},
{
name: "C++",
2020-10-21 18:07:18 +08:00
content: "
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: gcc
commands:
- ./configure
- make
- make test"
2020-07-14 15:06:09 +08:00
},
{
name: "Docker",
2020-10-21 18:07:18 +08:00
content: "
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: docker:dind
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- docker ps -a
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
volumes:
- name: dockersock
host:
path: /var/run/docker.sock"
2020-07-14 15:06:09 +08:00
},
{
name: "Java",
2020-10-21 18:07:18 +08:00
content: "
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: maven:3-jdk-10
commands:
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
- mvn test -B"
2020-07-14 15:06:09 +08:00
},
{
name: "R",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: r-base
commands:
2020-10-21 18:12:58 +08:00
- R -e 'install.packages(c('package1','package2'))'
- R CMD build ."
2020-07-14 15:06:09 +08:00
},
{
name: "Ruby",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: ruby
commands:
- bundle install --jobs=3 --retry=3
2020-10-21 18:12:58 +08:00
- rake"
2020-07-14 15:06:09 +08:00
},
{
name: "PHP",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: install
image: composer
commands:
- composer install
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
- name: test
image: php:7
commands:
2020-10-21 18:12:58 +08:00
- vendor/bin/phpunit --configuration config.xml"
2020-07-14 15:06:09 +08:00
},
{
name: "Python",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: python
commands:
- pip install -r requirements.txt
2020-10-21 18:12:58 +08:00
- pytest"
2020-07-14 15:06:09 +08:00
},
{
name: "MySQL",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: mysql
commands:
- sleep 15
2020-10-21 18:12:58 +08:00
- mysql -u root -h database --execute='SELECT VERSION();'
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
services:
- name: database
image: mysql
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
2020-10-21 18:12:58 +08:00
MYSQL_DATABASE: test"
2020-07-14 15:06:09 +08:00
},
{
name: "MongoDB",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: ping
image: mongo:4
commands:
- sleep 5
2020-10-21 18:12:58 +08:00
- mongo --host mongo --eval 'db.version()'
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
services:
- name: mongo
image: mongo:4
2020-10-21 18:12:58 +08:00
command: [ --smallfiles ]"
2020-07-14 15:06:09 +08:00
},
{
name: "Clojure",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: clojure
commands:
2020-10-21 18:12:58 +08:00
- lein test"
2020-07-14 15:06:09 +08:00
},
{
name: "CouchDB",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: couchdb:2.2
commands:
- sleep 15
- curl http://database:5984
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
services:
- name: database
2020-10-21 18:12:58 +08:00
image: couchdb:2.2"
2020-07-14 15:06:09 +08:00
},
{
name: "Crystal",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: crystallang/crystal
commands:
- shards install
2020-10-21 18:12:58 +08:00
- crystal spec.2"
2020-07-14 15:06:09 +08:00
},
{
name: "D",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: dlanguage/dmd
commands:
2020-10-21 18:12:58 +08:00
- dub test"
2020-07-14 15:06:09 +08:00
},
{
name: "Dart",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: google/dart
commands:
- pub get
2020-10-21 18:12:58 +08:00
- pub run test"
2020-07-14 15:06:09 +08:00
},
{
name: "Docker (dind)",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
platform:
os: linux
arch: arm64
steps:
- name: test
image: docker:dind
volumes:
- name: dockersock
path: /var/run
commands:
- sleep 5 # give docker enough time to start
- docker ps -a
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: dockersock
2020-10-21 18:12:58 +08:00
temp: {}"
2020-07-14 15:06:09 +08:00
},
{
name: "Elasticsearch",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: alpine:3.8
commands:
- apk add curl
- sleep 45
- curl http://database:9200
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
services:
- name: database
2020-10-21 18:12:58 +08:00
image: elasticsearch:5-alpine"
2020-07-14 15:06:09 +08:00
},
{
name: "Elixir",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: elixir:1.5
commands:
- mix local.rebar --force
- mix local.hex --force
- mix deps.get
2020-10-21 18:12:58 +08:00
- mix test"
2020-07-14 15:06:09 +08:00
},
{
name: "Erlang",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: erlang:21
commands:
- rebar get-deps
- rebar compile
2020-10-21 18:12:58 +08:00
- rebar skip_deps=true eunit"
2020-07-14 15:06:09 +08:00
},
{
name: "20.Go (with Gopath)",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
workspace:
base: /go
path: src/hello-world
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: golang
commands:
- go get
2020-10-21 18:12:58 +08:00
- go test"
2020-07-14 15:06:09 +08:00
},
{
name: "21.Go (with Modules)",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: golang
commands:
- go test
2020-10-21 18:12:58 +08:00
- go build"
2020-07-14 15:06:09 +08:00
},
{
name: "Gradle",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: gradle:jdk10
commands:
- gradle assemble
2020-10-21 18:12:58 +08:00
- gradle check"
2020-07-14 15:06:09 +08:00
},
{
name: "Groovy",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: gradle:2.5-jdk8
commands:
- ./gradlew assemble
2020-10-21 18:12:58 +08:00
- ./gradlew check"
2020-07-14 15:06:09 +08:00
},
{
name: "Haskell",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: haskell
commands:
- cabal install --only-dependencies --enable-tests
- cabal configure --enable-tests
- cabal build
2020-10-21 18:12:58 +08:00
- cabal test"
2020-07-14 15:06:09 +08:00
},
{
name: "Haxe",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: haxe
commands:
- haxelib install build.hxml
2020-10-21 18:12:58 +08:00
- haxe build.hxml"
2020-07-14 15:06:09 +08:00
},
{
name: "MariaDB",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: mariadb
commands:
- sleep 15
2020-10-21 18:12:58 +08:00
- mysql -u root -h database --execute='SELECT VERSION();'
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
services:
- name: database
image: mariadb
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
2020-10-21 18:12:58 +08:00
MYSQL_DATABASE: test"
2020-07-14 15:06:09 +08:00
},
{
name: "Maven",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: maven:3-jdk-10
commands:
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
2020-10-21 18:12:58 +08:00
- mvn test -B"
2020-07-14 15:06:09 +08:00
},
{
name: "Memcached",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: ubuntu
commands:
- apt-get update -qq
- apt-get install -y -qq telnet > /dev/null
2020-10-21 18:12:58 +08:00
- (sleep 1; echo 'stats'; sleep 2; echo 'quit';) | telnet cache 11211 || true
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
services:
- name: cache
image: memcached:alpine
2020-10-21 18:12:58 +08:00
command: [ -vv ]"
2020-07-14 15:06:09 +08:00
},
{
name: "Nats",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: ruby:2
commands:
- gem install nats
- nats-pub -s tcp://nats:4222 greeting 'hello'
- nats-pub -s tcp://nats:4222 greeting 'world'
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
services:
- name: nats
2020-10-21 18:12:58 +08:00
image: nats:1.3.0"
2020-07-14 15:06:09 +08:00
},
{
name: "Node",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: node
commands:
- npm install
2020-10-21 18:12:58 +08:00
- npm test"
2020-07-14 15:06:09 +08:00
},
{
name: "Perl",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: perl
commands:
- cpanm --quiet --installdeps --notest .
- perl Build.PL
2020-10-21 18:12:58 +08:00
- ./Build test"
2020-07-14 15:06:09 +08:00
},
{
name: "Postgres",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: postgres:9-alpine
commands:
- psql -U postgres -d test -h database
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
services:
- name: database
image: postgres:9-alpine
environment:
POSTGRES_USER: postgres
2020-10-21 18:12:58 +08:00
POSTGRES_DB: test"
2020-07-14 15:06:09 +08:00
},
{
name: "Redis",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: redis
commands:
- sleep 5
- redis-cli -h redis ping
- redis-cli -h redis set FOO bar
- redis-cli -h redis get FOO
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
services:
- name: redis
2020-10-21 18:12:58 +08:00
image: redis"
2020-07-14 15:06:09 +08:00
},
{
name: "RethinkDB",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: node:9
commands:
- npm install -s -g recli
2020-10-21 18:12:58 +08:00
- recli -h database -j 'r.db('rethinkdb').table('stats')'
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
services:
- name: database
image: rethinkdb:2
2020-10-21 18:12:58 +08:00
command: [ rethinkdb, --bind, all ]"
2020-07-14 15:06:09 +08:00
},
{
name: "Rust",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: rust:1.30
commands:
- cargo build --verbose --all
2020-10-21 18:12:58 +08:00
- cargo test --verbose --all"
2020-07-14 15:06:09 +08:00
},
{
name: "Swift",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
platform:
os: linux
arch: arm64
2020-07-14 15:06:09 +08:00
2020-10-21 18:07:18 +08:00
steps:
- name: test
image: swift:4
commands:
- swift build
2020-10-21 18:12:58 +08:00
- swift test"
2020-07-14 15:06:09 +08:00
},
{
name: "Vault",
2020-10-21 18:12:58 +08:00
content: "
2020-10-21 18:07:18 +08:00
kind: pipeline
name: default
platform:
os: linux
arch: arm64
steps:
- name: test
image: vault:1.0.0-beta2
environment:
VAULT_ADDR: http://vault:8200
VAULT_TOKEN: dummy
commands:
- sleep 5
- vault kv put secret/my-secret my-value=s3cr3t
- vault kv get secret/my-secret
services:
- name: vault
image: vault:1.0.0-beta2
environment:
2020-10-21 18:12:58 +08:00
VAULT_DEV_ROOT_TOKEN_ID: dummy"
2020-07-14 15:06:09 +08:00
}
]
end
end