ci: support test.skip [skip ci]

This commit is contained in:
lowlighter
2022-01-14 00:14:06 -05:00
parent 304ab009c9
commit b329c9d490

View File

@@ -19,14 +19,14 @@ async function plugin(id) {
const path = paths.join(__plugins, id) const path = paths.join(__plugins, id)
const readme = paths.join(path, "README.md") const readme = paths.join(path, "README.md")
const examples = paths.join(path, "examples.yml") const examples = paths.join(path, "examples.yml")
const tests = paths.join(__test_plugins, id) const tests = paths.join(__test_plugins, `${id}.yml`)
return { return {
readme:{ readme:{
path:readme, path:readme,
content:`${await fs.readFile(readme)}` content:`${await fs.readFile(readme)}`
}, },
tests:{ tests:{
path:paths.join(__test_plugins, `${id}.yml`) path:tests
}, },
examples:fss.existsSync(examples) ? yaml.load(await fs.readFile(examples), "utf8") ?? [] : [], examples:fss.existsSync(examples) ? yaml.load(await fs.readFile(examples), "utf8") ?? [] : [],
options:plugins[id].readme.table options:plugins[id].readme.table
@@ -59,6 +59,8 @@ for (const id of Object.keys(plugins)) {
) )
//Plugin tests //Plugin tests
await fs.writeFile(tests.path, yaml.dump(examples.map(({prod, test = {}, name = "", ...step}) => { await fs.writeFile(tests.path, yaml.dump(examples.map(({prod, test = {}, name = "", ...step}) => {
if (test.skip)
return null
const result = {name:`${plugins[id].name} - ${name}`, ...step, ...test} const result = {name:`${plugins[id].name} - ${name}`, ...step, ...test}
test.with ??= {} test.with ??= {}
for (const [k, v] of Object.entries(result.with)) { for (const [k, v] of Object.entries(result.with)) {
@@ -71,7 +73,7 @@ for (const id of Object.keys(plugins)) {
delete result.with.base delete result.with.base
delete result.with.filename delete result.with.filename
return result return result
}))) }).filter(t => t)))
} }