-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added CI for all packages (#62)
* first commit * Removed excess flow * fix(playground): uncommented lint job * style(model): renamed Model package workflow * feat: add working directory input on composite actions, add a name of package on mutation test comment * fix: add proper comment_tag to mutation tests and custom-title to unit tests to distinguish test reports for different packages * style: put name of package in block in unit test reports * style: changed workflows' names
- Loading branch information
1 parent
fb6e81d
commit 5390859
Showing
9 changed files
with
292 additions
and
147 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,21 @@ | ||
name: "Build" | ||
inputs: | ||
package-name: | ||
description: 'Name of the package' | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: .nvmrc | ||
|
||
- name: Setup environment | ||
uses: ./.github/actions/setup | ||
|
||
- name: Build the package with dependencies | ||
env: | ||
STRYKER_DASHBOARD_API_KEY: ${{ inputs.stryker_dashboard_api_key }} | ||
shell: bash | ||
run: yarn workspaces foreach -Rpt --from '${{ inputs.package-name }}' run build |
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,19 @@ | ||
name: "Lint" | ||
inputs: | ||
package-name: | ||
description: 'Name of the package' | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: .nvmrc | ||
|
||
- name: Setup environment | ||
uses: ./.github/actions/setup | ||
|
||
- name: Run ESLint check | ||
shell: bash | ||
run: yarn workspace ${{ inputs.package-name }} lint: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,22 @@ | ||
name: Mutation tests for all files | ||
inputs: | ||
package-name: | ||
description: 'Name of the package' | ||
required: true | ||
stryker_dashboard_api_key: | ||
description: 'Stryker dashboard api key' | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: .nvmrc | ||
|
||
- name: Setup environment | ||
uses: ./.github/actions/setup | ||
|
||
- name: Run mutation tests | ||
shell: bash | ||
id: run-mutation-tests | ||
run: yarn workspace ${{ inputs.package-name }} test:mutations --dashboard.version main |
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,99 @@ | ||
name: Mutation tests for changed files | ||
inputs: | ||
working-directory: | ||
description: 'Path to the ./packages/name_of_your_package_folder' | ||
required: true | ||
package-name: | ||
description: 'A full name of the package' | ||
required: true | ||
stryker_dashboard_api_key: | ||
description: 'Stryker dashboard api key' | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: .nvmrc | ||
|
||
- name: Setup environment | ||
uses: ./.github/actions/setup | ||
|
||
- name: Get changed files | ||
uses: tj-actions/[email protected] | ||
id: changed-files | ||
with: | ||
files_yaml: | | ||
src: | ||
- 'src/**/*.ts' | ||
- '!src/**/*.spec.ts' | ||
- '!src/**/__mocks__/**' | ||
separator: "','" | ||
path: ${{ inputs.working-directory }} | ||
|
||
- name: Run mutation tests | ||
if: steps.changed-files.outputs.src_any_changed == 'true' | ||
shell: bash | ||
id: run-mutation-tests | ||
run: yarn workspace ${{ inputs.package-name }} test:mutations --mutate ${{format('''{0}''', steps.changed-files.outputs.src_all_changed_files)}} | ||
continue-on-error: true | ||
|
||
- name: Find current PR's number | ||
uses: jwalton/gh-find-current-pr@v1 | ||
id: findPr | ||
|
||
- name: Comment on successful mutation testing | ||
uses: thollander/actions-comment-pull-request@v2 | ||
env: | ||
STRYKER_DASHBOARD_API_KEY: ${{ inputs.stryker_dashboard_api_key }} | ||
if: steps.changed-files.outputs.src_any_changed == 'true' && steps.run-mutation-tests.outcome == 'success' && ${{ steps.findPr.outputs.number != '' }} | ||
with: | ||
message: | | ||
✅ Mutation testing passed for `${{ inputs.working-directory }}` | ||
Report: https://dashboard.stryker-mutator.io/reports/github.com/editor-js/document-model/PR-${{ github.event.number }} | ||
<details> | ||
<summary>Mutated files</summary> | ||
<pre> | ||
${{ join(fromJson(format('[{0}]', format('''{0}''', steps.changed-files.outputs.src_all_changed_files))), '<br />') }} | ||
</pre> | ||
</details> | ||
comment_tag: mutation-tests for `${{ inputs.working-directory }}` | ||
pr_number: ${{ steps.findPr.outputs.number != '' && steps.findPr.outputs.number || '1'}} | ||
|
||
- name: Comment on failed mutation testing | ||
uses: thollander/actions-comment-pull-request@v2 | ||
env: | ||
STRYKER_DASHBOARD_API_KEY: ${{ inputs.stryker_dashboard_api_key }} | ||
if: steps.changed-files.outputs.src_any_changed == 'true' && steps.run-mutation-tests.outcome == 'failure' && ${{ steps.findPr.outputs.number != '' }} | ||
with: | ||
message: | | ||
❌ Mutation testing hasn't passed score threshold for `${{ inputs.working-directory }}` | ||
Report: https://dashboard.stryker-mutator.io/reports/github.com/editor-js/document-model/PR-${{ github.event.number }} | ||
<details> | ||
<summary>Mutated files</summary> | ||
<pre> | ||
${{ join(fromJson(format('[{0}]', format('''{0}''', steps.changed-files.outputs.src_all_changed_files))), '<br />') }} | ||
</pre> | ||
</details> | ||
comment_tag: mutation-tests for `${{ inputs.working-directory }}` | ||
pr_number: ${{ steps.findPr.outputs.number != '' && steps.findPr.outputs.number || '1'}} | ||
|
||
- name: Comment on empty changes | ||
uses: thollander/actions-comment-pull-request@v2 | ||
env: | ||
STRYKER_DASHBOARD_API_KEY: ${{ inputs.stryker_dashboard_api_key }} | ||
if: steps.changed-files.outputs.src_any_changed == 'false' && ${{ steps.findPr.outputs.number != '' }} | ||
with: | ||
message: | | ||
⏭️ No files to mutate for `${{ inputs.working-directory }}` | ||
comment_tag: mutation-tests for `${{ inputs.working-directory }}` | ||
pr_number: ${{ steps.findPr.outputs.number != '' && steps.findPr.outputs.number || '1'}} | ||
|
||
- if: steps.changed-files.outputs.src_any_changed == 'true' && steps.run-mutation-tests.outcome == 'failure' | ||
shell: bash | ||
run: exit 1 |
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,29 @@ | ||
name: Unit tests | ||
inputs: | ||
working-directory: | ||
description: 'Path to the ./packages/name_of_your_package_folder' | ||
required: true | ||
package-name: | ||
description: 'A full name of the package' | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: .nvmrc | ||
- uses: ./.github/actions/setup | ||
|
||
# Find current PR's number | ||
- uses: jwalton/gh-find-current-pr@v1 | ||
id: findPr | ||
|
||
- name: Run unit tests | ||
uses: ArtiomTr/jest-coverage-report-action@v2 | ||
with: | ||
custom-title: Coverage report for `${{ inputs.working-directory }}` | ||
working-directory: ${{ inputs.working-directory }} | ||
test-script: yarn workspace ${{ inputs.package-name }} test | ||
package-manager: yarn | ||
prnumber: ${{ steps.findPr.outputs.number }} |
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,53 @@ | ||
name: Dom-adapters check | ||
on: | ||
push: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run ESLint check | ||
uses: ./.github/actions/lint | ||
with: | ||
package-name: '@editorjs/dom-adapters' | ||
|
||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run unit tests | ||
uses: ./.github/actions/unit-tests | ||
with: | ||
working-directory: './packages/dom-adapters' | ||
package-name: '@editorjs/dom-adapters' | ||
|
||
mutation-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Run mutation tests for changed files | ||
if: ${{ github.event_name == 'push' }} | ||
uses: ./.github/actions/mutation-tests-changed-files | ||
with: | ||
package-name: '@editorjs/dom-adapters' | ||
working-directory: './packages/dom-adapters' | ||
stryker_dashboard_api_key: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} | ||
|
||
- name: Run mutation tests for all files | ||
if: ${{ github.event_name == 'merge_group' }} | ||
uses: ./.github/actions/mutation-tests-all-files | ||
with: | ||
package-name: '@editorjs/dom-adapters' | ||
working-directory: './packages/dom-adapters' | ||
stryker_dashboard_api_key: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build the package | ||
uses: ./.github/actions/build | ||
with: | ||
package-name: '@editorjs/dom-adapters' |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
5390859
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage report for
./packages/dom-adapters
Test suite run success
1 tests passing in 1 suite.
Report generated by 🧪jest coverage report action from 5390859
5390859
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage report for
./packages/model
Test suite run success
347 tests passing in 20 suites.
Report generated by 🧪jest coverage report action from 5390859
5390859
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage report for
./packages/model
Test suite run success
347 tests passing in 20 suites.
Report generated by 🧪jest coverage report action from 5390859
5390859
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage report for
./packages/dom-adapters
Test suite run success
1 tests passing in 1 suite.
Report generated by 🧪jest coverage report action from 5390859
5390859
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage report for
./packages/model
Test suite run success
347 tests passing in 20 suites.
Report generated by 🧪jest coverage report action from 5390859