-
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.
Add code coverage to PR, update node, update deps (#1)
- Loading branch information
Showing
10 changed files
with
478 additions
and
240 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: 'Configure Node.js' | ||
description: 'Install Node.js and install Node.js modules or restore cache' | ||
|
||
inputs: | ||
node-version: | ||
description: 'NodeJS Version' | ||
default: '18' | ||
lookup-only: | ||
description: 'If true, only checks if cache entry exists and skips download. Does not change save cache behavior' | ||
default: 'false' | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ inputs.node-version }} | ||
|
||
- name: Restore Node Modules from Cache | ||
id: cache-node-modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
node_modules | ||
packages/**/node_modules | ||
!node_modules/.cache | ||
key: node-modules-${{ inputs.node-version }}-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package.json', 'package-lock.json', '**/package-lock.json') }} | ||
lookup-only: ${{ inputs.lookup-only }} | ||
|
||
- name: Install dependencies | ||
if: steps.cache-node-modules.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: npm ci |
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,41 @@ | ||
name: 'Parse Coverage and Post Comment' | ||
description: 'Parses a coverage report and posts a comment on a PR' | ||
inputs: | ||
lcov-file: | ||
description: 'Path to the lcov.info file' | ||
required: true | ||
title: | ||
description: 'Title of the comment' | ||
default: 'Code Coverage Report' | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Parse Coverage | ||
shell: bash | ||
if: github.event_name == 'pull_request' | ||
id: parse | ||
run: | | ||
./scripts/parse-coverage.js ${{ inputs.lcov-file }} > coverage-summary.txt | ||
echo "coverage-summary<<EOF" >> $GITHUB_OUTPUT | ||
cat coverage-summary.txt >> $GITHUB_OUTPUT | ||
echo "EOF" >> $GITHUB_OUTPUT | ||
- name: Find Coverage Comment | ||
if: github.event_name == 'pull_request' | ||
uses: peter-evans/find-comment@v3 | ||
id: fc | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
comment-author: 'github-actions[bot]' | ||
body-includes: '### 📊 ${{ inputs.title }}' | ||
|
||
- name: Post Coverage Comment | ||
uses: peter-evans/create-or-update-comment@v4 | ||
with: | ||
comment-id: ${{ steps.fc.outputs.comment-id }} | ||
edit-mode: replace | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: | | ||
### 📊 ${{ inputs.title }} | ||
${{ steps.parse.outputs.coverage-summary }} |
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
v16.17.1 | ||
v18 |
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
Oops, something went wrong.