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

chore: Removes Apps and Demos #329

Merged
merged 12 commits into from
Apr 7, 2021
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
206 changes: 104 additions & 102 deletions .github/workflows/nodejs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,109 +9,111 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-18.04]
ghc: ['8.8.4']
ghc: ["8.8.4"]
spec:
- release-0.15 # https://github.com/dfinity-lab/ic-ref/tree/release-0.15
- release-0.15 # https://github.com/dfinity-lab/ic-ref/tree/release-0.15
node:
- 12
- 14
- 12
- 14
krpeacock marked this conversation as resolved.
Show resolved Hide resolved

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

- run: npx lerna bootstrap --ci
- run: npx lerna run lint

# build monorepo incl. each subpackage
- run: npx lerna run build

# test monorepo incl. each subpackage
- run: npx lerna run test
env:
CI: true

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

# IC ref checkout and build.
- uses: actions/checkout@v2
with:
repository: 'dfinity-lab/ic-ref'
# Personal Read-only Access Token created by hans.larsen@dfinity.org
token: ${{ secrets.IC_REF_TOKEN }}
path: ic-ref
ref: ${{ matrix.spec }}

- name: Cache ~/.cabal/store
uses: actions/cache@v2
with:
path: |
~/.cabal/store
key: cabal-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('ic-ref/impl/cabal.project', 'ic-ref/impl/cabal.project.freeze') }}
restore-keys: cabal-${{ runner.os }}-${{ matrix.ghc }}-

- uses: actions/setup-haskell@v1.1.3
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: '3.2'

- name: Cargo cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build ic-ref
run: |
ls -l /opt/ghc/
export PATH=/opt/ghc/bin:$PATH
cabal --version
ghc-${{ matrix.ghc }} --version
mkdir -p $HOME/bin
cd ic-ref/impl
cabal update
cabal install -w ghc-${{ matrix.ghc }} --overwrite-policy=always --installdir=$HOME/bin

- name: Running ic-ref
id: ic_ref
run: |
set -ex
$HOME/bin/ic-ref --pick-port --write-port-to $HOME/ic_ref_port &
sleep 1
echo "::set-output name=IC_REF_PORT::$(cat $HOME/ic_ref_port)"

- name: Running mitmdump
id: mitmdump
run: |
set -ex
mitmdump -p 8888 --mode reverse:http://localhost:${{ steps.ic_ref.outputs.IC_REF_PORT }} \
--modify-body '/~s/Hello/Hullo' \
--modify-headers '/~s/Transfer-Encoding/' \
&
sleep 1

- run: npx lerna run e2e
env:
CI: true
IC_REF_PORT: ${{ steps.ic_ref.outputs.IC_REF_PORT }}

- name: mitm e2e
env:
CI: true
IC_REF_PORT: 8888
MITM: true
run: npx lerna run mitm

- name: clean up
run: |
killall mitmdump
killall ic-ref
- 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

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

# test monorepo incl. each subpackage
- run: npm run test
env:
CI: true

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

# IC ref checkout and build.
- uses: actions/checkout@v2
with:
repository: "dfinity-lab/ic-ref"
# Personal Read-only Access Token created by hans.larsen@dfinity.org
token: ${{ secrets.IC_REF_TOKEN }}
path: ic-ref
ref: ${{ matrix.spec }}

- name: Cache ~/.cabal/store
uses: actions/cache@v2
with:
path: |
~/.cabal/store
key: cabal-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('ic-ref/impl/cabal.project', 'ic-ref/impl/cabal.project.freeze') }}
restore-keys: cabal-${{ runner.os }}-${{ matrix.ghc }}-

- uses: actions/setup-haskell@v1.1.3
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: "3.2"

- name: Cargo cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build ic-ref
run: |
ls -l /opt/ghc/
export PATH=/opt/ghc/bin:$PATH
cabal --version
ghc-${{ matrix.ghc }} --version
mkdir -p $HOME/bin
cd ic-ref/impl
cabal update
cabal install -w ghc-${{ matrix.ghc }} --overwrite-policy=always --installdir=$HOME/bin

- name: Running ic-ref
id: ic_ref
run: |
set -ex
$HOME/bin/ic-ref --pick-port --write-port-to $HOME/ic_ref_port &
sleep 1
echo "::set-output name=IC_REF_PORT::$(cat $HOME/ic_ref_port)"

- name: Running mitmdump
id: mitmdump
run: |
set -ex
mitmdump -p 8888 --mode reverse:http://localhost:${{ steps.ic_ref.outputs.IC_REF_PORT }} \
--modify-body '/~s/Hello/Hullo' \
--modify-headers '/~s/Transfer-Encoding/' \
&
sleep 1

- run: npm run e2e
env:
CI: true
IC_REF_PORT: ${{ steps.ic_ref.outputs.IC_REF_PORT }}

- name: mitm e2e
env:
CI: true
IC_REF_PORT: 8888
MITM: true
run: npm run mitm

- name: clean up
run: |
killall mitmdump
killall ic-ref
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: ${{ inputs.canary }}
run: npx lerna publish --canary --yes
run: npm run publish --canary --yes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: ${{ ! inputs.canary }}
run: npx lerna publish --yes
run: npm run publish --yes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40 changes: 12 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,62 +9,46 @@ This source code repository contains multiple npm packages, each under `./packag
### Getting Started

1. Clone the git repository.
2. Run `npx lerna bootstrap`
2. Run `npm install`

After that, you probably want to dive into a specific package in [./packages](./packages).

#### Lerna
#### Workspaces

We use [lerna](https://github.com/lerna/lerna) to manage this repo and its packages. A few useful
We use `npm` to manage this repo and its packages. A few useful
commands to keep in mind;

- To run the unit tests locally, you can use `npx lerna run test`.
- To run e2e tests, you can use `npx lerna run e2e`. **WARNING:** You need to have a running
- To run the unit tests locally, you can use `npm run test`.
- To run e2e tests, you can use `npm run e2e`. **WARNING:** You need to have a running
replica locally. In our CI runs, we use the `ic-ref` which is not (at this time) available
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.
- To run the entire ci, use `npx lerna run ci`. This will validate syntax and linting, as well
- To run the entire ci, use `npm run ci`. This will validate syntax and linting, as well
as running tests (both unit and e2e).

You can also install lerna globally and not use `npx` if you wish; run `npm install -g lerna` then
skip the `npx` part of the example commands.

### Publishing

To publish to NPM, create a branch and run the following commands;

- `lerna bootstrap`. Makes sure everything is installed and up to date locally;
- `lerna run build`. Builds all the applications and packages.
- `lerna run test`. Just in case.
- `lerna publish VERSION_NUMBER --dist-tag DIST_TAG`. The `VERSION_NUMBER` should be set to
- `npm install`. Makes sure everything is installed and up to date locally;
- `npm run build --workspaces`. Builds all the applications and packages.
- `npm run test`. Just in case.
- `lerna version VERSION_NUMBER`. The `VERSION_NUMBER` should be set to
the version to be published (e.g. `0.6.30`). The `DIST_TAG` argument can be ignored

This will change your code locally, so create a `chore: release VERSION_NUMBER` commit and
push. Once the PR is created get someone to review it.

### Publishing Cloudflare Workers

Until Cloudflare is no longer needed, we need to publish both workers from their directories;

- Start from a fresh clone (or `git clean -dfx .`)
- `lerna bootstrap`
- `lerna run build`
- `cd workers/auth.ic0.app` for the Authentication
- `npm ci` to make sure the proper packages are installed.
- `npx wrangler login` to login. YOU NEED AN API TOKEN FOR THIS.
- `npm run build`
- `npx wrangler publish`

Repeat steps for `workers/ic0.app`.
Then, when you have merged and pulled down the committed tag, run `npm run publish --workspaces` to publish all packages.

### Publishing Docs

Until we have an internal process and centrally owned canister, docs can be released manually for `@dfinity/agent` and `@dfinity/authentication`.

- Start from a fresh clone (or `git clean -dfx .`)
- `lerna bootstrap`
- `npm install`
- `npm run make:docs/reference`
- `dfx deploy`

Expand Down
18 changes: 0 additions & 18 deletions apps/bootstrap/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions apps/bootstrap/.npmignore

This file was deleted.

11 changes: 0 additions & 11 deletions apps/bootstrap/.prettierrc

This file was deleted.

Loading