Skip to content

Implement DocumentModel initialization #160

Implement DocumentModel initialization

Implement DocumentModel initialization #160

Workflow file for this run

name: Main workflow runner
on:
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- name: Run ESLint check
run: yarn lint:ci
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- name: Run unit tests
uses: ArtiomTr/jest-coverage-report-action@v2
with:
test-script: "yarn test"
package-manager: yarn
mutation-tests:
runs-on: ubuntu-latest
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
steps:
- uses: actions/checkout@v3
- name: Setup environment
uses: ./.github/actions/setup
- name: Get changed files
uses: tj-actions/changed-files@v39.0.0
id: changed-files
with:
files_yaml: |
src:
- 'src/**/*.ts'
- '!src/**/*.spec.ts'
- '!src/**/__mocks__/**'
separator: "','"
- name: Run mutation tests
if: steps.changed-files.outputs.src_any_changed == 'true'
id: run-mutation-tests
run: yarn test:mutations --mutate ${{format('''{0}''', steps.changed-files.outputs.src_all_changed_files)}}
continue-on-error: true
- name: Comment on successful mutation testing
uses: thollander/actions-comment-pull-request@v2
if: steps.changed-files.outputs.src_any_changed == 'true' && steps.run-mutation-tests.outcome == 'success'
with:
message: |
## ✅ Mutation testing passed
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
- name: Comment on failed mutation testing
uses: thollander/actions-comment-pull-request@v2
if: steps.changed-files.outputs.src_any_changed == 'true' && steps.run-mutation-tests.outcome == 'failure'
with:
message: |
## ❌ Mutation testing hasn't passed score threshold
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
- name: Comment on empty changes
uses: thollander/actions-comment-pull-request@v2
if: steps.changed-files.outputs.src_any_changed == 'false'
with:
message: |
## ⏭️ No files to mutate
comment_tag: mutation-tests
- if: steps.changed-files.outputs.src_any_changed == 'true' && steps.run-mutation-tests.outcome == 'failure'
run: exit 1
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- name: Build the package
run: yarn build