-
Notifications
You must be signed in to change notification settings - Fork 0
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 #17 from firmanJS/master
Improve Github actions
- Loading branch information
Showing
7 changed files
with
196 additions
and
71 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 |
---|---|---|
|
@@ -4,16 +4,12 @@ | |
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
# node-version: [10.x, 12.x, 14.x, 15.x] | ||
|
@@ -29,29 +25,66 @@ jobs: | |
node-version: ${{ matrix.node-version }} | ||
# skip because using docker | ||
# - run: npm install | ||
|
||
- name: Create env file | ||
run: | | ||
touch .env | ||
echo APP_PORT=${{ secrets.APP_PORT }} >> .env | ||
echo MONGO_INITDB_DATABASE=${{ secrets.MONGO_INITDB_DATABASE }} >> .env | ||
echo MONGO_INITDB_ROOT_PASSWORD=${{ secrets.MONGO_INITDB_ROOT_PASSWORD }} >> .env | ||
echo MONGO_INITDB_ROOT_USERNAME=${{ secrets.MONGO_INITDB_ROOT_USERNAME }} >> .env | ||
echo MONGO_PORT=${{ secrets.MONGO_PORT }} >> .env | ||
echo TZ=${{ secrets.TZ }} >> .env | ||
echo SECRET_KEY=${{ secrets.SECRET_KEY }} >> .env | ||
echo NODE_ENV=${{ secrets.NODE_ENV }} >> .env | ||
echo MONGO_SERVICE=${{ secrets.MONGO_SERVICE }} >> .env | ||
echo AUTH_SOURCE=${{ secrets.AUTH_SOURCE }} >> .env | ||
|
||
run-docker-compose: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} && install dependencies | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Build docker-compose | ||
run: docker-compose -f docker-compose.yml up --build -d | ||
- name: Create env file | ||
run: | | ||
touch .env | ||
echo APP_PORT=${{ secrets.APP_PORT }} >> .env | ||
echo MONGO_INITDB_DATABASE=${{ secrets.MONGO_INITDB_DATABASE }} >> .env | ||
echo MONGO_INITDB_ROOT_PASSWORD=${{ secrets.MONGO_INITDB_ROOT_PASSWORD }} >> .env | ||
echo MONGO_INITDB_ROOT_USERNAME=${{ secrets.MONGO_INITDB_ROOT_USERNAME }} >> .env | ||
echo MONGO_PORT=${{ secrets.MONGO_PORT }} >> .env | ||
echo TZ=${{ secrets.TZ }} >> .env | ||
echo SECRET_KEY=${{ secrets.SECRET_KEY }} >> .env | ||
echo NODE_ENV=${{ secrets.NODE_ENV }} >> .env | ||
echo MONGO_SERVICE=${{ secrets.MONGO_SERVICE }} >> .env | ||
echo AUTH_SOURCE=${{ secrets.AUTH_SOURCE }} >> .env | ||
- name: Build docker-compose | ||
run: docker-compose -f docker-compose.yml up --build -d | ||
|
||
# - name: publish coverage | ||
# uses: paambaati/[email protected] | ||
# env: | ||
# CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | ||
# with: | ||
# coverageCommand: docker-compose exec boillerplate npm run coverage-report | ||
# debug: true | ||
# - name: Running test inside container docker | ||
# run: docker exec -t boillerplate npm run test | ||
|
||
- name: coverage | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
name: actions ${{ matrix.node }} | ||
fail_ci_if_error: false | ||
codecov: | ||
needs: run-docker-compose | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: coverage | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
name: actions ${{ matrix.node }} | ||
fail_ci_if_error: false | ||
|
||
# coverage: | ||
# needs: [ codecov ] | ||
# name: coverage | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - uses: actions/setup-node@v1 | ||
# with: | ||
# node-version: '14.x' | ||
# - run: npm install | ||
# - uses: paambaati/[email protected] | ||
# env: | ||
# CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | ||
# with: | ||
# coverageCommand: npm run coverage-report |
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 @@ | ||
language: | ||
node_js | ||
before_install: | ||
- npm install -g codecov | ||
script: | ||
- istanbul cover ./node_modules/mocha/bin/_mocha --reporter lcovonly -- -R spec | ||
- codecov |
File renamed without changes.
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
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,21 @@ | ||
{ | ||
"stats": { | ||
"suites": 2, | ||
"tests": 1, | ||
"passes": 1, | ||
"pending": 0, | ||
"failures": 0, | ||
"start": "2021-03-08T04:42:37.596Z", | ||
"end": "2021-03-08T04:42:37.671Z", | ||
"duration": 75 | ||
}, | ||
"failures": [], | ||
"passes": [ | ||
{ | ||
"title": "it should login user invalid user", | ||
"fullTitle": "Users /POST Login user it should login user invalid user", | ||
"duration": 69 | ||
} | ||
], | ||
"skipped": [] | ||
} |
Oops, something went wrong.