feat: make @testing-library/dom
dependency optional
#280
Workflow file for this run
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
name: validate | |
on: | |
push: | |
branches: | |
- "+([0-9])?(.{+([0-9]),x}).x" | |
- "main" | |
- "next" | |
- "next-major" | |
- "beta" | |
- "alpha" | |
- "!all-contributors/**" | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
main: | |
# ignore all-contributors PRs | |
if: ${{ !contains(github.head_ref, 'all-contributors') }} | |
strategy: | |
fail-fast: false | |
matrix: | |
eslint: [6.8.0, 6, 7.0.0, 7, 8.0.0, 8] | |
node: [12.22.0, 12, 14.17.0, 14, 16.0.0, 16] | |
testing-library-dom: [8, 9] | |
exclude: | |
- node: 12.22.0 | |
testing-library-dom: 9 | |
- node: 12 | |
testing-library-dom: 9 | |
runs-on: ubuntu-latest | |
steps: | |
- name: ⬇️ Checkout repo | |
uses: actions/checkout@v3 | |
- name: ⎔ Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: 📥 Download deps | |
uses: bahmutov/npm-install@v1 | |
with: | |
useLockFile: false | |
- name: Install ESLint v${{ matrix.eslint }} | |
run: npm install --no-save --force eslint@${{ matrix.eslint }} | |
- name: Install @testing-library/dom v${{ matrix.testing-library-dom }} | |
run: npm install --no-save --force @testing-library/dom@${{ matrix.testing-library-dom }} | |
- name: Install TypeScript v4 | |
if: ${{ startsWith(matrix.node, 12) }} | |
run: npm install --no-save --force typescript@4 | |
- name: ▶️ Run validate script (without linting) | |
if: ${{ matrix.eslint != 8 }} | |
run: npm run validate -- build,test:coverage | |
- name: ▶️ Run validate script (with linting) | |
if: ${{ matrix.eslint == 8 }} | |
run: npm run validate | |
- name: ▶️ Ensure docs are up-to-date | |
if: ${{ matrix.eslint == 8 && matrix.node == 16 }} | |
run: npm run lint:generate-readme-table | |
- name: ⬆️ Upload coverage report | |
uses: codecov/codecov-action@v3 | |
release: | |
needs: main | |
runs-on: ubuntu-latest | |
if: ${{ github.repository == 'testing-library/eslint-plugin-jest-dom' && | |
contains('refs/heads/main,refs/heads/beta,refs/heads/next,refs/heads/alpha', | |
github.ref) && github.event_name == 'push' }} | |
steps: | |
- name: ⬇️ Checkout repo | |
uses: actions/checkout@v3 | |
- name: ⎔ Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: 📥 Download deps | |
uses: bahmutov/npm-install@v1 | |
with: | |
useLockFile: false | |
- name: 🏗 Run build script | |
run: npm run build | |
- run: ls -asl dist | |
- name: 🚀 Release | |
uses: cycjimmy/semantic-release-action@v3 | |
with: | |
semantic_version: 18 | |
branches: | | |
[ | |
'+([0-9])?(.{+([0-9]),x}).x', | |
'main', | |
'next', | |
'next-major', | |
{name: 'beta', prerelease: true}, | |
{name: 'alpha', prerelease: true} | |
] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |