Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,35 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 14
- 16
- 18
react: [16, 17]
node: [14, 16, 18]
react: [16, 17, 18]

name: build (${{ matrix.node-version }} w/ React ${{ matrix.react }}
name: build (${{ matrix.node }} w/ React ${{ matrix.react }}

steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ matrix.node }}

# Node 14 ships with npm@6 which doesn't install peerDeps by default.
- name: Install npm@7
if: matrix.node-version == '14'
if: matrix.node == '14'
run: npm install -g npm@7

- name: Install deps
run: npm ci

- name: Install React 16
if: matrix.react == '16'
- name: Install React ${{ matrix.react }}
run: npm i react@${{ matrix.react }} react-dom@${{ matrix.react }}

# `@testing-library/react@13` dropped support for React 16 and 17 so to ensure that we run
# fine under React 18 we should upgrade it if we're testing React 18.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's annoying, good note though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be better handled by a postinstall script? That way it works locally too?

Got the idea here: https://stackoverflow.com/a/60603000/659661

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm weary of putting it in a postinstall script because those run when you install the package from npm.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, TIL. I should probably learn more about npm...

- name: Install testing-library react for React 18
if: matrix.react == '18'
run: npm i @testing-library/react@13

- name: Run tests
run: npm test
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"prop-types": "^15.8.1"
},
"peerDependencies": {
"react": "16.x || 17.x",
"react-dom": "16.x || 17.x"
"react": "16.x || 17.x || 18.x",
"react-dom": "16.x || 17.x || 18.x"
},
"devDependencies": {
"@babel/preset-env": "^7.16.11",
Expand Down