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

Release 2 #2159

Merged
merged 18 commits into from
Oct 4, 2020
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
82 changes: 44 additions & 38 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: node_js
node_js: 12.16.2
node_js: 12.18.3
addons:
apt:
update: true
Expand All @@ -14,49 +14,55 @@ before_install:
addons:
chrome: stable

script:
- docker -v
- docker-compose -v
# fail on error
# - set -e
- echo 'docker-compose build' && echo -en 'travis_fold:start:script.1\\r'
- docker-compose build
jobs:
include:
- stage: tests
name: "Unit tests"
script:
- docker -v
- docker-compose -v
# fail on error
# - set -e
- echo 'docker-compose build' && echo -en 'travis_fold:start:script.1\\r'
- docker-compose build

- echo -en 'travis_fold:end:script.1\\r'
- echo 'docker-compose up -d' && echo -en 'travis_fold:start:script.2\\r'
- docker-compose up -d
- echo -en 'travis_fold:end:script.2\\r'
- echo -en 'travis_fold:end:script.1\\r'
- echo 'docker-compose up -d' && echo -en 'travis_fold:start:script.2\\r'
- docker-compose up -d
- echo -en 'travis_fold:end:script.2\\r'

# wait for alchemy (the slowest latest process to respond
- bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' 127.0.0.1:3000)" != "200" ]]; do sleep 5; done'
# prin the status of the services
- npm run service-status
# wait for alchemy (the slowest latest process to respond
- bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' 127.0.0.1:3000)" != "200" ]]; do sleep 5; done'
# prin the status of the services
- npm run service-status

# show the daos that are indexed
- ./scripts/checkDaos.sh
- echo -en 'travis_fold:end:script.4\\r'
# show the daos that are indexed
- ./scripts/checkDaos.sh
- echo -en 'travis_fold:end:script.4\\r'

# check lint
- npm run lint
# unit tests
- npm run test:unit -- --forceExit
# unit tests
- npm run test:unit -- --forceExit
# run coverage report
- docker-compose logs alchemy || true
# run integration tests
- npm run test:integration:headless
- npm run report-coverage
# get some diagnostic info fo debugging travis
- echo 'Debug info:' && echo -en 'travis_fold:start:script.3\\r'
- npm run service-status
- docker-compose logs alchemy || true
- echo -en 'travis_fold:end:script.3\\r'

- docker-compose logs alchemy || true
# run integration tests
- npm run test:integration:headless
- ./scripts/checkDaos.sh

# get some diagnostic info fo debugging travis
- echo 'Debug info:' && echo -en 'travis_fold:start:script.3\\r'
- npm run service-status
- docker-compose logs alchemy || true
- echo -en 'travis_fold:end:script.3\\r'

- ./scripts/checkDaos.sh

# see if the app builds correctly
- echo 'npm run build-travis' && echo -en 'travis_fold:start:script.4\\r'
- npm run build-travis
- echo -en 'travis_fold:end:script.4\\r'
# see if the app builds correctly
- echo 'npm run build-travis' && echo -en 'travis_fold:start:script.4\\r'
- npm run build-travis
- echo -en 'travis_fold:end:script.4\\r'

- stage: tests
name: "ts/es lint"
script: npm run lint

deploy:
provider: pages
Expand Down
60 changes: 28 additions & 32 deletions package-lock.json

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

20 changes: 19 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@
"json",
"node"
],
"coveragePathIgnorePatterns": [
"/node_modules/",
"/test/"
],
"coverageThreshold": {
"global": {
"branches": 8,
"functions": 8,
"lines": 8,
"statements": 8
}
},
"collectCoverage": true,
"collectCoverageFrom": [
"src/**/*.{js,ts}"
],
"moduleNameMapper": {
"\\.(scss|css|less|svg|png|jpg)$": "identity-obj-proxy",
"^arc": "<rootDir>/src/arc",
Expand Down Expand Up @@ -71,6 +87,7 @@
"start-staging": "npm run start-staging-rinkeby",
"start-xdai": "cross-env NODE_ENV=production SHOW_ALL_DAOS=true NETWORK=xdai node --max_old_space_size=4096 ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --config webpack.dev.config.js",
"storybook": "start-storybook",
"report-coverage": "cat ./coverage/lcov.info | coveralls",
"test": "wdio ./test/integration/wdio.conf.js",
"test:integration": "wdio ./test/integration/wdio.conf.js --inspect",
"test:integration:headless": "wdio ./test/integration/wdio-headless.conf.js",
Expand All @@ -79,7 +96,7 @@
"dependencies": {
"3box": "^1.20.3",
"@burner-wallet/burner-connect-provider": "^0.1.1",
"@daostack/arc.js": "2.0.0-experimental.55",
"@daostack/arc.js": "2.0.0-experimental.56",
"@dorgtech/daocreator-ui-experimental": "1.1.13",
"@portis/web3": "^2.0.0-beta.56",
"@sentry/browser": "^5.0.8",
Expand Down Expand Up @@ -195,6 +212,7 @@
"babel-loader": "^8.0.6",
"chai": "^4.2.0",
"copy-webpack-plugin": "^5.1.1",
"coveralls": "^3.1.0",
"cross-env": "^5.1.3",
"dotenv": "^8.2.0",
"eslint": "^7.3.1",
Expand Down
6 changes: 5 additions & 1 deletion src/actions/arcActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import {
ReputationFromTokenPlugin,
Proposal,
FundingRequestProposal,
JoinProposal,
IProposalState,
TokenTradeProposal,
JoinProposal,
} from "@daostack/arc.js";
import { IAsyncAction } from "actions/async";
import { getArc } from "arc";
Expand Down Expand Up @@ -91,6 +92,9 @@ async function tryRedeemProposal(proposalId: string, accountAddress: string, obs
case "Join":
await (proposal as JoinProposal).redeem().subscribe(...observer);
break;
case "TokenTrade":
await (proposal as TokenTradeProposal).redeem().subscribe(...observer);
break;
default:
break;
}
Expand Down
4 changes: 3 additions & 1 deletion src/assets/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@
"Reputation Minted": "Reputation Minted:",
"Minimum DAO bounty": "Minimum DAO bounty:",
"Amount": "Amount:",
"Amount Redeemed": "Amount Redeemed:"
"Amount Redeemed": "Amount Redeemed:",
"Add Params": "Add Params",
"Remove Params": "Remove Params"
}
3 changes: 2 additions & 1 deletion src/components/Account/AccountBalances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as css from "layouts/App.scss";
import * as React from "react";
import { combineLatest, of } from "rxjs";
import { getArc } from "arc";
import { GRAPH_POLL_INTERVAL } from "../../settings";

interface IExternalProps {
daoState?: IDAOState;
Expand Down Expand Up @@ -76,7 +77,7 @@ export default withSubscription({
})) : undefined;

return combineLatest(
member ? member.state( { subscribe: true }).pipe(ethErrorHandler()) : of(null),
member ? member.state( { polling: true, pollInterval: GRAPH_POLL_INTERVAL }).pipe(ethErrorHandler()) : of(null),
ethBalance(accountAddress).pipe(ethErrorHandler()),
arc.GENToken().balanceOf(accountAddress).pipe(ethErrorHandler())
);
Expand Down
3 changes: 2 additions & 1 deletion src/components/Account/AccountProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { IProfileState } from "reducers/profilesReducer";
import { combineLatest, of } from "rxjs";
import Loading from "components/Shared/Loading";
import * as css from "./Account.scss";
import { GRAPH_POLL_INTERVAL } from "../../settings";

type IExternalProps = RouteComponentProps<any>;

Expand Down Expand Up @@ -355,7 +356,7 @@ const SubscribedAccountProfilePage = withSubscription({

return combineLatest(
// subscribe if only to to get DAO reputation supply updates
daoAvatarAddress ? dao.state({subscribe: true}) : of(null),
daoAvatarAddress ? dao.state({ polling: true, pollInterval: GRAPH_POLL_INTERVAL }) : of(null),
of(memberState),
ethBalance(accountAddress)
.pipe(ethErrorHandler()),
Expand Down
3 changes: 2 additions & 1 deletion src/components/Dao/DaoContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import DaoMembersPage from "./DaoMembersPage";
import * as css from "./Dao.scss";
import DaoLandingPage from "components/Dao/DaoLandingPage";
import i18next from "i18next";
import { GRAPH_POLL_INTERVAL } from "../../settings";

type IExternalProps = RouteComponentProps<any>;

Expand Down Expand Up @@ -151,7 +152,7 @@ const SubscribedDaoContainer = withSubscription({
const daoAddress = props.match.params.daoAvatarAddress;
const dao = arc.dao(daoAddress);
const observable = combineLatest(
dao.state({ subscribe: true, fetchAllData: true }), // DAO state
dao.state({ polling: true, pollInterval: GRAPH_POLL_INTERVAL, fetchAllData: true }), // DAO state
dao.members()
);
return observable;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dao/DaoHistoryPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export default withSubscription({
${Stake.fragments.StakeFields}
${Plugin.baseFragment}
`;
await arc.getObservable(prefetchQuery, { subscribe: true }).pipe(first()).toPromise();
await arc.getObservable(prefetchQuery, { polling: true }).pipe(first()).toPromise();
return combineLatest(
dao.proposals({
where: {
Expand Down
3 changes: 2 additions & 1 deletion src/components/Dao/DaoPluginsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import * as css from "./DaoPluginsPage.scss";
import ProposalPluginCard from "./ProposalPluginCard";
import SimplePluginCard from "./SimplePluginCard";
import i18next from "i18next";
import { GRAPH_POLL_INTERVAL } from "../../settings";

const Fade = ({ children, ...props }: any) => (
<CSSTransition
Expand Down Expand Up @@ -152,7 +153,7 @@ const SubscribedDaoPluginsPage = withSubscription({
const dao = new DAO(arc, props.daoState);

return combineLatest(
dao.plugins({ where: { isRegistered: true } }, { fetchAllData: true, subscribe: true }),
dao.plugins({ where: { isRegistered: true } }, { fetchAllData: true, polling: true, pollInterval: GRAPH_POLL_INTERVAL }),
// Find the SchemeFactory plugin if this dao has one
Plugin.search(arc, { where: { dao: dao.id, name: "SchemeFactory" } }).pipe(mergeMap((plugin: Array<AnyPlugin>): Observable<IPluginState> => plugin[0] ? plugin[0].state() : of(null)))
);
Expand Down
4 changes: 3 additions & 1 deletion src/components/Dao/ProposalPluginCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as React from "react";
import { Link } from "react-router-dom";
import TrainingTooltip from "components/Shared/TrainingTooltip";
import * as css from "./PluginCard.scss";
import { GRAPH_POLL_INTERVAL } from "../../settings";

interface IExternalProps {
daoState: IDAOState;
Expand Down Expand Up @@ -100,7 +101,8 @@ export default withSubscription({
},
}, {
fetchAllData: true,
subscribe: true, // subscribe to updates of the proposals. We can replace this once https://github.com/daostack/subgraph/issues/326 is done
polling: true, // subscribe to updates of the proposals.
pollInterval: GRAPH_POLL_INTERVAL,
}); // the list of boosted proposals
},
});
Expand Down
7 changes: 4 additions & 3 deletions src/components/Daos/DaosPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import i18next from "i18next";
import classNames from "classnames";
import axios from "axios";
import { getNetworkName } from "lib/util";
import { GRAPH_POLL_INTERVAL } from "../../settings";

type SubscriptionData = [DAO[], DAO[], DAO[]];

Expand Down Expand Up @@ -328,13 +329,13 @@ const createSubscriptionObservable = (props: IStateProps, data: SubscriptionData
memberDAOsquery,
(arc: Arc, r: any) => new DAO(arc, createDaoStateFromQuery(r.dao)),
undefined,
{ subscribe: true }
{ polling: true, pollInterval: GRAPH_POLL_INTERVAL }
) : of([]);
// eslint-disable-next-line @typescript-eslint/naming-convention
const followDAOs = followingDAOs.length ? arc.daos({ where: { id_in: followingDAOs }, orderBy: "name", orderDirection: "asc" }, { fetchAllData: true, subscribe: true }) : of([]);
const followDAOs = followingDAOs.length ? arc.daos({ where: { id_in: followingDAOs }, orderBy: "name", orderDirection: "asc" }, { fetchAllData: true, polling: true, pollInterval: GRAPH_POLL_INTERVAL }) : of([]);

return combineLatest(
arc.daos({ orderBy: "name", orderDirection: "asc", first: PAGE_SIZE, skip: data ? data[0].length : 0 }, { fetchAllData: true, subscribe: true }),
arc.daos({ orderBy: "name", orderDirection: "asc", first: PAGE_SIZE, skip: data ? data[0].length : 0 }, { fetchAllData: true, polling: true, pollInterval: GRAPH_POLL_INTERVAL }),
followDAOs,
memberOfDAOs
);
Expand Down
Loading