Skip to content

Commit

Permalink
Gera base64 do resultado dos testes + Ajustes de linter
Browse files Browse the repository at this point in the history
  • Loading branch information
renanvy committed Aug 7, 2023
1 parent def6b5b commit d0af807
Show file tree
Hide file tree
Showing 19 changed files with 3,198 additions and 854 deletions.
30 changes: 30 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"env": {
"browser": true,
"commonjs": true,
"es2021": true
},
// "extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": "latest"
},
"ignorePatterns": ["**/dist/", "test/", "**/node_modules/**"],
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"never"
]
}
}
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Check StyleGuide
run: npm run lint

- name: Run Test
run: npm test
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 18.17.0
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 🤖 JUnit Android Evaluator Actions [![CI](https://github.com/betrybe/junit-android-evaluator-actions/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/betrybe/junit-android-evaluator-actions/actions/workflows/main.yml)
# 🤖 JUnit Android Evaluator Action [![CI](https://github.com/betrybe/junit-android-evaluator-action/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/betrybe/junit-android-evaluator-action/actions/workflows/main.yml)

Projeto em javascript responsável por processar os relatórios(xml) de testes unitários e instrumentados.

Expand Down Expand Up @@ -31,21 +31,21 @@ jobs:
- name: Fetch JUnit Android Evaluator
uses: actions/checkout@v3
with:
repository: betrybe/junit-android-evaluator-actions
repository: betrybe/junit-android-evaluator-action
ref: v1
token: ${{ secrets.GIT_HUB_PAT }}
path: .github/actions/junit-android-evaluator-actions
path: .github/actions/junit-android-evaluator-action

- name: Run JUnit Android Evaluator
id: android-evaluator
uses: ./.github/actions/junit-android-evaluator-actions
uses: ./.github/actions/junit-android-evaluator-action
with:
pr_author_username: ${{ github.event.pull_request.user.login }}
```
Para habilitar ou desabilitar a execução de um tipo de teste, basta passar via parâmetro no passo da execução do avaliador.
```yml
- name: Run JUnit Android Evaluator
uses: ./.github/actions/junit-android-evaluator-actions
uses: ./.github/actions/junit-android-evaluator-action
with:
pr_author_username: ${{ github.event.pull_request.user.login }}
unit_test: false
Expand Down
75 changes: 39 additions & 36 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,55 @@
name: 'JUnit evaluator'
description: 'JUnit evaluator for Tryber projects in android'
name: "JUnit evaluator"
description: "JUnit evaluator for Tryber projects in android"
inputs:
unit_test:
description: 'Unit test'
description: "Unit test"
required: false
default: 'true'
default: "true"
instrumented_test:
description: 'Instrumented_test test'
description: "Instrumented_test test"
required: false
default: 'false'
default: "false"
pr_author_username:
description: 'Pull Request author username'
description: "Pull Request author username"
required: true

outputs:
result:
description: 'JUnit unit tests JSON results in base64 format'
result:
description: "JUnit unit tests JSON results in base64 format"
value: ${{ steps.get_junit_results.outputs.result }}

runs:
using: 'composite'
using: "composite"
steps:
- name: Set up Nodejs 16
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Set up Nodejs 16
uses: actions/setup-node@v3
with:
node-version: "16"

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "17"

- name: Gradle cache
uses: gradle/gradle-build-action@v2
- name: Gradle cache
uses: gradle/gradle-build-action@v2

- name: Run Unit tests
if: ${{ inputs.unit_test == 'true' }}
run: ./gradlew test
shell: bash
- name: Run Unit tests
if: ${{ inputs.unit_test == 'true' }}
run: ./gradlew test
shell: bash

- name: Run Instrumented tests
uses: reactivecircus/android-emulator-runner@v2
if: ${{ inputs.instrumented_test == 'true' }}
with:
api-level: 29
script: ./gradlew connectedCheck
- name: Run Instrumented tests
uses: reactivecircus/android-emulator-runner@v2
if: ${{ inputs.instrumented_test == 'true' }}
with:
api-level: 29
script: ./gradlew connectedCheck

- name: Get JUnit results
run: node $GITHUB_ACTION_PATH/dist/index.js
shell: bash
env:
INPUT_PR_AUTHOR_USERNAME: ${{inputs.pr_author_username}}
- name: Get JUnit results
id: get_junit_results
run: node $GITHUB_ACTION_PATH/dist/index.js
shell: bash
env:
INPUT_PR_AUTHOR_USERNAME: ${{inputs.pr_author_username}}
Loading

0 comments on commit d0af807

Please sign in to comment.