Use GitHub workflows for CI

Close #1845
Fix #1841
This commit is contained in:
Nicolas Gallagher
2020-12-14 12:10:15 -08:00
parent e03ac45173
commit 4a1b31e3ef
7 changed files with 69 additions and 27 deletions

View File

@@ -1,7 +1,9 @@
name: compressed-size
name: performance
on: [pull_request]
jobs:
build:
compressed-size:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

53
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,53 @@
name: test
on:
push:
branches:
- "master"
pull_request:
types: [opened, synchronize, reopened]
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
- run: npm install -g yarn
- run: yarn install
- run: yarn fmt:report
type-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
- run: npm install -g yarn
- run: yarn install
- run: yarn flow
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
- run: npm install -g yarn
- run: yarn install
- run: yarn lint:report
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
- run: npm install -g yarn
- run: yarn install
- run: yarn jest

View File

@@ -1,17 +0,0 @@
language: node_js
node_js:
- "10"
before_install:
# Install Yarn
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH
cache:
yarn: true
directories:
- node_modules
script:
- yarn test

View File

@@ -208,8 +208,8 @@ MIT license.
[package-badge]: https://img.shields.io/npm/v/react-native-web.svg?style=flat
[package-url]: https://yarnpkg.com/en/package/react-native-web
[ci-badge]: https://travis-ci.org/necolas/react-native-web.svg?branch=master
[ci-url]: https://travis-ci.org/necolas/react-native-web
[ci-badge]: https://github.com/necolas/react-native-web/workflows/test/badge.svg
[ci-url]: https://github.com/necolas/react-native-web/actions
[react-native-url]: https://facebook.github.io/react-native/
[contributing-url]: https://github.com/necolas/react-native-web/blob/master/.github/CONTRIBUTING.md
[good-first-issue-url]: https://github.com/necolas/react-native-web/labels/good%20first%20issue

View File

@@ -13,14 +13,15 @@
"docs:release": "cd packages/docs && yarn release",
"flow": "flow",
"fmt": "prettier --write \"**/*.js\"",
"fmt:report": "prettier --check \"**/*.js\"",
"jest": "jest --config ./scripts/jest/config.js",
"lint": "yarn lint:check --fix",
"lint:check": "eslint packages scripts",
"lint": "yarn lint:report --fix",
"lint:report": "eslint packages scripts",
"precommit": "lint-staged",
"prerelease": "yarn test && yarn compile && yarn compile:commonjs",
"release": "node ./scripts/release/publish.js",
"postrelease": "yarn benchmarks:release && yarn docs:release",
"test": "yarn flow && yarn lint:check && yarn jest --runInBand"
"test": "yarn flow && yarn lint:report && yarn jest --runInBand"
},
"devDependencies": {
"@babel/cli": "^7.8.4",

View File

@@ -418,10 +418,14 @@ describe('components/Modal', () => {
function TestComponent() {
React.useEffect(() => spy('mount'), []);
return <Modal visible={true}><a ref={(ref) => ref ? spy('ref') : spy('noref')} /></Modal>;
return (
<Modal visible={true}>
<a ref={ref => (ref ? spy('ref') : spy('noref'))} />
</Modal>
);
}
render(<TestComponent />)
render(<TestComponent />);
expect(spy).toHaveBeenNthCalledWith(1, 'ref');
expect(spy).toHaveBeenNthCalledWith(2, 'mount');

View File

@@ -11,7 +11,6 @@ import * as React from 'react';
import mergeRefs from '../mergeRefs';
export default function useMergeRefs(...args: $ReadOnlyArray<React.ElementRef<any>>) {
// TODO(memoize) #1755
return React.useMemo(
() => mergeRefs(...args),
// eslint-disable-next-line