Skip to content

Commit

Permalink
Merge pull request #221 from gridaco/wip
Browse files Browse the repository at this point in the history
Reports CI
  • Loading branch information
softmarshmallow authored Dec 11, 2023
2 parents 1fd8116 + 4091531 commit 8d9a09a
Show file tree
Hide file tree
Showing 29 changed files with 1,532 additions and 403 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/codetest-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "@codetest/report"

on:
release:
types: [published]
pull_request:
types: [opened, synchronize, closed]

jobs:
report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- name: setup
run: |
yarn --frozen-lockfile
- name: build report tools
working-directory: testing/report
run: |
yarn build
- name: run report
id: report
working-directory: ci/report
run: |
npm ci
node report.js
- name: upload report to s3
id: upload
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: "codetest-reports"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_S3_CODETEST_REPORTS }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_S3_CODETEST_REPORTS }}
AWS_REGION: "us-west-1"
SOURCE_DIR: "ci/report/.coverage"
# dest dir is commit hash
DEST_DIR: "${{ github.sha }}"
- name: comment
id: comment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
STATUS: ${{ steps.report.outputs.STATUS }}
working-directory: ci/report
run: |
npm ci
node comment.js
1 change: 1 addition & 0 deletions ci/report/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.coverage*
3 changes: 3 additions & 0 deletions ci/report/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Reports Generating

This modules enables reports generation based on the current engine, enabling developers to visually track the engine features visually, by comparing the generated outputs, compared using vision diff.
31 changes: 31 additions & 0 deletions ci/report/comment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const github = require("@actions/github");
const octokit = github.getOctokit(process.env.GITHUB_TOKEN);
const context = github.context;
const { sha } = context;

const report_url = `https://code.grida.co/tests/reports/${sha}`;

let message;

if (context.payload.pull_request && context.eventName === "pull_request") {
const conclusion = process.env.STATUS || "unknown";

switch (conclusion) {
case "success":
message = `Report available at ${report_url} :tada:`;
break;
case "failure":
message = "Your PR failed some tests :x:";
break;
case "skipped":
case "unknown":
break;
}

// add a comment to the PR
octokit.rest.issues.createComment({
...context.repo,
issue_number: context.payload.pull_request.number,
body: message,
});
}
7 changes: 7 additions & 0 deletions ci/report/configs/report.config.max.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const path = require("path");

module.exports = {
sample: path.join(__dirname, "../samples-50.json"),
outDir: path.join(__dirname, "../.coverage"),
skipIfReportExists: false,
};
7 changes: 7 additions & 0 deletions ci/report/configs/report.config.med.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const path = require("path");

module.exports = {
sample: path.join(__dirname, "../samples-10.json"),
outDir: path.join(__dirname, "../.coverage"),
skipIfReportExists: false,
};
7 changes: 7 additions & 0 deletions ci/report/configs/report.config.min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const path = require("path");

module.exports = {
sample: path.join(__dirname, "../samples-5.json"),
outDir: path.join(__dirname, "../.coverage"),
skipIfReportExists: false,
};
Loading

0 comments on commit 8d9a09a

Please sign in to comment.