diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml new file mode 100644 index 0000000000..acdba7cd4b --- /dev/null +++ b/.github/workflows/on-pull-request.yml @@ -0,0 +1,39 @@ +name: on-pull-request +on: + pull_request + +jobs: + on_pr: + runs-on: ubuntu-latest + env: + NODE_ENV: dev + steps: + - uses: actions/checkout@v2 + - name: Set up Node + uses: actions/setup-node@v2 + with: + node-version: '14' + - name: Install packages + run: | + npm ci + npm run lerna-ci + - name: Run lint + run: npm run lerna-lint + - name: Run tests + run: npm run lerna-test + - name: Collate Coverage Reports + if: ${{ github.actor != 'dependabot[bot]' }} + run: | + mkdir -p coverage + for d in ./packages/*/ ; do + filename="$d""coverage/lcov.info" + targetSource="SF:""$d""src" + sed "s|SF:src|$targetSource|g" $filename >> coverage/lcov.info + done + - name: Report Coverage + #Dependabot user will only have read-only perms, so don't try to report coverage + if: ${{ github.actor != 'dependabot[bot]' }} + uses: romeovs/lcov-reporter-action@v0.2.21 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + lcov-file: ./coverage/lcov.info \ No newline at end of file diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml index 296d9085bf..410ab49a15 100644 --- a/.github/workflows/on-push.yml +++ b/.github/workflows/on-push.yml @@ -5,20 +5,20 @@ on: jobs: on_push: runs-on: ubuntu-latest + if: ${{ github.event_name != 'pull_request' }} + env: + NODE_ENV: dev steps: - uses: actions/checkout@v2 + - name: Set up Node + uses: actions/setup-node@v2 + with: + node-version: '14' - name: Install packages run: | - export NODE_ENV=dev npm ci npm run lerna-ci - name: Run lint run: npm run lerna-lint - name: Run tests - run: npm run lerna-test - - name: Report Coverage - if: ${{ github.event_name == 'pull_request' }} - uses: romeovs/lcov-reporter-action@v0.2.21 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - lcov-file: ./packages/logger/coverage/lcov.info \ No newline at end of file + run: npm run lerna-test \ No newline at end of file