Skip to content

Commit ffcaefe

Browse files
committed
fix CI?
update review file
1 parent 97ad852 commit ffcaefe

File tree

3 files changed

+364
-156
lines changed

3 files changed

+364
-156
lines changed
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: Test Foundry
2+
description: "runs all the tests for a Foundry solidity project"
3+
4+
inputs:
5+
foundry:
6+
description: "Foundry version to test"
7+
required: true
8+
cwd:
9+
description: "Directory to run commands in"
10+
required: false
11+
default: "."
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Check Environment
17+
shell: bash
18+
run: |
19+
echo "runner.os=${{ runner.os }}"
20+
python3 -c "import platform; info = f'{platform.system()} {platform.release()} {platform.version()} {platform.machine()}'; print('-' * len(info)); print(info); print('-' * len(info))"
21+
bash --version
22+
23+
- name: Install Bash 5.2 (on macOS)
24+
if: runner.os == 'macOS'
25+
shell: bash
26+
run: |
27+
brew install bash
28+
bash --version
29+
30+
- name: Install uv python framework
31+
shell: bash
32+
run: |
33+
curl -LsSf https://astral.sh/uv/install.sh | bash
34+
id: uv-install
35+
36+
- name: Install Foundry
37+
uses: foundry-rs/foundry-toolchain@v1
38+
with:
39+
version: ${{ inputs.foundry }}
40+
id: foundry-install
41+
42+
- shell: bash
43+
run: |
44+
# foundry version
45+
forge --version
46+
47+
- name: Install python project dependencies (if any)
48+
shell: bash
49+
run: |
50+
# install python project dependencies
51+
cd ${{ inputs.cwd }}
52+
[[ -f pyproject.toml ]] && uv sync || echo "No pyproject.toml found, skipping python dependencies installation"
53+
54+
- name: Install node project dependencies
55+
shell: bash
56+
run: |
57+
# install node project dependencies
58+
cd ${{ inputs.cwd }}
59+
yarn
60+
61+
- name: Run Prettier
62+
shell: bash
63+
run: |
64+
# run prettier to check formatting
65+
cd ${{ inputs.cwd }}
66+
yarn fmt:check
67+
id: fmt
68+
69+
- name: Run Solhint & forge lint
70+
shell: bash
71+
run: |
72+
# run solhint
73+
cd ${{ inputs.cwd }}
74+
yarn lint
75+
id: lint
76+
77+
- name: Run Slither
78+
shell: bash
79+
run: |
80+
# run slither
81+
cd ${{ inputs.cwd }}
82+
yarn slither
83+
id: slither
84+
85+
- name: Run Forge tests
86+
shell: bash
87+
run: |
88+
# run all the foundry tests in the test folder
89+
cd ${{ inputs.cwd }}
90+
yarn test
91+
id: test
92+
93+
- name: Run Lint on Forge tests
94+
shell: bash
95+
run: |
96+
# run lint on forge tests
97+
cd ${{ inputs.cwd }}
98+
yarn lint:test
99+
id: lint-test
100+
101+
- name: Run bytecode generation for the factory
102+
shell: bash
103+
run: |
104+
cd ${{ inputs.cwd }}
105+
yarn extract
106+
id: extract
107+
108+
- name: Check for changed repo files
109+
shell: bash
110+
run: |
111+
# if there are any added or changed (excluding staged) files then list them and fail
112+
cd ${{ inputs.cwd }}
113+
if ! git diff --quiet || [[ -n "$(git ls-files --others --exclude-standard)" ]]; then
114+
git status --short
115+
git diff | head -100
116+
echo "Git repo has changed, either correctly fix those files locally or .gitignore them"; exit 1;
117+
fi
118+
id: git-diffs
119+
120+
- name: Check some wtf's
121+
shell: bash
122+
run: |
123+
# if the package.json file has a wtf script, run it
124+
# if it returns anything, print it then fail the action
125+
cd ${{ inputs.cwd }}
126+
if jq -e '.scripts.wtf' package.json >/dev/null; then
127+
out=$(yarn wtf)
128+
echo "$out"
129+
if [ -n "$out" ]; then
130+
echo "wt(actual)f: issues detected by running 'yarn wtf' (which is an optional script in package.json used to detect project bespoke issues)"
131+
exit 1
132+
fi
133+
echo "wtf: no issues detected by running 'yarn wtf' (which is an optional script in package.json used to detect project bespoke issues)"
134+
fi
135+
echo "wtf: no script "wtf" in package.json, which is fine and dandy as 'yarn wtf' is an optional script in package.json used to detect project bespoke issues"
136+
exit 0
137+
id: wtf

.github/workflows/CI-test-foundry-stable.yml

Lines changed: 2 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -31,160 +31,7 @@ jobs:
3131
with:
3232
submodules: recursive
3333

34-
- name: Check Environment
35-
shell: bash
36-
run: |
37-
echo "runner.os=${{ runner.os }}"
38-
python3 -c "import platform; info = f'{platform.system()} {platform.release()} {platform.version()} {platform.machine()}'; print('-' * len(info)); print(info); print('-' * len(info))"
39-
bash --version
40-
41-
- name: Install Bash 5.2 (on macOS)
42-
if: runner.os == 'macOS'
43-
shell: bash
44-
run: |
45-
brew install bash
46-
bash --version
47-
48-
- name: Install uv python framework
49-
shell: bash
50-
run: |
51-
curl -LsSf https://astral.sh/uv/install.sh | bash
52-
id: uv-install
53-
54-
- name: Install Foundry
55-
uses: foundry-rs/foundry-toolchain@v1
34+
- name: Run Bao-factory CI actions
35+
uses: ./.github/actions/test-foundry
5636
with:
5737
foundry: ${{ matrix.foundry }}
58-
id: foundry-install
59-
60-
- shell: bash
61-
run: |
62-
# foundry version
63-
forge --version
64-
65-
- name: Install python project dependencies (if any)
66-
shell: bash
67-
run: |
68-
# install python project dependencies
69-
cd ${{ inputs.cwd }}
70-
[[ -f pyproject.toml ]] && uv sync || echo "No pyproject.toml found, skipping python dependencies installation"
71-
72-
- name: Install node project dependencies
73-
shell: bash
74-
run: |
75-
# install node project dependencies
76-
cd ${{ inputs.cwd }}
77-
yarn
78-
79-
- name: Run Prettier
80-
shell: bash
81-
run: |
82-
# run prettier to check formatting
83-
cd ${{ inputs.cwd }}
84-
yarn fmt:check
85-
id: fmt
86-
87-
- name: Run Solhint & forge lint
88-
shell: bash
89-
run: |
90-
# run solhint
91-
cd ${{ inputs.cwd }}
92-
yarn lint
93-
id: lint
94-
95-
- name: Run Slither
96-
shell: bash
97-
run: |
98-
# run slither
99-
cd ${{ inputs.cwd }}
100-
yarn slither
101-
id: slither
102-
103-
# - name: Run Forge build, generating contract sizes reports into the regression folder - if they differ from the ones in the repo, they will be failed in the git-diffs step
104-
# if: runner.os != 'Windows' # TODO: for some reason, the sizes processing doesn't work on windows
105-
# shell: bash
106-
# run: |
107-
# # generate contract sizes reports into the regression folder - if they differ from the ones in the repo, they will be failed in the git-diffs step
108-
# cd ${{ inputs.cwd }}
109-
# uv run yarn sizes
110-
# id: sizes
111-
112-
- name: Run Forge tests
113-
shell: bash
114-
run: |
115-
# run all the foundry tests in the test folder
116-
cd ${{ inputs.cwd }}
117-
yarn test
118-
id: test
119-
120-
- name: Run Lint on Forge tests
121-
shell: bash
122-
run: |
123-
# run all the foundry tests in the test folder
124-
cd ${{ inputs.cwd }}
125-
yarn lint:test
126-
id: lint-test
127-
128-
# - name: Run Forge tests - coverage
129-
# if: runner.os != 'Windows' # TODO: for some reason, the coverage processing doesn't work on windows
130-
# shell: bash
131-
# run: |
132-
# # generate coverage reports into the regression folder - if they differ from the ones in the repo, they will be failed in the git-diffs step
133-
# cd ${{ inputs.cwd }}
134-
# uv run yarn coverage
135-
# id: coverage
136-
137-
# - name: Run Forge tests - gas
138-
# if: runner.os != 'Windows' # TODO: for some reason, the gas processing doesn't work on windows
139-
# shell: bash
140-
# run: |
141-
# # generate gas reports into the regression folder - if they differ from the ones in the repo, they will be failed in the git-diffs step
142-
# cd ${{ inputs.cwd }}
143-
# uv run yarn gas
144-
# id: gas
145-
146-
# - name: Run upgradeable contract deployment validation
147-
# shell: bash
148-
# run: |
149-
# # check all contracts for deployment upgradeability
150-
# cd ${{ inputs.cwd }}
151-
# uv run yarn validate
152-
# id: validate
153-
154-
- name: Run bytecode generation for the factory
155-
shell: bash
156-
run: |
157-
cd ${{ inputs.cwd }}
158-
yarn extract
159-
id: validate
160-
161-
- name: Check for changed repo files
162-
shell: bash
163-
run: |
164-
# if there are any added or changed (excluding staged) files then list them and fail
165-
cd ${{ inputs.cwd }}
166-
if ! git diff --quiet || [[ -n "$(git ls-files --others --exclude-standard)" ]]; then
167-
git status --short
168-
git diff | head -100
169-
echo "Git repo has changed, either correctly fix those files locally or .gitignore them"; exit 1;
170-
fi
171-
id: git-diffs
172-
173-
- name: Check some wtf's
174-
shell: bash
175-
run: |
176-
# if the package.json file has a wtf script, run it
177-
# if it returns anything, print it then fail the action
178-
cd ${{ inputs.cwd }}
179-
if jq -e '.scripts.wtf' package.json >/dev/null; then
180-
out=$(yarn wtf)
181-
echo "$out"
182-
if [ -n "$out" ]; then
183-
echo "wt(actual)f: issues detected by running 'yarn wtf' (which is an optional script in package.json used to detect project bespoke issues)"
184-
exit 1
185-
fi
186-
echo "wtf: no issues detected by running 'yarn wtf' (which is an optional script in package.json used to detect project bespoke issues)"
187-
fi
188-
echo "wtf: no script "wtf" in package.json, which is fine and dandy as 'yarn wtf' is an optional script in package.json used to detect project bespoke issues"
189-
exit 0
190-
id: wtf

0 commit comments

Comments
 (0)