Skip to content

Commit

Permalink
Add hermit and update GH actions (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
phoebe-lew authored Mar 6, 2024
1 parent 82be6ae commit eba12e9
Show file tree
Hide file tree
Showing 28 changed files with 133 additions and 81 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/alpha-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,11 @@ jobs:
- name: Checkout source
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1

- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d #v3.0.0
# https://cashapp.github.io/hermit/usage/ci/
- name: Init Hermit
uses: cashapp/activate-hermit@v1
with:
version: 8

- name: Set up Node.js
uses: actions/setup-node@5ef044f9d09786428e6e895be6be17937becee3a #v4.0.0
with:
node-version: 18
registry-url: https://registry.npmjs.org/
cache: 'pnpm'
cache: "true"

# Note - this is not required but it gives a clean failure prior to attempting a release if
# the GH workflow runner is not authenticated with NPMjs.com
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,11 @@ jobs:
- name: Checkout source
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1

- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d #v3.0.0
# https://cashapp.github.io/hermit/usage/ci/
- name: Init Hermit
uses: cashapp/activate-hermit@v1
with:
version: 8

- name: Set up Node.js
uses: actions/setup-node@5ef044f9d09786428e6e895be6be17937becee3a #v4.0.0
with:
node-version: 18
registry-url: https://registry.npmjs.org/
cache: 'pnpm'
cache: "true"

- name: Install dependencies
run: pnpm install --frozen-lockfile
Expand Down
16 changes: 5 additions & 11 deletions .github/workflows/docs-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,14 @@ jobs:
- name: Checkout source
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1

- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d #v3.0.0
# https://cashapp.github.io/hermit/usage/ci/
- name: Init Hermit
uses: cashapp/activate-hermit@v1
with:
version: 8

- name: Set up Node.js
uses: actions/setup-node@5ef044f9d09786428e6e895be6be17937becee3a #v4.0.0
with:
node-version: 18
registry-url: https://registry.npmjs.org/
cache: 'pnpm'
cache: "true"

- name: Install dependencies
run: |
pnpm install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Build all workspace packages
run: pnpm --recursive --stream build
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/release-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,12 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1

- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d #v3.0.0
with:
version: 8

- name: Set up Node.js
uses: actions/setup-node@5ef044f9d09786428e6e895be6be17937becee3a #v4.0.0

# https://cashapp.github.io/hermit/usage/ci/
- name: Init Hermit
uses: cashapp/activate-hermit@v1
with:
node-version: 18
registry-url: https://registry.npmjs.org/
cache: 'pnpm'
cache: "true"

- name: Install semver utility
run: pnpm install -g [email protected]
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/tests-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,12 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
submodules: true

- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d #v3.0.0
with:
version: 8

- name: Set up Node.js
uses: actions/setup-node@5ef044f9d09786428e6e895be6be17937becee3a #v4.0.0
# https://cashapp.github.io/hermit/usage/ci/
- name: Init Hermit
uses: cashapp/activate-hermit@v1
with:
node-version: 18
registry-url: https://registry.npmjs.org/
cache: 'pnpm'
cache: "true"

- name: Install dependencies
run: pnpm install --frozen-lockfile
Expand Down
25 changes: 9 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,19 @@ Build and Test cycles are run on every commit to every branch using [GitHub Acti

## Development Prerequisites

| Requirement | Tested Version | Installation Instructions |
| ----------- | -------------- | ---------------------------------------------------------------------------------------------- |
| Node.js | 18.16.0 | [Introduction to Node.js](https://nodejs.dev/en/learn/) |
| PNPM | 8.15.3 | [PNPM Package Manager](https://pnpm.io/installation) |
### Hermit
This project uses hermit to manage tooling like node. See [this page](https://cashapp.github.io/hermit/usage/get-started/) to set up Hermit on your machine - make sure to download the open source build and activate it for the project.

### TypeScript

This project is written in TypeScript, a strongly typed programming language that builds on JavaScript.
Currently, we have these packages installed via Hermit (can also view by checking out `hermit status`):

You may verify your `node` and `pnpm` installation via the terminal:
| Requirement | Tested Version |
| ----------- | -------------- |
| Node.js | 20.9.0 |
| PNPM | 8.15.4 |

```
$ node --version
v18.16.0
$ pnpm --version
8.15.3
```
### TypeScript

If you do not have Node.js installed, we recommend following the
[Introduction to Node.js](https://nodejs.dev/en/learn/) guide.
This project is written in TypeScript, a strongly typed programming language that builds on JavaScript.

## Contribution

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ We recommend this config which will only checkout the files relevant to web5-js
git -C web5-spec sparse-checkout set test-vectors
```

### Hermit
This project uses hermit to manage tooling like node. See [this page](https://cashapp.github.io/hermit/usage/get-started/) to set up Hermit on your machine - make sure to download the open source build and activate it for the project.

Currently, we have these packages installed via Hermit (can also view by checking out `hermit status`):
- node
- pnpm

## Installation

_NPM_
Expand Down
1 change: 1 addition & 0 deletions bin/.node-20.9.0.pkg
1 change: 1 addition & 0 deletions bin/.pnpm-8.15.4.pkg
7 changes: 7 additions & 0 deletions bin/README.hermit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Hermit environment

This is a [Hermit](https://github.com/cashapp/hermit) bin directory.

The symlinks in this directory are managed by Hermit and will automatically
download and install Hermit itself as well as packages. These packages are
local to this environment.
21 changes: 21 additions & 0 deletions bin/activate-hermit
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# This file must be used with "source bin/activate-hermit" from bash or zsh.
# You cannot run it directly
#
# THIS FILE IS GENERATED; DO NOT MODIFY

if [ "${BASH_SOURCE-}" = "$0" ]; then
echo "You must source this script: \$ source $0" >&2
exit 33
fi

BIN_DIR="$(dirname "${BASH_SOURCE[0]:-${(%):-%x}}")"
if "${BIN_DIR}/hermit" noop > /dev/null; then
eval "$("${BIN_DIR}/hermit" activate "${BIN_DIR}/..")"

if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ]; then
hash -r 2>/dev/null
fi

echo "Hermit environment $("${HERMIT_ENV}"/bin/hermit env HERMIT_ENV) activated"
fi
1 change: 1 addition & 0 deletions bin/corepack
43 changes: 43 additions & 0 deletions bin/hermit
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
#
# THIS FILE IS GENERATED; DO NOT MODIFY

set -eo pipefail

export HERMIT_USER_HOME=~

if [ -z "${HERMIT_STATE_DIR}" ]; then
case "$(uname -s)" in
Darwin)
export HERMIT_STATE_DIR="${HERMIT_USER_HOME}/Library/Caches/hermit"
;;
Linux)
export HERMIT_STATE_DIR="${XDG_CACHE_HOME:-${HERMIT_USER_HOME}/.cache}/hermit"
;;
esac
fi

export HERMIT_DIST_URL="${HERMIT_DIST_URL:-https://github.com/cashapp/hermit/releases/download/stable}"
HERMIT_CHANNEL="$(basename "${HERMIT_DIST_URL}")"
export HERMIT_CHANNEL
export HERMIT_EXE=${HERMIT_EXE:-${HERMIT_STATE_DIR}/pkg/hermit@${HERMIT_CHANNEL}/hermit}

if [ ! -x "${HERMIT_EXE}" ]; then
echo "Bootstrapping ${HERMIT_EXE} from ${HERMIT_DIST_URL}" 1>&2
INSTALL_SCRIPT="$(mktemp)"
# This value must match that of the install script
INSTALL_SCRIPT_SHA256="180e997dd837f839a3072a5e2f558619b6d12555cd5452d3ab19d87720704e38"
if [ "${INSTALL_SCRIPT_SHA256}" = "BYPASS" ]; then
curl -fsSL "${HERMIT_DIST_URL}/install.sh" -o "${INSTALL_SCRIPT}"
else
# Install script is versioned by its sha256sum value
curl -fsSL "${HERMIT_DIST_URL}/install-${INSTALL_SCRIPT_SHA256}.sh" -o "${INSTALL_SCRIPT}"
# Verify install script's sha256sum
openssl dgst -sha256 "${INSTALL_SCRIPT}" | \
awk -v EXPECTED="$INSTALL_SCRIPT_SHA256" \
'$2!=EXPECTED {print "Install script sha256 " $2 " does not match " EXPECTED; exit 1}'
fi
/bin/bash "${INSTALL_SCRIPT}" 1>&2
fi

exec "${HERMIT_EXE}" --level=fatal exec "$0" -- "$@"
Empty file added bin/hermit.hcl
Empty file.
1 change: 1 addition & 0 deletions bin/node
1 change: 1 addition & 0 deletions bin/npm
1 change: 1 addition & 0 deletions bin/npx
1 change: 1 addition & 0 deletions bin/pnpm
2 changes: 1 addition & 1 deletion packages/agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"access": "public"
},
"engines": {
"node": ">=18.0.0"
"node": ">=20.9.0"
},
"dependencies": {
"@noble/hashes": "1.3.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"access": "public"
},
"engines": {
"node": ">=18.0.0"
"node": ">=20.9.0"
},
"dependencies": {
"@tbd54566975/dwn-sdk-js": "0.2.10",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"access": "public"
},
"engines": {
"node": ">=18.0.0"
"node": ">=20.9.0"
},
"dependencies": {
"@isaacs/ttlcache": "1.4.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/credentials/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"access": "public"
},
"engines": {
"node": ">=18.0.0"
"node": ">=20.9.0"
},
"dependencies": {
"@sphereon/pex": "2.1.0",
Expand Down Expand Up @@ -104,4 +104,4 @@
"sinon": "16.1.3",
"typescript": "5.1.6"
}
}
}
4 changes: 2 additions & 2 deletions packages/crypto-aws-kms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"access": "public"
},
"engines": {
"node": ">=18.0.0"
"node": ">=20.9.0"
},
"dependencies": {
"@aws-sdk/client-kms": "3.478.0",
Expand Down Expand Up @@ -98,4 +98,4 @@
"source-map-loader": "4.0.2",
"typescript": "5.1.6"
}
}
}
4 changes: 2 additions & 2 deletions packages/crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"access": "public"
},
"engines": {
"node": ">=18.0.0"
"node": ">=20.9.0"
},
"dependencies": {
"@noble/ciphers": "0.4.1",
Expand Down Expand Up @@ -105,4 +105,4 @@
"source-map-loader": "4.0.2",
"typescript": "5.1.6"
}
}
}
4 changes: 2 additions & 2 deletions packages/dids/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"access": "public"
},
"engines": {
"node": ">=18.0.0"
"node": ">=20.9.0"
},
"dependencies": {
"@decentralized-identity/ion-sdk": "1.0.1",
Expand Down Expand Up @@ -113,4 +113,4 @@
"source-map-loader": "4.0.2",
"typescript": "5.1.6"
}
}
}
4 changes: 2 additions & 2 deletions packages/identity-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"access": "public"
},
"engines": {
"node": ">=18.0.0"
"node": ">=20.9.0"
},
"dependencies": {
"@web5/agent": "0.2.6",
Expand Down Expand Up @@ -100,4 +100,4 @@
"sinon": "16.1.3",
"typescript": "5.1.6"
}
}
}
4 changes: 2 additions & 2 deletions packages/proxy-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"access": "public"
},
"engines": {
"node": ">=18.0.0"
"node": ">=20.9.0"
},
"dependencies": {
"@web5/agent": "0.2.6",
Expand Down Expand Up @@ -98,4 +98,4 @@
"rimraf": "4.4.0",
"typescript": "5.1.6"
}
}
}
4 changes: 2 additions & 2 deletions packages/user-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"access": "public"
},
"engines": {
"node": ">=18.0.0"
"node": ">=20.9.0"
},
"dependencies": {
"@web5/agent": "0.2.6",
Expand Down Expand Up @@ -98,4 +98,4 @@
"rimraf": "4.4.0",
"typescript": "5.1.6"
}
}
}

0 comments on commit eba12e9

Please sign in to comment.