Skip to content

feat: publish forge to npm for each arch #10825

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

Closed
wants to merge 8 commits into from
Closed
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
crates/cheatcodes/assets/*.json linguist-generated
testdata/cheats/Vm.sol linguist-generated
bun.lock linguist-generated

# See <https://git-scm.com/docs/gitattributes#_defining_a_custom_hunk_header>
*.rs diff=rust
crates/lint/testdata/* text eol=lf

.env.example linguist-generated=Dotenv
dprint.json linguist-language=JSON-with-Comments
.devcontainer/devcontainer.json linguist-language=JSON-with-Comments
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ env:
IS_NIGHTLY: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
PROFILE: maxperf
STABLE_VERSION: "v1.1.0"
ACTIONS_RUNNER_DEBUG: true

jobs:
prepare:
Expand Down Expand Up @@ -149,6 +150,7 @@ jobs:
cargo install cross

- name: Build binaries
id: binaries
env:
TAG_NAME: ${{ (env.IS_NIGHTLY == 'true' && 'nightly') || needs.prepare.outputs.tag_name }}
SVM_TARGET_PLATFORM: ${{ matrix.svm_target_platform }}
Expand Down Expand Up @@ -185,6 +187,8 @@ jobs:
echo "${name}_bin_path=${bin}" >> $GITHUB_ENV
done

echo "FORGE_BIN_PATH='${OUT_DIR}/forge${ext}'" >> "$GITHUB_OUTPUT"

- name: Archive binaries
id: artifacts
env:
Expand Down Expand Up @@ -264,6 +268,59 @@ jobs:
${{ steps.artifacts.outputs.file_name }}
${{ steps.man.outputs.foundry_man }}

- name: Setup Bun (npm)
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
bun-version: "latest"
scope: "@foundry-rs"
registry-url: "https://registry.npmjs.org"

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

# bump version of each item in `optionalDependencies`
- name: Publish @foundry-rs/forge (npm)
shell: bash
working-directory: ./npm
env:
ARCH: ${{ matrix.arch }}
PLATFORM: ${{ matrix.platform }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
BUMP_VERSION: "TODO: Find this"
run: |-
cd @foundr-rs/forge

export NPM_TOKEN=${{ secrets.NPM_TOKEN }}

npm version ${{ env.BUMP_VERSION }} \
--message 'new forge release' \
--git-tag-version=false \
--workspace-update=false \
--sign-git-tag=false \
--git-tag-version=false \
--commit-hook=false \
--allow-same-version
bun pm pack
bun publish \
--access='public' \
--production \
--verbose \
--registry='https://registry.npmjs.org' \
./foundry-rs-forge-${{ env.BUMP_VERSION }}.tgz

- name: Publish Package (npm)
shell: bash
working-directory: ./npm
env:
ARCH: ${{ matrix.arch }}
PLATFORM: ${{ matrix.platform }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |-
bun run ./scripts/publis.ts ./@foundry-rs/forge-${{ env.PLATFORM }}-${{ env.ARCH }}

cleanup:
name: Release cleanup
runs-on: ubuntu-latest
Expand Down
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ out.json
.claude
CLAUDE.md
.env
node_modules

# npm
dist
bin
npm/bin
node_modules
package-lock.json

_
26 changes: 12 additions & 14 deletions dprint.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
{
"$schema": "https://raw.githubusercontent.com/dprint/dprint/refs/heads/main/website/src/assets/schemas/v0.json",
"incremental": true,
"indentWidth": 2,
"useTabs": false,
"includes": [
"*.md",
"*.{toml}",
"Dockerfile",
"*.{yml,yaml}",
"*.{json,jsonc}",
"*.{js,cjs,mjs,d.ts,d.cts,d.mts,ts,tsx,jsx}"
],
"excludes": [
"!npm/**/*.{json,md,toml}",
"!npm/**/*.{js,cjs,mjs,d.ts,d.cts,d.mts,ts,tsx,jsx}",
"**/_",
"dprint.json",
"**/abi",
"**/build",
"**/abi/**",
"**/target",
"**/test/**",
"**/*.min.*",
"**/dist/**",
"testdata/**",
"**/tests/**",
"node_modules",
"changelog.json",
"**/test-data/**",
"**/node_modules",
"**/cheatcodes/**",
"**/node_modules/**",
".github/scripts/**",
".github/ISSUE_TEMPLATE/**"
],
Expand All @@ -40,13 +36,15 @@
"textWrap": "maintain"
},
"toml": {
"columnWidth": 100
"lineWidth": 100
},
"json": {
"useTabs": false,
"lineWidth": 1,
"indentWidth": 2,
"useTabs": false,
"trailingCommas": "never",
"array.preferSingleLine": true
"preferSingleLine": false,
"array.preferSingleLine": false
},
"typescript": {
"useTabs": false,
Expand Down
9 changes: 9 additions & 0 deletions npm/.env.example

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

37 changes: 37 additions & 0 deletions npm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# dependencies (bun install)
node_modules

# output
out
dist
*.tgz

# code coverage
coverage
*.lcov

# logs
logs
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# caches
.eslintcache
.cache
*.tsbuildinfo

# IntelliJ based IDEs
.idea

# Finder (MacOS) folder config
.DS_Store

forge/*/bin/forge
@foundry-rs/*/bin/
4 changes: 4 additions & 0 deletions npm/@foundry-rs/forge-darwin-arm64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# forge

This is the macOS ARM 64-bit binary for `forge`, a CLI tool for testing, building, and deploying your smart contracts.
See <https://getfoundry.sh/forge/overview> for details.
35 changes: 35 additions & 0 deletions npm/@foundry-rs/forge-darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@foundry-rs/forge-darwin-arm64",
"version": "0.0.5",
"type": "module",
"homepage": "https://getfoundry.sh",
"description": "Fast and flexible Ethereum testing framework (macOS arm64)",
"bin": {
"forge": "./bin/forge"
},
"os": [
"darwin"
],
"cpu": [
"arm64"
],
"files": [
"bin"
],
"engines": {
"node": ">=20"
},
"license": "MIT OR Apache-2.0",
"repository": {
"directory": "npm",
"url": "https://github.com/foundry-rs/foundry"
},
"keywords": [
"foundry",
"testing",
"ethereum",
"solidity",
"blockchain",
"smart-contracts"
]
}
4 changes: 4 additions & 0 deletions npm/@foundry-rs/forge-darwin-x64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# forge

This is the macOS 64-bit binary for `forge`, a CLI tool for testing, building, and deploying your smart contracts.
See <https://getfoundry.sh/forge/overview> for details.
35 changes: 35 additions & 0 deletions npm/@foundry-rs/forge-darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@foundry-rs/forge-darwin-x64",
"version": "1.2.3",
"type": "module",
"homepage": "https://getfoundry.sh",
"description": "Fast and flexible Ethereum testing framework (macOS x64)",
"bin": {
"forge": "./bin/forge"
},
"os": [
"darwin"
],
"cpu": [
"x64"
],
"files": [
"bin"
],
"engines": {
"node": ">=20"
},
"license": "MIT OR Apache-2.0",
"repository": {
"directory": "npm",
"url": "https://github.com/foundry-rs/foundry"
},
"keywords": [
"foundry",
"testing",
"ethereum",
"solidity",
"blockchain",
"smart-contracts"
]
}
4 changes: 4 additions & 0 deletions npm/@foundry-rs/forge-linux-arm64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# forge

This is the Linux ARM 64-bit binary for `forge`, a CLI tool for testing, building, and deploying your smart contracts.
See <https://getfoundry.sh/forge/overview> for details.
35 changes: 35 additions & 0 deletions npm/@foundry-rs/forge-linux-arm64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@foundry-rs/forge-linux-arm64",
"version": "1.2.3",
"type": "module",
"homepage": "https://getfoundry.sh",
"description": "Fast and flexible Ethereum testing framework (Linux arm64)",
"bin": {
"forge": "./bin/forge"
},
"os": [
"linux"
],
"cpu": [
"arm64"
],
"files": [
"bin"
],
"engines": {
"node": ">=20"
},
"license": "MIT OR Apache-2.0",
"repository": {
"directory": "npm",
"url": "https://github.com/foundry-rs/foundry"
},
"keywords": [
"foundry",
"testing",
"ethereum",
"solidity",
"blockchain",
"smart-contracts"
]
}
4 changes: 4 additions & 0 deletions npm/@foundry-rs/forge-linux-x64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# forge

This is the Linux 64-bit binary for `forge`, a CLI tool for testing, building, and deploying your smart contracts.
See <https://getfoundry.sh/forge/overview> for details.
35 changes: 35 additions & 0 deletions npm/@foundry-rs/forge-linux-x64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@foundry-rs/forge-linux-x64",
"version": "1.2.3",
"type": "module",
"homepage": "https://getfoundry.sh",
"description": "Fast and flexible Ethereum testing framework (Linux x64)",
"bin": {
"forge": "./bin/forge"
},
"os": [
"linux"
],
"cpu": [
"x64"
],
"files": [
"bin"
],
"engines": {
"node": ">=20"
},
"license": "MIT OR Apache-2.0",
"repository": {
"directory": "npm",
"url": "https://github.com/foundry-rs/foundry"
},
"keywords": [
"foundry",
"testing",
"ethereum",
"solidity",
"blockchain",
"smart-contracts"
]
}
4 changes: 4 additions & 0 deletions npm/@foundry-rs/forge-win32-x64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# forge

This is the Windows 64-bit binary for `forge`, a CLI tool for testing, building, and deploying your smart contracts.
See <https://getfoundry.sh/forge/overview> for details.
Loading