diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..f29b903 --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": ["config:js-lib", "helpers:disableTypesNodeMajor"], + "postUpdateOptions": ["yarnDedupeHighest"], + "automerge": true, + "automergeType": "branch", + "automergeStrategy": "rebase", + "platformAutomerge": true, + "semanticCommits": "enabled", + "prHourlyLimit": 0, + "prConcurrentLimit": 0 +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2d85584 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,87 @@ +name: ci + +on: + - push + - pull_request + +jobs: + pre_job: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - name: Skip Duplicate Actions + id: skip_check + uses: fkirc/skip-duplicate-actions@v5.2.0 + with: + concurrent_skipping: 'same_content' + paths_ignore: '[".vscode/", "**/docs/**", "**/*.md"]' + do_not_skip: '["pull_request"]' + + lint: + name: Linting Checks + needs: pre_job + if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup NodeJs + uses: actions/setup-node@v3 + with: + node-version: 'lts/*' + + - name: Install Dependencies + run: yarn install --immutable + + - name: Run Linting Checks + run: yarn lint + + test: + name: 'Test: Node v${{ matrix.node_version }}' + needs: pre_job + if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + strategy: + fail-fast: false + matrix: + os: + - 'ubuntu-latest' + node_version: + - '18' + - '20' + runs-on: ${{ matrix.os }} + env: + REPORT_COVERAGE: ${{ fromJSON('["false", "true"]')[matrix.node_version == '18' && matrix.os == 'ubuntu-latest'] }} + EXCLUDE_RACE_TESTS: true + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + # Fetch all commits for codecov. + fetch-depth: ${{ fromJSON('[0, 1]')[ env.REPORT_COVERAGE == 'true'] }} + + - name: Setup NodeJs for building + uses: actions/setup-node@v3 + with: + node-version: 'lts/*' + + - name: Install Dependencies + run: yarn install --immutable + + - name: Build + run: yarn build + + - name: Setup NodeJs ${{ matrix.node_version }} for testing + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node_version }} + + - name: Run Tests + run: yarn test + + - name: Report coverage + uses: codecov/codecov-action@v3 + if: (success() || failure()) && env.REPORT_COVERAGE == 'true' + with: + files: coverage/lcov.info diff --git a/README.md b/README.md index 7caac40..78a0aea 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Strongly-Typed Events +[![Build Status](https://github.com/vitaly-t/sub-events/workflows/ci/badge.svg?branch=master)](https://github.com/vitaly-t/sub-events/actions?query=workflow%3Aci+branch%3Amaster) + Lightweight, strongly-typed events, with monitored subscriptions. * Documentation: [API] + [WiKi].