Skip to content

Commit 5f470ef

Browse files
authored
Merge pull request #120 from step-security/auto-cherry-pick
chore: Cherry-picked changes from upstream
2 parents a151f08 + 1bcd665 commit 5f470ef

File tree

10 files changed

+165
-77
lines changed

10 files changed

+165
-77
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ updates:
88
- package-ecosystem: npm
99
directory: /
1010
schedule:
11-
interval: daily
11+
interval: daily

.github/workflows/check-dist.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: ci
2+
3+
permissions: {}
4+
5+
on:
6+
pull_request:
7+
branches:
8+
- main
9+
paths-ignore:
10+
- "**.md"
11+
push:
12+
branches:
13+
- main
14+
paths-ignore:
15+
- "**.md"
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
test:
23+
runs-on: ${{ matrix.config.os }}
24+
strategy:
25+
matrix:
26+
# Note: GitHub does not host Alpine runners, so we skip testing there for now.
27+
config:
28+
- { os: ubuntu-latest, arch: x64 } # foundry_v[ersion]_linux_amd64.tar.gz
29+
- { os: ubuntu-24.04-arm, arch: arm64 } # foundry_v[ersion]_linux_arm64.tar.gz
30+
- { os: macos-latest, arch: arm64 } # foundry_v[ersion]_darwin_arm64.tar.gz
31+
- { os: macos-15-intel, arch: x64 } # foundry_v[ersion]_darwin_amd64.tar.gz
32+
- { os: windows-latest, arch: x64 } # foundry_v[ersion]_windows_amd64.zip
33+
version: [stable, nightly]
34+
permissions:
35+
contents: read
36+
steps:
37+
- uses: actions/checkout@v5
38+
with:
39+
persist-credentials: false
40+
41+
- name: Use Node.js 24.x
42+
uses: actions/setup-node@v5
43+
with:
44+
node-version: 24.x
45+
46+
- name: Install dependencies
47+
run: npm ci --ignore-scripts
48+
49+
- name: Rebuild dist/
50+
run: npm run build
51+
52+
- name: Test action installation (${{ matrix.version }})
53+
uses: ./
54+
with:
55+
version: ${{ matrix.version }}
56+
cache: false
57+
58+
- name: Verify Foundry installation
59+
shell: bash
60+
run: |
61+
forge --version
62+
cast --version
63+
anvil --version
64+
chisel --version
65+
66+
- name: Test basic Foundry functionality
67+
shell: bash
68+
run: |
69+
forge init test-project --force
70+
cd test-project
71+
forge build
72+
forge test -vvv
73+
74+
match:
75+
runs-on: ubuntu-latest
76+
permissions:
77+
contents: read
78+
steps:
79+
- uses: actions/checkout@v5
80+
with:
81+
persist-credentials: false
82+
83+
- name: Use Node.js 24.x
84+
uses: actions/setup-node@v5
85+
with:
86+
node-version: 24.x
87+
88+
- name: Install dependencies
89+
run: npm ci --ignore-scripts
90+
91+
- name: Rebuild dist/
92+
run: npm run build
93+
94+
- name: Compare the expected and actual dist/ directories
95+
run: |
96+
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
97+
echo "Detected uncommitted changes after build. See status below:"
98+
git diff
99+
exit 1
100+
fi
101+
id: diff
102+
103+
# If index.js was different than expected, upload the expected version as an artifact
104+
- uses: actions/upload-artifact@v4
105+
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
106+
with:
107+
name: dist
108+
path: dist/
109+
110+
ci-success:
111+
runs-on: ubuntu-latest
112+
if: always()
113+
needs:
114+
- test
115+
- match
116+
timeout-minutes: 30
117+
steps:
118+
- name: Decide whether the needed jobs succeeded or failed
119+
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # release/v1
120+
with:
121+
jobs: ${{ toJSON(needs) }}

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v24.9.0

README.md

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,54 @@ toolkit for Ethereum application development.
66
### Example workflow
77

88
```yml
9-
on: [push]
9+
name: CI
1010

11-
name: test
11+
permissions: {}
12+
13+
on:
14+
push:
15+
pull_request:
16+
workflow_dispatch:
17+
18+
env:
19+
FOUNDRY_PROFILE: ci
1220

1321
jobs:
1422
check:
1523
name: Foundry project
1624
runs-on: ubuntu-latest
25+
permissions:
26+
contents: read
1727
steps:
18-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v5
1929
with:
30+
persist-credentials: false
2031
submodules: recursive
2132

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

25-
- name: Run tests
26-
run: forge test -vvv
36+
- name: Show Forge version
37+
run: forge --version
38+
39+
- name: Run Forge fmt
40+
run: forge fmt --check
2741

28-
- name: Run snapshot
29-
run: forge snapshot
42+
- name: Run Forge build
43+
run: forge build --sizes
44+
45+
- name: Run Forge tests
46+
run: forge test -vvv
3047
```
3148
3249
### Inputs
3350
34-
| **Name** | **Required** | **Default** | **Description** | **Type** |
35-
| -------------------- | ------------ | ------------------------------------- | --------------------------------------------------------------- | -------- |
36-
| `cache` | No | `true` | Whether to cache RPC responses or not. | bool |
37-
| `version` | No | `stable` | Version to install, e.g. `stable`, `rc`, `nightly` or `v0.3.0`. | string |
38-
| `cache-key` | No | `${{ github.job }}-${{ github.sha }}` | The cache key to use for caching. | string |
39-
| `cache-restore-keys` | No | `[${{ github.job }}-]` | The cache keys to use for restoring the cache. | string[] |
51+
| **Name** | **Required** | **Default** | **Description** | **Type** |
52+
| -------------------- | ------------ | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -------- |
53+
| `cache` | No | `true` | Whether to cache RPC responses or not. | bool |
54+
| `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 |
55+
| `cache-key` | No | `${{ github.job }}-${{ github.sha }}` | The cache key to use for caching. | string |
56+
| `cache-restore-keys` | No | `[${{ github.job }}-]` | The cache keys to use for restoring the cache. | string[] |
4057

4158
### RPC Caching
4259

@@ -128,9 +145,13 @@ for more information.
128145

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

148+
Install [nvm](https://github.com/nvm-sh/nvm).
149+
131150
```console
132-
$ npm ci
151+
$ nvm install 24.9.0
152+
$ nvm use
153+
$ npm ci --ignore-scripts
133154
$ npm run build
134155
```
135156

136-
You **have** to use Node.js 20.x.
157+
You **must** use the Node.js version `24.9.0` to build.

dist/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95875,8 +95875,8 @@ function normalizeVersionName(version) {
9587595875

9587695876
function mapArch(arch) {
9587795877
const mappings = {
95878-
x32: "386",
9587995878
x64: "amd64",
95879+
arm64: "arm64",
9588095880
};
9588195881

9588295882
return mappings[arch] || arch;

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@step-security/foundry-toolchain",
3-
"version": "1.0.8",
3+
"version": "1.5.0",
44
"license": "SEE LICENSE IN LICENSE",
55
"main": "dist/index.js",
66
"keywords": [

src/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ function normalizeVersionName(version) {
66

77
function mapArch(arch) {
88
const mappings = {
9-
x32: "386",
109
x64: "amd64",
10+
arm64: "arm64",
1111
};
1212

1313
return mappings[arch] || arch;

0 commit comments

Comments
 (0)