Skip to content

Commit

Permalink
Merge branch 'main' into SDK-323-remove-lerna-json
Browse files Browse the repository at this point in the history
  • Loading branch information
krpeacock committed Mar 23, 2022
2 parents f4e0121 + 08bb411 commit 524e2bf
Show file tree
Hide file tree
Showing 22 changed files with 4,350 additions and 4,357 deletions.
16 changes: 16 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,16 @@
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

Fixes # (issue)

# How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

# Checklist:

- [ ] My changes follow the guidelines in [CONTRIBUTING.md](https://github.com/dfinity/agent-js/blob/main/CONTRIBUTING.md).
- [ ] The title of this PR complies with [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
- [ ] I have edited the CHANGELOG accordingly.
- [ ] I have made corresponding changes to the documentation.
49 changes: 49 additions & 0 deletions .github/workflows/e2e-tests.yml
@@ -0,0 +1,49 @@
name: End to End

on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
ghc: ['8.8.4']
spec:
- '0.16.1'
node:
- 16

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- run: npm install -g npm

- run: npm install
- run: npm run lint --workspaces --if-present

# build monorepo incl. each subpackage
- run: npm run build --workspaces --if-present

- run: echo y | sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"

- name: running dfx
id: dfx
run: |
dfx start --background
- run: npm run e2e --workspaces --if-present
env:
CI: true
REPLICA_PORT: 8000
65 changes: 65 additions & 0 deletions .github/workflows/mitm.yml
@@ -0,0 +1,65 @@
name: Mitm

on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
ghc: ['8.8.4']
spec:
- '0.16.1'
node:
- 16

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- run: npm install -g npm

- run: npm install

# build monorepo incl. each subpackage
- run: npm run build --workspaces --if-present

- uses: actions/setup-python@v2
with:
python-version: '3.8'
- run: pip3 install mitmproxy~=8.0.0

- run: echo y | sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"

- name: running dfx
id: dfx
run: |
dfx start --background
- name: Running mitmdump
id: mitmdump
run: |
set -ex
mitmdump -p 8888 --mode reverse:http://127.0.0.1:8000 \
--modify-headers '/~s/Transfer-Encoding/' \
--modify-body '/~s/Hello/Hullo' \
&
sleep 5
- name: mitm e2e
env:
CI: true
REPLICA_PORT: 8888
MITM: true
run: npm run mitm --workspaces --if-present
123 changes: 0 additions & 123 deletions .github/workflows/nodejs-ci.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/unit-tests.yml
@@ -0,0 +1,44 @@
name: Unit tests

on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
ghc: ['8.8.4']
spec:
- '0.16.1'
node:
- 12
- 14
- 16

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- run: npm install -g npm

- run: npm install
- run: npm run lint --workspaces --if-present

# build monorepo incl. each subpackage
- run: npm run build --workspaces --if-present

# test monorepo incl. each subpackage
- run: npm run test
env:
CI: true
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -25,7 +25,7 @@ commands to keep in mind;
publicly. Normally you can use a replica distributed with dfx (ie. dfx start in a project),
but there is no guarantee that the `next` branch will work with the latest published dfx.
Once you have a replica running locally, you must pass the port to the e2e tests using the
`IC_REF_PORT` environment vairable. If that variable is not set, the tests will fail.
`REPLICA_PORT` environment vairable. If that variable is not set, the tests will fail.

### Contributing

Expand Down
12 changes: 6 additions & 6 deletions demos/ledgerhq/package.json
Expand Up @@ -2,11 +2,11 @@
"name": "ic-agent-ledgerhq-app",
"private": true,
"dependencies": {
"@dfinity/agent": "^0.10.3",
"@dfinity/authentication": "^0.10.3",
"@dfinity/identity": "^0.10.3",
"@dfinity/identity-ledgerhq": "^0.10.3",
"@dfinity/principal": "^0.10.3",
"@dfinity/agent": "^0.10.4",
"@dfinity/authentication": "^0.10.4",
"@dfinity/identity": "^0.10.4",
"@dfinity/identity-ledgerhq": "^0.10.4",
"@dfinity/principal": "^0.10.4",
"assert": "^2.0.0",
"buffer": "^6.0.3",
"events": "^3.2.0",
Expand All @@ -27,5 +27,5 @@
"test:coverage": "",
"test": ""
},
"version": "0.10.3"
"version": "0.10.4"
}
10 changes: 5 additions & 5 deletions demos/sample-javascript/package.json
Expand Up @@ -2,10 +2,10 @@
"name": "ic-agent-sample-javascript-app",
"private": true,
"dependencies": {
"@dfinity/agent": "^0.10.3",
"@dfinity/authentication": "^0.10.3",
"@dfinity/identity": "^0.10.3",
"@dfinity/principal": "^0.10.3",
"@dfinity/agent": "^0.10.4",
"@dfinity/authentication": "^0.10.4",
"@dfinity/identity": "^0.10.4",
"@dfinity/principal": "^0.10.4",
"assert": "^2.0.0",
"events": "^3.2.0",
"html-webpack-plugin": "^5.1.0",
Expand All @@ -24,5 +24,5 @@
"test:coverage": "",
"test": ""
},
"version": "0.10.3"
"version": "0.10.4"
}
30 changes: 22 additions & 8 deletions e2e/node/basic/counter.test.ts
Expand Up @@ -3,12 +3,26 @@
*/
import counterCanister from '../canisters/counter';

test('counter', async () => {
const { actor: counter } = await counterCanister();
expect(await counter.greet('counter')).toEqual('Hello, counter!');
expect(Number(await counter.read())).toEqual(0);
await counter.inc();
expect(Number(await counter.read())).toEqual(1);
await counter.inc();
expect(Number(await counter.read())).toEqual(2);
jest.setTimeout(30000);
describe('counter', () => {
it('should greet', async () => {
const { actor: counter } = await counterCanister();
try {
expect(await counter.greet('counter')).toEqual('Hello, counter!');
} catch (error) {
console.error(error);
}
});
it('should increment', async () => {
const { actor: counter } = await counterCanister();
try {
expect(Number(await counter.read())).toEqual(0);
await counter.inc();
expect(Number(await counter.read())).toEqual(1);
await counter.inc();
expect(Number(await counter.read())).toEqual(2);
} catch (error) {
console.error(error);
}
});
});

0 comments on commit 524e2bf

Please sign in to comment.