Comparing version 2.0.0 to 2.1.0
2.1.0 / 2022-06-03 | ||
================== | ||
**others** | ||
* [[`5feaed6`](http://github.com/eggjs/egg-ci/commit/5feaed6a7757efe62586c613d3fec812b97493f4)] - 📦 NEW: Support custom service (#38) (fengmk2 <<fengmk2@gmail.com>>) | ||
2.0.0 / 2022-06-03 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -41,2 +41,3 @@ 'use strict'; | ||
command: 'ci', | ||
service: {}, | ||
...pkg.ci, | ||
@@ -46,4 +47,42 @@ }; | ||
config.versions = arrayify(config.version); | ||
// if (config.services) config.services = arrayify(config.services); | ||
let mysqlServer = ''; | ||
if (config.service.mysql) { | ||
// service only support on linux | ||
config.os = 'linux'; | ||
const mysql = { | ||
version: '8', | ||
db: 'unittest', | ||
...config.service.mysql, | ||
}; | ||
mysqlServer = ` | ||
services: | ||
mysql: | ||
image: mysql:${mysql.version} | ||
env: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: true | ||
MYSQL_DATABASE: ${mysql.db} | ||
ports: | ||
- 3306:3306 | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 | ||
`; | ||
} | ||
let redisServer = ''; | ||
if (config.service['redis-server']) { | ||
// service only support on linux | ||
config.os = 'linux'; | ||
const redis = { | ||
version: '6', | ||
...config.service['redis-server'], | ||
}; | ||
redisServer = ` | ||
# https://github.com/marketplace/actions/redis-server-in-github-actions#usage | ||
- name: Start Redis | ||
uses: supercharge/redis-github-action@1.4.0 | ||
with: | ||
redis-version: ${redis.version} | ||
`; | ||
} | ||
const os = arrayify(config.os).map(name => { | ||
@@ -58,3 +97,5 @@ if (name === 'linux') name = 'ubuntu'; | ||
.replace('{{github_command_ci}}', config.command) | ||
.replace('{{github_npm_install}}', config.npminstall ? 'npm i -g npminstall && npminstall' : 'npm i'); | ||
.replace('{{github_npm_install}}', config.npminstall ? 'npm i -g npminstall && npminstall' : 'npm i') | ||
.replace('{{mysql}}', mysqlServer) | ||
.replace('{{redis-server}}', redisServer); | ||
const ymlName = '.github/workflows/nodejs.yml'; | ||
@@ -61,0 +102,0 @@ const ymlPath = path.join(root, ymlName); |
{ | ||
"name": "egg-ci", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Auto gen ci config file", | ||
@@ -51,3 +51,2 @@ "main": "index.js", | ||
"os": "linux, macos, windows", | ||
"nyc": true, | ||
"license": { | ||
@@ -54,0 +53,0 @@ "year": 2017 |
@@ -35,3 +35,11 @@ egg-ci | ||
"command": "ci", | ||
"services": "redis-server, mysql", // custom service | ||
// custom service, only support on "linux" os, if you enable service, os will set to "linux" only | ||
"service": { | ||
"mysql": { | ||
"version": "8" | ||
}, | ||
"redis-server": { | ||
"version": "6" | ||
} | ||
}, | ||
"license": false // generate license | ||
@@ -38,0 +46,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16327
110
66