Skip to content
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
127 changes: 84 additions & 43 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ defaults:
shell: bash

env:
ACTIONS_RUNNER_DEBUG: true
NPM_CONFIG_PROVENANCE: true
NPM_REGISTRY_URL: "https://registry.npmjs.org"

Expand All @@ -32,22 +31,72 @@ jobs:
contents: read
actions: read
id-token: write
name: ${{ matrix.os }}-${{ matrix.arch }}
name: ${{ matrix.tool }}-${{ matrix.os }}-${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
max-parallel: 3
fail-fast: false
matrix:
include:
- os: linux
- tool: forge
os: linux
arch: amd64
- os: linux
- tool: forge
os: linux
arch: arm64
- os: darwin
- tool: forge
os: darwin
arch: amd64
- os: darwin
- tool: forge
os: darwin
arch: arm64
- os: win32
- tool: forge
os: win32
arch: amd64
- tool: cast
os: linux
arch: amd64
- tool: cast
os: linux
arch: arm64
- tool: cast
os: darwin
arch: amd64
- tool: cast
os: darwin
arch: arm64
- tool: cast
os: win32
arch: amd64
- tool: anvil
os: linux
arch: amd64
- tool: anvil
os: linux
arch: arm64
- tool: anvil
os: darwin
arch: amd64
- tool: anvil
os: darwin
arch: arm64
- tool: anvil
os: win32
arch: amd64
- tool: chisel
os: linux
arch: amd64
- tool: chisel
os: linux
arch: arm64
- tool: chisel
os: darwin
arch: amd64
- tool: chisel
os: darwin
arch: arm64
- tool: chisel
os: win32
arch: amd64
# Run automatically after a successful 'release' workflow, or manually if a run_id is provided
if: >-
Expand Down Expand Up @@ -98,14 +147,6 @@ jobs:
node-version: "24"
registry-url: "https://registry.npmjs.org"

- name: Install Dependencies
working-directory: ./npm
run: bun install --frozen-lockfile

- name: Transpile TS -> JS
working-directory: ./npm
run: bun run build

- name: Derive RELEASE_VERSION
id: release-version
working-directory: ./npm
Expand Down Expand Up @@ -142,33 +183,26 @@ jobs:
ARTIFACT_DIR: ${{ steps.paths.outputs.artifact_dir }}
run: |
set -euo pipefail
mkdir -p "$ARTIFACT_DIR/tmp"

FILE_PREFIX="$ARTIFACT_DIR/foundry_${RELEASE_VERSION}_${{ matrix.os }}_${{ matrix.arch }}"
if [[ -f "${FILE_PREFIX}.zip" ]]; then
echo "Extracting ${FILE_PREFIX}.zip"
if ! command -v unzip >/dev/null 2>&1; then
sudo apt-get update -y && sudo apt-get install -y unzip
fi
unzip -o "${FILE_PREFIX}.zip" -d "$ARTIFACT_DIR/tmp"
BIN="$ARTIFACT_DIR/tmp/forge.exe"
else
echo "Extracting ${FILE_PREFIX}.tar.gz"
tar -xzf "${FILE_PREFIX}.tar.gz" -C "$ARTIFACT_DIR/tmp"
BIN="$ARTIFACT_DIR/tmp/forge"
fi

echo "Staging binary $BIN into @foundry-rs/forge-${{ matrix.os }}-${{ matrix.arch }}"
PLATFORM_NAME=${{ matrix.os }} ARCH=${{ matrix.arch }} FORGE_BIN_PATH="$BIN" bun ./scripts/prepublish.ts
bun ./scripts/stage-from-artifact.mjs \
--tool '${{ matrix.tool }}' \
--platform '${{ matrix.os }}' \
--arch '${{ matrix.arch }}' \
--release-version "$RELEASE_VERSION" \
--artifact-dir "$ARTIFACT_DIR"

- name: Sanity Check Binary
working-directory: ./npm
run: |
set -euo pipefail
PKG_DIR="./@foundry-rs/forge-${{ matrix.os }}-${{ matrix.arch }}"
BIN="$PKG_DIR/bin/forge"
if [[ "${{ matrix.os }}" == "win32" ]]; then
BIN="$PKG_DIR/bin/forge.exe"
TOOL='${{ matrix.tool }}'
PLATFORM='${{ matrix.os }}'
ARCH='${{ matrix.arch }}'

PKG_DIR="./@foundry-rs/${TOOL}-${PLATFORM}-${ARCH}"
BIN="$PKG_DIR/bin/${TOOL}"
if [[ "$PLATFORM" == "win32" ]]; then
BIN="$PKG_DIR/bin/${TOOL}.exe"
fi
echo "Verifying binary at: $BIN"
ls -la "$BIN"
Expand All @@ -195,11 +229,16 @@ jobs:
run: |
set -euo pipefail

ls -la ./@foundry-rs/forge-${{ matrix.os }}-${{ matrix.arch }}
TOOL='${{ matrix.tool }}'
PLATFORM='${{ matrix.os }}'
ARCH='${{ matrix.arch }}'

bun ./scripts/publish.ts ./@foundry-rs/forge-${{ matrix.os }}-${{ matrix.arch }}
PACKAGE_DIR="./@foundry-rs/${TOOL}-${PLATFORM}-${ARCH}"
ls -la "$PACKAGE_DIR"

echo "Published @foundry-rs/forge-${{ matrix.os }}-${{ matrix.arch }}"
bun ./scripts/publish.mjs "$PACKAGE_DIR"

echo "Published @foundry-rs/${TOOL}-${PLATFORM}-${ARCH}"

publish-meta:
permissions:
Expand Down Expand Up @@ -234,13 +273,15 @@ jobs:
working-directory: ./npm
run: bun install --frozen-lockfile

- name: Transpile TS -> JS
- name: Typecheck
working-directory: ./npm
run: bun run build
run: bun tsc --project tsconfig.json --noEmit

- name: Publish Meta
- name: Publish Meta Packages
working-directory: ./npm
run: bun run ./scripts/publish.ts ./@foundry-rs/forge
run: |
set -euo pipefail
bun ./scripts/publish-meta.mjs --release-version "$RELEASE_VERSION"
env:
PROVENANCE: true
VERSION_NAME: ${{ env.RELEASE_VERSION }}
Expand Down
8 changes: 4 additions & 4 deletions dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"indentWidth": 2,
"useTabs": false,
"excludes": [
"!dprint.json",
"!npm/**/*.{json,md,toml}",
"!npm/**/*.{js,cjs,mjs,d.ts,d.cts,d.mts,ts,tsx,jsx}",
"**/_",
"dprint.json",
"**/abi",
"**/build",
"**/target",
Expand All @@ -25,8 +25,8 @@
],
"plugins": [
"https://plugins.dprint.dev/toml-0.7.0.wasm",
"https://plugins.dprint.dev/json-0.20.0.wasm",
"https://plugins.dprint.dev/markdown-0.19.0.wasm",
"https://plugins.dprint.dev/json-0.21.0.wasm",
"https://plugins.dprint.dev/markdown-0.20.0.wasm",
"https://plugins.dprint.dev/dockerfile-0.3.3.wasm",
"https://plugins.dprint.dev/typescript-0.95.11.wasm",
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.1.wasm"
Expand Down Expand Up @@ -57,4 +57,4 @@
"exportDeclaration.sortTypeOnlyExports": "none",
"importDeclaration.sortTypeOnlyImports": "none"
}
}
}
5 changes: 4 additions & 1 deletion npm/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
.DS_Store

forge/*/bin/forge
anvil/*/bin/anvil
cast/*/bin/cast
chisel/*/bin/chisel
@foundry-rs/*/bin/
test/workspace/bun.lock
_
4 changes: 4 additions & 0 deletions npm/@foundry-rs/anvil/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Anvil

Anvil is a fast local Ethereum development node.
The anvil binary can be used both within and outside of a Foundry project.
34 changes: 34 additions & 0 deletions npm/@foundry-rs/anvil/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "@foundry-rs/anvil",
"version": "0.0.0",
"type": "module",
"homepage": "https://getfoundry.sh/anvil",
"description": "Anvil is a fast local Ethereum development node",
"bin": {
"anvil": "./bin.mjs"
},
"files": [
"bin",
"dist"
],
"scripts": {
"postinstall": "TARGET_TOOL=anvil node ./dist/postinstall.mjs"
},
"optionalDependencies": {
"@foundry-rs/anvil-darwin-arm64": "0.0.0",
"@foundry-rs/anvil-darwin-amd64": "0.0.0",
"@foundry-rs/anvil-linux-arm64": "0.0.0",
"@foundry-rs/anvil-linux-amd64": "0.0.0",
"@foundry-rs/anvil-win32-amd64": "0.0.0"
},
"publishConfig": {
"access": "public",
"provenance": true,
"registry": "https://registry.npmjs.org"
},
"license": "MIT OR Apache-2.0",
"repository": {
"directory": "npm",
"url": "https://github.com/foundry-rs/foundry"
}
}
5 changes: 5 additions & 0 deletions npm/@foundry-rs/cast/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Cast

Cast is a Swiss Army knife for interacting with Ethereum applications from the command line.
You can make smart contract calls, send transactions, or retrieve any type of chain data - all from your command-line!
The cast binary can be used both within and outside of a Foundry project.
34 changes: 34 additions & 0 deletions npm/@foundry-rs/cast/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "@foundry-rs/cast",
"version": "0.0.0",
"type": "module",
"homepage": "https://getfoundry.sh/cast",
"description": "Swiss Army knife for interacting with Ethereum applications from the command line",
"bin": {
"cast": "./bin.mjs"
},
"files": [
"bin",
"dist"
],
"scripts": {
"postinstall": "TARGET_TOOL=cast node ./dist/postinstall.mjs"
},
"optionalDependencies": {
"@foundry-rs/cast-darwin-arm64": "0.0.0",
"@foundry-rs/cast-darwin-amd64": "0.0.0",
"@foundry-rs/cast-linux-arm64": "0.0.0",
"@foundry-rs/cast-linux-amd64": "0.0.0",
"@foundry-rs/cast-win32-amd64": "0.0.0"
},
"publishConfig": {
"access": "public",
"provenance": true,
"registry": "https://registry.npmjs.org"
},
"license": "MIT OR Apache-2.0",
"repository": {
"directory": "npm",
"url": "https://github.com/foundry-rs/foundry"
}
}
4 changes: 4 additions & 0 deletions npm/@foundry-rs/chisel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Chisel

Chisel is a fast, utilitarian, and verbose Solidity REPL.
The chisel binary can be used both within and outside of a Foundry project.
34 changes: 34 additions & 0 deletions npm/@foundry-rs/chisel/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "@foundry-rs/chisel",
"version": "0.0.0",
"type": "module",
"homepage": "https://getfoundry.sh/chisel",
"description": "Chisel is a fast, utilitarian, and verbose Solidity REPL",
"bin": {
"chisel": "./bin.mjs"
},
"files": [
"bin",
"dist"
],
"scripts": {
"postinstall": "TARGET_TOOL=chisel node ./dist/postinstall.mjs"
},
"optionalDependencies": {
"@foundry-rs/chisel-darwin-arm64": "0.0.0",
"@foundry-rs/chisel-darwin-amd64": "0.0.0",
"@foundry-rs/chisel-linux-arm64": "0.0.0",
"@foundry-rs/chisel-linux-amd64": "0.0.0",
"@foundry-rs/chisel-win32-amd64": "0.0.0"
},
"publishConfig": {
"access": "public",
"provenance": true,
"registry": "https://registry.npmjs.org"
},
"license": "MIT OR Apache-2.0",
"repository": {
"directory": "npm",
"url": "https://github.com/foundry-rs/foundry"
}
}
4 changes: 0 additions & 4 deletions npm/@foundry-rs/forge-darwin-amd64/README.md

This file was deleted.

38 changes: 0 additions & 38 deletions npm/@foundry-rs/forge-darwin-amd64/package.json

This file was deleted.

Loading
Loading