Skip to content

Commit

Permalink
[TT-469] Parse go json logs to output only relevant information for t…
Browse files Browse the repository at this point in the history
…riage (#101)
  • Loading branch information
tateexon committed Aug 1, 2023
1 parent 0ca2069 commit 2bb3869
Show file tree
Hide file tree
Showing 22 changed files with 19,422 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,37 @@ on:
push:
branches:
- main
paths:
- '.github/workflows/semver-compare-check-dist.yaml'
- 'semver-compare/**'
pull_request:
paths:
- '.github/workflows/semver-compare-check-dist.yaml'
- 'semver-compare/**'
workflow_dispatch:

defaults:
run:
shell: bash
working-directory: ./semver-compare

jobs:
check-dist:
runs-on: ubuntu-latest

strategy:
matrix:
app:
- directory: ./semver-compare
- directory: ./go/go-test-results-parsing
steps:
- uses: actions/checkout@v3

- name: Set Node.js 16.x
uses: actions/setup-node@v3.6.0
with:
node-version: 16.x
- run: npm ci
- name: Rebuild the dist/ directory
run: |
cd ${{ matrix.app.directory }}
npm ci
npm run build
npm run package
- name: Compare the expected and actual dist/ directories
run: |
cd ${{ matrix.app.directory }}
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
Expand All @@ -50,7 +49,7 @@ jobs:

# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
if: failure()
with:
name: dist
path: dist/
path: ${{ matrix.app.directory }}/dist/
50 changes: 50 additions & 0 deletions .github/workflows/go-test-results-parsing-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: 'semver-compare-build-ci'
on:
pull_request:
paths:
- '.github/workflows/go-test-results-parsing-ci.yaml'
- 'go/go-test-results-parsing/**'
push:
branches:
- main
- 'release/*'
paths:
- '.github/workflows/go-test-results-parsing-ci.yaml'
- 'go/go-test-results-parsing/**'

defaults:
run:
shell: bash

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
cd go/go-test-results-parsing
npm ci
npm run all
test:
runs-on: ubuntu-latest
strategy:
matrix:
output-mode: ['unit', 'e2e']
steps:
- uses: actions/checkout@v3
- uses: ./go/go-test-results-parsing
id: action_run
continue-on-error: true
with:
results-file: ./go/go-test-results-parsing/__tests__/__fixtures__/go_test_results_input.json
output-mode: ${{ matrix.output-mode }}
- name: Check for expected failure
run: |
RESULT=${{ steps.action_run.outcome }}
if [[ "$RESULT" == "failure" ]]; then
echo "Running the action created the expected failure."
exit 0
else
echo "Running the action should cause a failure."
exit 1
fi
4 changes: 4 additions & 0 deletions go/go-test-results-parsing/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist/
lib/
node_modules/
jest.config.js
62 changes: 62 additions & 0 deletions go/go-test-results-parsing/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"import/no-unresolved": "off",
"no-unused-vars": "error",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{"accessibility": "no-public"}
],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{"allowExpressions": true}
],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}
99 changes: 99 additions & 0 deletions go/go-test-results-parsing/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Dependency directory
node_modules

# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# OS metadata
.DS_Store
Thumbs.db

# Ignore built ts files
__tests__/runner/*
lib/**/*
3 changes: 3 additions & 0 deletions go/go-test-results-parsing/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
lib/
node_modules/
10 changes: 10 additions & 0 deletions go/go-test-results-parsing/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid"
}
11 changes: 11 additions & 0 deletions go/go-test-results-parsing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# go/parse-test-failures

Logic around go test results from its -json output. Reduces noise from the output to make failures easier to read while keeping the ability for use of all of the data in the json file.

## build

Make sure you build and commit the built files.

```shell
npm run build
```

0 comments on commit 2bb3869

Please sign in to comment.