From ce5c2b528b49e59163dd8755eaf7bf09af92739b Mon Sep 17 00:00:00 2001 From: Alan Churley Date: Tue, 20 Jul 2021 12:09:39 +0100 Subject: [PATCH 1/6] Adding sample automation for PR --- .github/workflows/on-pull-request.yml | 24 ++++++++++++++++++++++++ .github/workflows/on-push.yml | 9 ++------- 2 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/on-pull-request.yml diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml new file mode 100644 index 0000000000..7e8e0dd1e9 --- /dev/null +++ b/.github/workflows/on-pull-request.yml @@ -0,0 +1,24 @@ +name: on-pull-request +on: + pull_request + +jobs: + on_push: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - 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.actor != 'dependabot[bot]' }} + 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 diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml index 296d9085bf..074475d392 100644 --- a/.github/workflows/on-push.yml +++ b/.github/workflows/on-push.yml @@ -5,6 +5,7 @@ on: jobs: on_push: runs-on: ubuntu-latest + if: ${{ github.event_name != 'pull_request' }} steps: - uses: actions/checkout@v2 - name: Install packages @@ -15,10 +16,4 @@ jobs: - 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 From 968d00ece3a14b4e7df1053948f4d2a4d145ce3c Mon Sep 17 00:00:00 2001 From: Alan Churley Date: Tue, 20 Jul 2021 12:19:55 +0100 Subject: [PATCH 2/6] Adding comment --- .github/workflows/on-pull-request.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml index 7e8e0dd1e9..1fc2986d47 100644 --- a/.github/workflows/on-pull-request.yml +++ b/.github/workflows/on-pull-request.yml @@ -3,7 +3,7 @@ on: pull_request jobs: - on_push: + on_pr: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -17,6 +17,7 @@ jobs: - name: Run tests run: npm run lerna-test - 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: From 284d10d0c80194adca26f067995651f4f237d482 Mon Sep 17 00:00:00 2001 From: Alan Churley Date: Tue, 20 Jul 2021 12:56:28 +0100 Subject: [PATCH 3/6] MOving env var out of script, and setting node version explicitly --- .github/workflows/on-pull-request.yml | 7 ++++++- .github/workflows/on-push.yml | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml index 1fc2986d47..5a8a5c7545 100644 --- a/.github/workflows/on-pull-request.yml +++ b/.github/workflows/on-pull-request.yml @@ -5,11 +5,16 @@ on: 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: | - export NODE_ENV=dev npm ci npm run lerna-ci - name: Run lint diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml index 074475d392..410ab49a15 100644 --- a/.github/workflows/on-push.yml +++ b/.github/workflows/on-push.yml @@ -6,11 +6,16 @@ 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 From 9f4291093899fa879151c953d165a374f9b422bd Mon Sep 17 00:00:00 2001 From: Alan Churley Date: Tue, 20 Jul 2021 13:39:03 +0100 Subject: [PATCH 4/6] trying to merge coverage reports --- .github/workflows/on-pull-request.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml index 5a8a5c7545..e5a0be61b5 100644 --- a/.github/workflows/on-pull-request.yml +++ b/.github/workflows/on-pull-request.yml @@ -21,10 +21,18 @@ jobs: run: npm run lerna-lint - name: Run tests run: npm run lerna-test + - name: Collate Coverage Reports + 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: ./packages/logger/coverage/lcov.info \ No newline at end of file + lcov-file: .coverage/lcov.info \ No newline at end of file From 2e25bc7712d523c43bd75a1ffb25f85723677ac0 Mon Sep 17 00:00:00 2001 From: Alan Churley Date: Tue, 20 Jul 2021 13:40:36 +0100 Subject: [PATCH 5/6] Fixing typo --- .github/workflows/on-pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml index e5a0be61b5..0734f1afe7 100644 --- a/.github/workflows/on-pull-request.yml +++ b/.github/workflows/on-pull-request.yml @@ -35,4 +35,4 @@ jobs: 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 + lcov-file: ./coverage/lcov.info \ No newline at end of file From db10b11996fe66b6bd53f92de3195ed9d2bb353f Mon Sep 17 00:00:00 2001 From: Alan Churley Date: Tue, 20 Jul 2021 13:44:31 +0100 Subject: [PATCH 6/6] Exluding dependabot from running coverage collation --- .github/workflows/on-pull-request.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml index 0734f1afe7..acdba7cd4b 100644 --- a/.github/workflows/on-pull-request.yml +++ b/.github/workflows/on-pull-request.yml @@ -22,6 +22,7 @@ jobs: - 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