Skip to content

Commit

Permalink
Merge pull request #11 from betrybe/configura-npm-start
Browse files Browse the repository at this point in the history
feat: adiciona possibilidade de executar npm start antes da avaliação
  • Loading branch information
jeanpsv authored Aug 26, 2020
2 parents ce490c9 + b42978a commit 50ea691
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ GitHub repository that store the tests

GitHub specific branch

### `npm-start`

Run npm start and waits to url before testing

### `wait-for`

Url that npm start command waits for

## Outputs

### `result`
Expand All @@ -30,6 +38,8 @@ Pull Request number that trigger build.
with:
repository-test-name: my-org/my-repo
repository-test-branch: master # master is default
npm-start: true # false is default
wait-for: 'http://localhost:8080' # http://localhost:3000 is default
```
## How to get result output
Expand Down
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ inputs:
description: 'GitHub specific branch'
default: 'master'
required: true
npm-start:
description: 'Run npm start and waits to url before testing'
default: false
wait-for:
description: 'Url that npm start command waits for'
default: 'http://localhost:3000'
outputs:
result:
description: 'Jest unit tests JSON results in base64 format.'
Expand All @@ -19,3 +25,5 @@ runs:
args:
- ${{ inputs.repository-test-name }}
- ${{ inputs.repository-test-branch }}
- ${{ inputs.npm-start }}
- ${{ inputs.wait-for }}
7 changes: 7 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ set -x

REPOSITORY_NAME=$1
REPOSITORY_BRANCH=$2
run_npm_start=$3
wait_for_url=$4

git clone --branch $REPOSITORY_BRANCH https://github.com/$REPOSITORY_NAME.git /project-tests
rm -rf /project-tests/.git
cp -r /project-tests/* .
npm install

if $run_npm_start ; then
npm start & npx wait-on $wait_for_url
fi

npm test -- --json --outputFile=evaluation.json
node /evaluator.js evaluation.json .trybe/requirements.json result.json

Expand Down

0 comments on commit 50ea691

Please sign in to comment.