diff --git a/.github/workflows/eslint_flow_jest.yml b/.github/workflows/eslint_flow_jest.yml index 6db783ab3..5c98139e2 100644 --- a/.github/workflows/eslint_flow_jest.yml +++ b/.github/workflows/eslint_flow_jest.yml @@ -1,68 +1,72 @@ name: ESLint & Flow & Jest on: push: branches: [master] pull_request: types: [opened, reopened] jobs: build: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - name: sudo ./install_protobuf.sh working-directory: ./scripts run: sudo ./install_protobuf.sh - name: npm install -g yarn run: npm install -g yarn - name: yarn ci-cleaninstall run: yarn ci-cleaninstall - name: yarn eslint --max-warnings=0 run: yarn eslint --max-warnings=0 - name: '[lib] flow' working-directory: ./lib run: ./node_modules/.bin/flow - name: '[keyserver] flow' working-directory: ./keyserver run: ./node_modules/.bin/flow - name: '[web] flow' working-directory: ./web run: ./node_modules/.bin/flow - name: '[landing] flow' working-directory: ./landing run: ./node_modules/.bin/flow - name: '[native] flow' working-directory: ./native run: ./node_modules/.bin/flow - name: '[desktop] flow' working-directory: ./desktop run: ./node_modules/.bin/flow - name: '[electron-update-server] flow' working-directory: ./services/electron-update-server run: ./node_modules/.bin/flow - name: '[lib] test' working-directory: ./lib env: ALCHEMY_API_KEY: ${{secrets.ALCHEMY_API_KEY}} run: yarn test - name: '[keyserver] test' working-directory: ./keyserver run: yarn test - name: '[web] test' working-directory: ./web run: yarn test + + - name: '[native] test' + working-directory: ./native + run: yarn test diff --git a/.lintstagedrc.js b/.lintstagedrc.js index 08aa6ac68..224ebe472 100644 --- a/.lintstagedrc.js +++ b/.lintstagedrc.js @@ -1,75 +1,78 @@ const { CLIEngine } = require('eslint'); const { getClangPaths } = require('./scripts/get_clang_paths'); const { findRustProjectPath } = require('./scripts/get_cargo_path'); const cli = new CLIEngine({}); module.exports = { '*.{js,mjs,cjs}': function eslint(files) { // This logic is likely broken and needs to be updated. see ENG-1011 return ( 'eslint --cache --fix --max-warnings=0 ' + files.filter(file => !cli.isPathIgnored(file)).join(' ') ); }, '*.{css,html,md,json}': function prettier(files) { return 'prettier --write ' + files.join(' '); }, '*.sh': function shellCheck(files) { return 'shellcheck -x -P SCRIPTDIR ' + files.join(' '); }, 'lib/**/*.js': function libFlow(files) { return 'yarn workspace lib flow --quiet'; }, 'lib/**/*.js': function libTest(files) { return 'yarn workspace lib test'; }, '{web,lib}/**/*.js': function webFlow(files) { return 'yarn workspace web flow --quiet'; }, 'web/**/*.js': function webTest(files) { return 'yarn workspace web test'; }, '{native,lib}/**/*.js': function nativeFlow(files) { return 'yarn workspace native flow --quiet'; }, + '{native,lib}/**/*.js': function nativeFlow(files) { + return 'yarn workspace native test'; + }, '{keyserver,web,lib}/**/*.js': function keyserverFlow(files) { return 'yarn workspace keyserver flow --quiet'; }, '{keyserver,web,lib}/**/*.js': function keyserverTest(files) { return 'yarn workspace keyserver test'; }, '{landing,lib}/**/*.js': function landingFlow(files) { return 'yarn workspace landing flow --quiet'; }, '{desktop,lib}/**/*.js': function desktopFlow(files) { return 'yarn workspace desktop flow --quiet'; }, 'services/electron-update-server/**/*.js': function desktopFlow(files) { return 'yarn workspace electron-update-server flow --quiet'; }, 'services/identity/**/*.rs': function testIdentity(files) { return 'bash -c "cd services/identity && cargo test"'; }, '{native,services}/**/*.{h,cpp,java,mm}': function clangFormat(files) { files = files.filter(path => { if (path.indexOf('generated') !== -1) { return false; } for (const allowedPath of getClangPaths()) { if (path.indexOf(allowedPath) !== -1) { return true; } } return false; }); return 'clang-format -i ' + files.join(' '); }, '*.rs': function rustFormat(files) { const paths = new Set(files.map(findRustProjectPath).filter(Boolean)); return `yarn rust-pre-commit ${Array.from(paths).join(' ')}`; }, 'services/terraform/*.tf': function checkTerraform(files) { return 'yarn terraform-pre-commit'; }, }; diff --git a/native/__tests__/test.js b/native/__tests__/test.js deleted file mode 100644 index 775db1d89..000000000 --- a/native/__tests__/test.js +++ /dev/null @@ -1,13 +0,0 @@ -// @flow - -import 'react-native'; -import * as React from 'react'; -import renderer from 'react-test-renderer'; - -import Root from '../root.react.js'; - -// Note: test renderer must be required after react-native. - -it('renders correctly', () => { - renderer.create(); -}); diff --git a/package.json b/package.json index 19e42a2c5..9ec840c80 100644 --- a/package.json +++ b/package.json @@ -1,58 +1,58 @@ { "private": true, "license": "BSD-3-Clause", "workspaces": [ "lib", "web", "native", "keyserver", "landing", "desktop", "keyserver/addons/rust-node-addon", "native/expo-modules/android-lifecycle", "native/expo-modules/aes-crypto", "services/electron-update-server", "web/opaque-ke-wasm" ], "scripts": { "clean": "yarn workspace lib clean && yarn workspace web clean && yarn workspace native clean && yarn workspace keyserver clean && yarn workspace landing clean && yarn workspace desktop clean && yarn workspace rust-node-addon clean && yarn workspace electron-update-server clean && rm -rf node_modules/", "cleaninstall": "(killall flow || pkill flow || true) && yarn clean && yarn", "ci-cleaninstall": "yarn cleaninstall --frozen-lockfile --skip-optional --network-timeout 180000", "eslint": "eslint .", "eslint:fix": "eslint --fix .", "clang-format-all": "eval `node scripts/get_clang_paths_cli.js` | xargs clang-format -i", "rust-pre-commit": "./scripts/rust_pre_commit.sh", "terraform-pre-commit": "./scripts/terraform_pre_commit.sh", "prepare": "husky install", "arcpatch": "git pull --all --tags && arc patch", "postinstall": "bash ./postinstall.sh", "flow-all": "yarn workspace lib flow && yarn workspace web flow && yarn workspace landing flow && yarn workspace native flow && yarn workspace keyserver flow && yarn workspace desktop flow && yarn workspace electron-update-server flow", - "jest-all": "yarn workspace lib test && yarn workspace keyserver test && yarn workspace web test" + "jest-all": "yarn workspace lib test && yarn workspace keyserver test && yarn workspace web test && yarn workspace native test" }, "devDependencies": { "babel-eslint": "^10.1.0", "clang-format": "^1.8.0", "core-js": "^3.6.5", "eslint": "^7.32.0", "eslint-config-prettier": "^8.1.0", "eslint-plugin-flowtype": "^5.4.0", "eslint-plugin-import": "^2.27.5", "eslint-plugin-jest": "^24.2.2", "eslint-plugin-monorepo": "^0.3.2", "eslint-plugin-prettier": "^3.3.1", "eslint-plugin-react": "^7.22.0", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-react-native": "^3.10.0", "find-up": "^5.0.0", "flow-mono-cli": "^1.5.0", "gaxios": "^4.3.2", "husky": "^7.0.0", "lint-staged": "^12.1.4", "patch-package": "^6.4.7", "postinstall-postinstall": "^2.0.0", "prettier": "^2.8.4" }, "resolutions": { "react-native-flipper": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz" } }