Skip to content

Commit 7bf63bb

Browse files
authored
feat: Adding sample automation for PR (#121)
* Adding sample automation for PR
1 parent a30fe6e commit 7bf63bb

File tree

2 files changed

+47
-8
lines changed

2 files changed

+47
-8
lines changed

.github/workflows/on-pull-request.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: on-pull-request
2+
on:
3+
pull_request
4+
5+
jobs:
6+
on_pr:
7+
runs-on: ubuntu-latest
8+
env:
9+
NODE_ENV: dev
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Set up Node
13+
uses: actions/setup-node@v2
14+
with:
15+
node-version: '14'
16+
- name: Install packages
17+
run: |
18+
npm ci
19+
npm run lerna-ci
20+
- name: Run lint
21+
run: npm run lerna-lint
22+
- name: Run tests
23+
run: npm run lerna-test
24+
- name: Collate Coverage Reports
25+
if: ${{ github.actor != 'dependabot[bot]' }}
26+
run: |
27+
mkdir -p coverage
28+
for d in ./packages/*/ ; do
29+
filename="$d""coverage/lcov.info"
30+
targetSource="SF:""$d""src"
31+
sed "s|SF:src|$targetSource|g" $filename >> coverage/lcov.info
32+
done
33+
- name: Report Coverage
34+
#Dependabot user will only have read-only perms, so don't try to report coverage
35+
if: ${{ github.actor != 'dependabot[bot]' }}
36+
uses: romeovs/[email protected]
37+
with:
38+
github-token: ${{ secrets.GITHUB_TOKEN }}
39+
lcov-file: ./coverage/lcov.info

.github/workflows/on-push.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ on:
55
jobs:
66
on_push:
77
runs-on: ubuntu-latest
8+
if: ${{ github.event_name != 'pull_request' }}
9+
env:
10+
NODE_ENV: dev
811
steps:
912
- uses: actions/checkout@v2
13+
- name: Set up Node
14+
uses: actions/setup-node@v2
15+
with:
16+
node-version: '14'
1017
- name: Install packages
1118
run: |
12-
export NODE_ENV=dev
1319
npm ci
1420
npm run lerna-ci
1521
- name: Run lint
1622
run: npm run lerna-lint
1723
- name: Run tests
18-
run: npm run lerna-test
19-
- name: Report Coverage
20-
if: ${{ github.event_name == 'pull_request' }}
21-
uses: romeovs/[email protected]
22-
with:
23-
github-token: ${{ secrets.GITHUB_TOKEN }}
24-
lcov-file: ./packages/logger/coverage/lcov.info
24+
run: npm run lerna-test

0 commit comments

Comments
 (0)