fix: markdown tests in ci

This commit is contained in:
lowlighter
2022-01-16 23:37:37 -05:00
parent 6722685bce
commit 1f5e6da19c
6 changed files with 25 additions and 7 deletions

View File

@@ -173,6 +173,9 @@ function testcase(name, env, args) {
result.if = "${{ success() || failure() }}" result.if = "${{ success() || failure() }}"
result.uses = "lowlighter/metrics@master" result.uses = "lowlighter/metrics@master"
Object.assign(result.with, { plugins_errors_fatal: "yes", output_action: "none", delay: 5 }) Object.assign(result.with, { plugins_errors_fatal: "yes", output_action: "none", delay: 5 })
if ((context.with?.output_action)&&(context.with?.committer_branch === "examples"))
Object.assign(result.with, { output_action:context.with.output_action, committer_branch:"examples" })
} }
if (env === "test") { if (env === "test") {

View File

@@ -18,7 +18,7 @@ if (!["plugin", "template"].includes(mode))
throw new Error(`Unsupported mode ${mode}`) throw new Error(`Unsupported mode ${mode}`)
//Check if target directory already exists //Check if target directory already exists
const target = paths.join(__metrics, `source/${mode}s`, name) const target = paths.join(__metrics, `source/${{plugin:"plugins/community", template:"templates"}[mode]}`, name)
if (fs.existsSync(target)) if (fs.existsSync(target))
throw new Error(`A ${mode} named ${name} already exists!`) throw new Error(`A ${mode} named ${name} already exists!`)

View File

@@ -176,7 +176,7 @@ jobs:
update-latest: update-latest:
name: Rebase latest on master name: Rebase latest on master
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [ docker-release ] needs: [ docker-release, publish-examples ]
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2

View File

@@ -977,8 +977,9 @@ jobs:
markdown: metrics.markdown.template.md markdown: metrics.markdown.template.md
config_output: markdown config_output: markdown
token: ${{ secrets.METRICS_TOKEN }} token: ${{ secrets.METRICS_TOKEN }}
plugins_errors_fatal: yes
output_action: none output_action: none
committer_branch: examples
plugins_errors_fatal: yes
delay: 5 delay: 5
if: ${{ success() || failure() }} if: ${{ success() || failure() }}
- name: 📒 Markdown template - Example with plugins configuration for embed use - name: 📒 Markdown template - Example with plugins configuration for embed use
@@ -1011,8 +1012,9 @@ jobs:
plugin_isocalendar: yes plugin_isocalendar: yes
plugin_languages: yes plugin_languages: yes
token: ${{ secrets.METRICS_TOKEN }} token: ${{ secrets.METRICS_TOKEN }}
plugins_errors_fatal: yes
output_action: none output_action: none
committer_branch: examples
plugins_errors_fatal: yes
delay: 5 delay: 5
if: ${{ success() || failure() }} if: ${{ success() || failure() }}
- name: 📒 Markdown template - Example (pdf output) - name: 📒 Markdown template - Example (pdf output)
@@ -1030,8 +1032,9 @@ jobs:
config_twemoji: yes config_twemoji: yes
config_padding: 5% config_padding: 5%
token: ${{ secrets.METRICS_TOKEN }} token: ${{ secrets.METRICS_TOKEN }}
plugins_errors_fatal: yes
output_action: none output_action: none
committer_branch: examples
plugins_errors_fatal: yes
delay: 5 delay: 5
if: ${{ success() || failure() }} if: ${{ success() || failure() }}
- name: 📕 Community templates - Using a community template - name: 📕 Community templates - Using a community template
@@ -1054,7 +1057,7 @@ jobs:
output_action: none output_action: none
delay: 5 delay: 5
if: ${{ success() || failure() }} if: ${{ success() || failure() }}
- name: Publish examples - name: Publish examples
if: ${{ success() || failure() }} if: ${{ success() || failure() }}

View File

@@ -33,7 +33,7 @@ info.section = (left = "", right = " ") => info(`\x1b[36m${left}\x1b[0m`, right)
info.group = ({metadata, name, inputs}) => { info.group = ({metadata, name, inputs}) => {
info.section(metadata.plugins[name]?.name?.match(/(?<section>[\w\s]+)/i)?.groups?.section?.trim(), " ") info.section(metadata.plugins[name]?.name?.match(/(?<section>[\w\s]+)/i)?.groups?.section?.trim(), " ")
for (const [input, value] of Object.entries(inputs)) for (const [input, value] of Object.entries(inputs))
info(metadata.plugins[name]?.inputs[input]?.description ?? input, value, {token:metadata.plugins[name]?.inputs[input]?.type === "token"}) info(metadata.plugins[name]?.inputs[input]?.description?.split("\n")[0] ?? metadata.plugins[name]?.inputs[input]?.description ?? input, value, {token:metadata.plugins[name]?.inputs[input]?.type === "token"})
} }
info.break = () => console.log("─".repeat(88)) info.break = () => console.log("─".repeat(88))

View File

@@ -6,6 +6,10 @@
markdown: metrics.markdown.template.md markdown: metrics.markdown.template.md
config_output: markdown config_output: markdown
token: ${{ secrets.METRICS_TOKEN }} token: ${{ secrets.METRICS_TOKEN }}
prod:
with:
output_action: commit
committer_branch: examples
- name: Example with plugins configuration for embed use - name: Example with plugins configuration for embed use
uses: lowlighter/metrics@latest uses: lowlighter/metrics@latest
@@ -36,6 +40,10 @@
plugin_isocalendar: yes plugin_isocalendar: yes
plugin_languages: yes plugin_languages: yes
token: ${{ secrets.METRICS_TOKEN }} token: ${{ secrets.METRICS_TOKEN }}
prod:
with:
output_action: commit
committer_branch: examples
- name: Example (pdf output) - name: Example (pdf output)
uses: lowlighter/metrics@latest uses: lowlighter/metrics@latest
@@ -51,3 +59,7 @@
config_twemoji: yes config_twemoji: yes
config_padding: 5% config_padding: 5%
token: ${{ secrets.METRICS_TOKEN }} token: ${{ secrets.METRICS_TOKEN }}
prod:
with:
output_action: commit
committer_branch: examples