Skip to content

Commit

Permalink
chore(*): detailed info for PR route test (DIYgod#9689)
Browse files Browse the repository at this point in the history
Signed-off-by: Rongrong <i@rong.moe>
  • Loading branch information
Rongronggg9 authored May 3, 2022
1 parent dcc3c80 commit c1fbc64
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/pr-deploy-route-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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...
13 changes: 11 additions & 2 deletions scripts/workflow/test-route/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit c1fbc64

Please sign in to comment.