Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test compatibility with actions #230

Open
wants to merge 7 commits into
base: next
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ jobs:
- attach_workspace:
at: .
- run:
name: Test with compatibility checks
command: yarn test:compat
command: yarn test
- persist_to_workspace:
root: .
paths:
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/backwards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Test backwards compatiblity

on: [push]

jobs:
test_backwards:
name: Test backwards on node ${{ matrix.node_version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node: [10]
steps:
- uses: actions/setup-node@v1
with:
node-version: "10.x"
- uses: actions/checkout@v1
- name: Cache node modules
id: cache-modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.OS }}-buildBackwards-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.OS }}-buildBackwards-${{ env.cache-name }}-
${{ runner.OS }}-buildBackwards-
- name: Install
if: steps.cache-modules.outputs.cache-hit != 'true'
run: yarn add -D -W [email protected] [email protected]
- name: Test
run: yarn test:components
31 changes: 31 additions & 0 deletions .github/workflows/forwards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Test compatiblity with react@next

on: [push]

jobs:
test_forwards:
name: Test forwards on node ${{ matrix.node_version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node: [10]
steps:
- uses: actions/setup-node@v1
with:
node-version: "10.x"
- uses: actions/checkout@v1
- name: Cache node modules
id: cache-modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.OS }}-buildForwards-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.OS }}-buildForwards-${{ env.cache-name }}-
${{ runner.OS }}-buildForwards-
- name: Install
if: steps.cache-modules.outputs.cache-hit != 'true'
run: yarn add -D -W react@next react-dom@next
- name: Test
run: yarn test
31 changes: 31 additions & 0 deletions .github/workflows/latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Test compatiblity with react@latest

on: [push]

jobs:
test_latest:
name: Test latest on node ${{ matrix.node_version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node: [10]
steps:
- uses: actions/setup-node@v1
with:
node-version: "10.x"
- uses: actions/checkout@v1
- name: Cache node modules
id: cache-modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.OS }}-buildLatest-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.OS }}-buildLatest-${{ env.cache-name }}-
${{ runner.OS }}-buildLatest-
- name: Install
if: steps.cache-modules.outputs.cache-hit != 'true'
run: yarn add -D -W react@latest react-dom@latest
- name: Test
run: yarn test
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ cache:
yarn: true
directories:
- node_modules
script: yarn && yarn ci
install:
- yarn
script: yarn bootstrap && yarn ci
after_success:
- bash <(curl -s https://codecov.io/bash) -e TRAVIS_NODE_VERSION
10 changes: 1 addition & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,7 @@ Use the following command to test all packages in watch mode. Refer to the [Jest
yarn test:watch
```

In general, this is sufficient during development. Travis CI will apply a more rigorous set of tests.

#### Testing for compatibility

```sh
yarn test:compat
```

This runs all tests using various versions of `react` and `react-dom`, to check for compatibility with older/newer versions of React. This is what CircleCI and Travis run.
In general, this is sufficient during development. The CI will apply a more rigorous set of tests.

### Working with the examples

Expand Down
10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,9 @@
"test:watch": "yarn test -- --watch",
"test:devtools": "jest react-async-devtools/src",
"test:components": "jest src/Async.spec.js --collectCoverageFrom=src/Async.js",
"test:backwards": "yarn add -D -W [email protected] [email protected] && yarn resolutions:fix-react && yarn test:components",
"test:forwards": "yarn add -D -W react@next react-dom@next && yarn resolutions:fix-react && yarn test",
"test:latest": "yarn add -D -W react@latest react-dom@latest && yarn resolutions:fix-react && yarn test",
"test:compat": "yarn test:backwards && yarn test:forwards && yarn test:latest",
"test:examples": "CI=1 lerna run --scope '*-example' test -- --passWithNoTests --watchAll=false",
"test:chromatic": "chromatic --app-code iiua39bmt0j --build-script-name build:storybook --exit-zero-on-changes",
"resolutions:fix-react": "jq '.resolutions.react = .devDependencies.react|.resolutions.\"react-dom\"=.devDependencies.react' package.json > package.json.new && mv package.json.new package.json && yarn install",
"ci": "yarn lint && yarn test:compat && yarn test:examples",
"ci": "yarn lint && yarn test && yarn test:examples",
"build:packages": "lerna run --scope 'react-async*' build",
"build:examples": "lerna run --scope '*-example' build",
"build:storybook": "build-storybook -o storybook",
Expand Down Expand Up @@ -69,7 +64,6 @@
"eslint-plugin-react-hooks": "2.3.0",
"jest": "24.9.0",
"lerna": "3.19.0",
"node-jq": "1.11.0",
"now": "16.6.3",
"npm-run-all": "4.1.5",
"prettier": "1.19.1",
Expand All @@ -83,4 +77,4 @@
"resolutions": {
"@types/react": "16.9.13"
}
}
}