Skip to content

Commit

Permalink
MIGRATION HOUSE KEEPING (#20)
Browse files Browse the repository at this point in the history
* remove old guide to releasing packages that has been superceeded by releasing.md

(cherry picked from commit 7f3bf5b)

* remove old info from readme and setup docs

(cherry picked from commit 57c6518)

* where appropriate replace celo-monorepo with developer-tooling

(cherry picked from commit db9699e)

* regenerate docs from new repo

---------

Co-authored-by: Aaron <[email protected]>
  • Loading branch information
aaronmgdr and aaronmgdr authored Dec 18, 2023
1 parent 0f63388 commit 800be36
Show file tree
Hide file tree
Showing 45 changed files with 202 additions and 322 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
- 'prerelease/**'

concurrency:
group: celo-monorepo-${{ github.ref }}
group: dev-tooling-${{ github.ref }}
cancel-in-progress: true

defaults:
Expand Down
64 changes: 5 additions & 59 deletions README-dev.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,15 @@
# README GUIDE FOR CELO DEVELOPERS

## How to run a local testnet

Often when developing, it is useful to create a test network localy using the full celo-blockchain binary to go beyond what can be done with other options such as [Ganache](https://www.trufflesuite.com/ganache)

The quickest way to get started with a local testnet is by running `yarn celotool local-testnet` from the `monorepo` root.

This command will create a local testnet with a single validator node and deploy all smart contract migrations to it.
Once the network is initialized a NodeJS REPL is provided to help interact with the running nodes.
For more options, consult `yarn celotool local-testnet --help`, which provides an overview of the tool and its options.

## Monorepo inter-package dependencies

Many packages depend on other packages within the monorepo. When this happens, follow these rules:

1. All packages must use **master version** of sibling packages.
2. Exception to (1) are packages that represent a GAE/firebase app which must use the last published version.
3. To differentiate published vs unpublished version. Master version (in package.json) must end with suffix `-dev` and should not be published.
4. If a developer wants to publish a version; then after publishing it needs to set master version to next `-dev` version and change all package.json that require on it.

To check which packages need amending, you can run (in the root pkg):

yarn check:packages

A practical example:

- In any given moment, `contractkit/package.json#version` field **must** of the form `x.y.z-dev`
- If current version of contractkit is: `0.1.6-dev` and we want to publish a new version, we should:
- publish version `0.1.6`
- change `package.json#version` to `0.1.7-dev`
- change in other packages within monorepo that were using `0.1.6-dev` to `0.1.7-dev`

## How to publish a new npm package

> Note: Packages with mainline versions (i.e. without a `-foo` suffix) should be published from the `master` branch.
> Note: All packages are prefixed with "@celo/" and only members of the [Celo NPM organization](https://www.npmjs.com/settings/celo/members) can publish new packages or update the existing ones.
### Update the version numbers to an unpublished version

It is important to ensure that the `master` branch is ahead of the published package on NPM, otherwise `yarn` may use the published version of the package rather than the local development version.

In order to maintain this, create and merge a PR to the `master` branch bumping the package version to the next number that will be published. (i.e. If you are about to publish `x.y.z`, set the package version to `x.y.z+1`)
Update all references to that package in the monorepo to the new version (i.e. `x.y.z+1`)
Prefer appending a `-dev` suffix to the version number to ensure an internal dependency will never be mistaken for a published one.

> Note: Publishing breaking changes requires an increment to the minor version number for `0.` releases. Once `1.0.0` is pusblished breaking changes are generally prohibited outside the rare major version release. Read the [semver specification](https://semver.org/) for more information.
> Note: Services deployed to App Engine must only depend on published NPM packages. These packages are `blockchain-api` and `notification-service`.
### Checkout the commit to be published and verify version numbers

Checkout the commit that will become the new published version (i.e. `git checkout HEAD~1` assuming that the commit for bumping the version number is `HEAD`)

Check the `package.json` file and remove the `-dev` suffix if present. Additionally remove the `-dev` suffix from any internal dependencies and use ensure they are published (e.g. `@celo/utils`)

### Verify installation in Docker

Test installation in isolation using Docker.
This confirms that it is locally installable and does not have implicit dependency on rest of the `celo-monorepo` or have an implicit dependency which is an explicit dependency of another `celo-monorepo` package.
This confirms that it is locally installable and does not have implicit dependency on rest of the `developer-tooling` or have an implicit dependency which is an explicit dependency of another `developer-tooling` package.

```
# Specify the package to test. e.g. celocli, contractkit, utils
celo-monorepo $ PACKAGE=cli
celo-monorepo $ docker run --rm -v $PWD/packages/${PACKAGE}:/tmp/npm_package -it --entrypoint bash gcr.io/celo-testnet/circleci-node18:1.0.0
developer-tooling $ PACKAGE=cli
developer-tooling $ docker run --rm -v $PWD/packages/${PACKAGE}:/tmp/npm_package -it --entrypoint bash gcr.io/celo-testnet/circleci-node18:1.0.0
circleci@e0d56700584f:/# mkdir /tmp/tmp1 && cd /tmp/tmp1
circleci@e0d56700584f:/tmp/tmp1# npm install /tmp/npm_package/
```
Expand All @@ -72,7 +18,7 @@ circleci@e0d56700584f:/tmp/tmp1# npm install /tmp/npm_package/

```
# Publish the package publicly
celo-monorepo/packages/cli $ yarn publish --access=public
developer-tooling/packages/cli $ yarn publish --access=public
```

Let's say the published package version number 0.0.20, verify that it is installable
Expand All @@ -97,7 +43,7 @@ Once you publish do some manual tests, for example, after publishing `celocli`

```
# Docker for an isolated environment again
celo-monorepo $ docker run --rm -it --entrypoint bash gcr.io/celo-testnet/circleci-node18:1.0.0
developer-tooling $ docker run --rm -it --entrypoint bash gcr.io/celo-testnet/circleci-node18:1.0.0
circleci@7040a7660754:/$ mkdir /tmp/tmp1 && cd /tmp/tmp1
circleci@7040a7660754:/tmp/tmp1$ npm install @celo/[email protected]
...
Expand Down
88 changes: 11 additions & 77 deletions SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,33 @@
- [Reading](#reading)
- [Getting everything installed](#getting-everything-installed)
- [Common stuff](#common-stuff)
- [Install Go](#install-go)
- [Install Node](#install-node)
- [MacOS](#macos)
- [Xcode CLI](#xcode-CLI)
- [Homebrew](#homebrew)
- [Xcode CLI](#xcode-cli)
- [Install Yarn](#install-yarn)
- [Linux](#linux)
- [Install Yarn](#install-yarn-1)
- [Optional](#optional)
- [Install Rust](#install-rust)
- [Building celo-monorepo](#building-celo-monorepo)
- [Running the mobile wallet](#running-the-mobile-wallet)
- [Building developer-tooling](#building-developer-tooling)

This is a living document! Please edit and update it as part of your onboarding process :-)

## Reading

Review the README from each directory in [packages](packages/). The [protocol](packages/protocol) is a good starting point.
Review the README from each directory in [packages](packages/).

## Getting everything installed

Follow these steps to get everything that you need installed to build the celo-monorepo codebase on your computer.
Follow these steps to get everything that you need installed to build the developer-tooling codebase on your computer.

### Common stuff

#### Install Go

We need Go for [celo-blockchain](https://github.com/celo-org/celo-blockchain), the Go Celo implementation, and `gobind` to build Java language bindings to Go code for the Android Geth client.

For go installation instructions see [celo-blockchain instructions](https://github.com/celo-org/celo-blockchain#building-the-source).

Once you have go installed run the following to install gobind

`go get golang.org/x/mobile/cmd/gobind`


#### Install Node

Currently Node.js v18.14.2 is required in order to work with this repo.

Install `nvm` (allows you to manage multiple versions of Node) by following the [instructions here](https://github.com/nvm-sh/nvm).

Once `nvm` is successfully installed, restart the terminal and run the following commands to install the `npm` versions that [celo-monorepo](https://github.com/celo-org/celo-monorepo) will need:
Once `nvm` is successfully installed, restart the terminal and run the following commands to install the `npm` versions that [developer-tooling](https://github.com/celo-org/developer-tooling) will need:

```bash
# restart the terminal after installing nvm
Expand All @@ -64,17 +48,9 @@ Install the Xcode command line tools:
xcode-select --install
```

#### Homebrew

Install [Homebrew](https://brew.sh/), the best way of managing packages on OSX:

```bash
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```

#### Install Yarn

We use Yarn to build all of the [celo-monorepo] repo. Install it using [Homebrew](#homebrew):
We use Yarn to build all of the [developer-tooling] repo. Install it using [Homebrew](#homebrew):

```bash
brew install yarn
Expand All @@ -84,7 +60,7 @@ brew install yarn

#### Install Yarn

We use Yarn to build all of the [celo-monorepo](https://github.com/celo-org/celo-monorepo) repo. Install it by running the following:
We use Yarn to build all of the [developer-tooling](https://github.com/celo-org/developer-tooling) repo. Install it by running the following:

```bash
# for documentation on yarn visit https://yarnpkg.com/en/docs/install#debian-stable
Expand All @@ -93,63 +69,21 @@ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/source
sudo apt-get update && sudo apt-get install yarn
```

### Optional

#### Install Rust

We use Rust for some [cryptography repositories](https://github.com/celo-org?q=&type=&language=rust) This is not
required if you only want use the blockchain, monorepo, and mobile wallet.

```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

Now lets add Rust to the `PATH`:

```
echo "export PATH=$PATH:~/.cargo/bin/" >> ~/.bashrc
source ~/.bashrc
```

With Rust binaries in your PATH you should be able to run:

```bash
rustup install 1.42.0
rustup default 1.42.0
```

If you're building Geth for Android, you need a NDK that has a cross-compilation toolchain. We need version 19.

On Mac (darwin):

```bash
brew cask install https://raw.githubusercontent.com/Homebrew/homebrew-cask/a39a95824122da8448dbeb0b0ca1dde78e5a793c/Casks/android-ndk.rb

export ANDROID_NDK=/usr/local/share/android-ndk
```

In `celo-blockchain`, define the relevant environment variables, e.g.:

```bash
export NDK_VERSION=android-ndk-r19c
```

and run `make ndk_bundle`. This will download the NDK for your platform.

## Building celo-monorepo
## Building

Clone the [celo-monorepo](https://github.com/celo-org/celo-monorepo) repo:
Clone the [developer-tooling](https://github.com/celo-org/developer-tooling) repo:

```bash
mkdir ~/celo
cd celo
git clone https://github.com/celo-org/celo-monorepo.git
git clone https://github.com/celo-org/developer-tooling.git
```

Then install the packages:

```bash
cd celo-monorepo
cd developer-tooling
# install dependencies and run post-install script
yarn
# build all packages
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/README.md

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

8 changes: 4 additions & 4 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"version": "3.1.3",
"author": "Celo",
"license": "Apache-2.0",
"repository": "celo-org/celo-monorepo",
"homepage": "https://github.com/celo-org/celo-monorepo",
"bugs": "https://github.com/celo-org/celo-monorepo/issues?utf8=%E2%9C%93&q=label%3Acli+",
"repository": "celo-org/developer-tooling",
"homepage": "https://github.com/celo-org/developer-tooling",
"bugs": "https://github.com/celo-org/developer-tooling/issues?utf8=%E2%9C%93&q=label%3Acli+",
"types": "lib/index.d.ts",
"main": "lib/index.js",
"bin": {
Expand Down Expand Up @@ -165,7 +165,7 @@
"timeoutInDays": 1,
"message": "<%= config.name %> update available from <%= chalk.greenBright(config.version) %> to <%= chalk.greenBright(latest) %>."
},
"repositoryPrefix": "https://github.com/celo-org/celo-monorepo/tree/master/packages/cli/<%- commandPath %>",
"repositoryPrefix": "https://github.com/celo-org/developer-tooling/tree/master/packages/cli/<%- commandPath %>",
"hooks": {
"prerun": "./lib/hooks/prerun/plugin-warning"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Docs

Most of the docs package in the [celo-monorepo](https://github.com/celo-org/celo-monorepo) has been moved to its own [Celo documentation repo](https://github.com/celo-org/docs).
Most of the docs package in the [developer-tooling](https://github.com/celo-org/developer-tooling) has been moved to its own [Celo documentation repo](https://github.com/celo-org/docs).

## Celo CLI docs

Expand Down
Loading

0 comments on commit 800be36

Please sign in to comment.