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
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ updates:
- package-ecosystem: npm
directory: /
schedule:
interval: daily
interval: daily
55 changes: 0 additions & 55 deletions .github/workflows/check-dist.yml

This file was deleted.

121 changes: 121 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: ci

permissions: {}

on:
pull_request:
branches:
- main
paths-ignore:
- "**.md"
push:
branches:
- main
paths-ignore:
- "**.md"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
test:
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
# Note: GitHub does not host Alpine runners, so we skip testing there for now.
config:
- { os: ubuntu-latest, arch: x64 } # foundry_v[ersion]_linux_amd64.tar.gz
- { os: ubuntu-24.04-arm, arch: arm64 } # foundry_v[ersion]_linux_arm64.tar.gz
- { os: macos-latest, arch: arm64 } # foundry_v[ersion]_darwin_arm64.tar.gz
- { os: macos-15-intel, arch: x64 } # foundry_v[ersion]_darwin_amd64.tar.gz
- { os: windows-latest, arch: x64 } # foundry_v[ersion]_windows_amd64.zip
version: [stable, nightly]
permissions:
contents: read
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false

- name: Use Node.js 24.x
uses: actions/setup-node@v5
with:
node-version: 24.x

- name: Install dependencies
run: npm ci --ignore-scripts

- name: Rebuild dist/
run: npm run build

- name: Test action installation (${{ matrix.version }})
uses: ./
with:
version: ${{ matrix.version }}
cache: false

- name: Verify Foundry installation
shell: bash
run: |
forge --version
cast --version
anvil --version
chisel --version

- name: Test basic Foundry functionality
shell: bash
run: |
forge init test-project --force
cd test-project
forge build
forge test -vvv

match:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false

- name: Use Node.js 24.x
uses: actions/setup-node@v5
with:
node-version: 24.x

- name: Install dependencies
run: npm ci --ignore-scripts

- name: Rebuild dist/
run: npm run build

- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff

# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/

ci-success:
runs-on: ubuntu-latest
if: always()
needs:
- test
- match
timeout-minutes: 30
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # release/v1
with:
jobs: ${{ toJSON(needs) }}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v24.9.0
51 changes: 36 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,54 @@ toolkit for Ethereum application development.
### Example workflow

```yml
on: [push]
name: CI

name: test
permissions: {}

on:
push:
pull_request:
workflow_dispatch:

env:
FOUNDRY_PROFILE: ci

jobs:
check:
name: Foundry project
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
persist-credentials: false
submodules: recursive

- name: Install Foundry
uses: step-security/foundry-toolchain@v1

- name: Run tests
run: forge test -vvv
- name: Show Forge version
run: forge --version

- name: Run Forge fmt
run: forge fmt --check

- name: Run snapshot
run: forge snapshot
- name: Run Forge build
run: forge build --sizes

- name: Run Forge tests
run: forge test -vvv
```

### Inputs

| **Name** | **Required** | **Default** | **Description** | **Type** |
| -------------------- | ------------ | ------------------------------------- | --------------------------------------------------------------- | -------- |
| `cache` | No | `true` | Whether to cache RPC responses or not. | bool |
| `version` | No | `stable` | Version to install, e.g. `stable`, `rc`, `nightly` or `v0.3.0`. | string |
| `cache-key` | No | `${{ github.job }}-${{ github.sha }}` | The cache key to use for caching. | string |
| `cache-restore-keys` | No | `[${{ github.job }}-]` | The cache keys to use for restoring the cache. | string[] |
| **Name** | **Required** | **Default** | **Description** | **Type** |
| -------------------- | ------------ | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -------- |
| `cache` | No | `true` | Whether to cache RPC responses or not. | bool |
| `version` | No | `stable` | Version to install, e.g. `stable`, `rc`, `nightly` or any [SemVer](https://semver.org/) tag prefixed with `v` (e.g. `v1.3.6`) | string |
| `cache-key` | No | `${{ github.job }}-${{ github.sha }}` | The cache key to use for caching. | string |
| `cache-restore-keys` | No | `[${{ github.job }}-]` | The cache keys to use for restoring the cache. | string[] |

### RPC Caching

Expand Down Expand Up @@ -128,9 +145,13 @@ for more information.

When opening a PR, you must build the action exactly following the below steps for CI to pass:

Install [nvm](https://github.com/nvm-sh/nvm).

```console
$ npm ci
$ nvm install 24.9.0
$ nvm use
$ npm ci --ignore-scripts
$ npm run build
```

You **have** to use Node.js 20.x.
You **must** use the Node.js version `24.9.0` to build.
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95875,8 +95875,8 @@ function normalizeVersionName(version) {

function mapArch(arch) {
const mappings = {
x32: "386",
x64: "amd64",
arm64: "arm64",
};

return mappings[arch] || arch;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@step-security/foundry-toolchain",
"version": "1.0.8",
"version": "1.5.0",
"license": "SEE LICENSE IN LICENSE",
"main": "dist/index.js",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ function normalizeVersionName(version) {

function mapArch(arch) {
const mappings = {
x32: "386",
x64: "amd64",
arm64: "arm64",
};

return mappings[arch] || arch;
Expand Down
Loading