chore(*): detailed info for PR route test (#9689)

Signed-off-by: Rongrong <i@rong.moe>
This commit is contained in:
Rongrong
2022-05-04 06:08:10 +08:00
committed by GitHub
parent dcc3c80294
commit c1fbc64255
2 changed files with 16 additions and 3 deletions
+5 -1
View File
@@ -58,7 +58,7 @@ jobs:
run: |
set -ex
gzip -cvd docker-image/rsshub.tar.gz | docker load
docker run -d -p 1200:1200 rsshub:latest
docker run -d --name rsshub -e NODE_ENV=dev -p 1200:1200 rsshub:latest
- uses: actions/setup-node@v3 # just need its cache
if: (env.TEST_CONTINUE)
@@ -88,3 +88,7 @@ jobs:
const got = require("got");
const script = require(`${process.env.GITHUB_WORKSPACE}/scripts/workflow/test-route/test.js`)
return await script({ github, context, core, got }, link, routes, number)
- name: Print Docker container logs
if: (env.TEST_CONTINUE)
run: docker logs rsshub # logs/combined.log? Not so readable...
+11 -2
View File
@@ -10,18 +10,27 @@ module.exports = async ({ github, context, core, got }, baseUrl, routes, number)
return `${baseUrl}${l}`;
});
let com = 'Successfully generated as following:\n\n';
let com = `Successfully [generated](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) as following:\n\n`;
for (const lks of links) {
core.info(`testing route: ${lks}`);
// Intended, one at a time
const res = await got(lks).catch((err) => {
let errMsg = err.toString();
const errInfoList = err.response && err.response.body && err.response.body.match(/(?<=<pre class="message">)(.+?)(?=<\/pre>)/gs);
if (errInfoList) {
errMsg += '\n\n';
errMsg += errInfoList
.slice(0, 3)
.map((e) => e.trim())
.join('\n');
}
com += `
<details>
<summary><a href="${lks}">${lks}</a> - <b>Failed</b></summary>
\`\`\`
${err}
${errMsg}
\`\`\`
</details>