-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #221 from gridaco/wip
Reports CI
- Loading branch information
Showing
29 changed files
with
1,532 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.coverage* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; |
Oops, something went wrong.