Skip to content

Commit 572c984

Browse files
committed
update version selection
1 parent 935605c commit 572c984

File tree

2 files changed

+61
-54
lines changed

2 files changed

+61
-54
lines changed

.github/actions/setup/action.yml

Lines changed: 57 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,108 @@
11
name: Setup
22
description: Common environment setup
33
inputs:
4-
use-node:
4+
node:
55
description: Whether to set up node
66
required: false
7-
default: 'true'
8-
node-version:
9-
description: Version of node to install (if use-node is true)
10-
required: false
11-
default: '24.x'
12-
use-foundry:
7+
default: 'on' # 'off' | 'on' | <specific version>
8+
foundry:
139
description: Whether to set up Foundry
1410
required: false
15-
default: 'true'
16-
foundry-version:
17-
description: Version of Foundry to install (if use-foundry is true)
18-
required: false
19-
default: 'stable'
20-
use-java:
11+
default: 'on' # 'off' | 'on' | <specific version>
12+
java:
2113
description: Whether to set up Java
2214
required: false
23-
default: 'false'
24-
java-version:
25-
description: Version of Java to install (if use-java is true)
26-
required: false
27-
default: '21'
28-
use-python:
15+
default: 'off' # 'off' | 'on' | <specific version>
16+
python:
2917
description: Whether to set up Python
3018
required: false
31-
default: 'false'
32-
python-version:
33-
description: Version of Python to install (if use-python is true)
34-
required: false
35-
default: '3.13'
19+
default: 'off' # 'off' | 'on' | <specific version>
3620
python-requirements:
37-
description: Path to Python requirements file (if use-python is true)
21+
description: Path to Python requirements file (if python is true)
3822
required: false
3923
default: 'requirements.txt'
40-
use-solc:
24+
solc:
4125
description: Whether to set up solc
4226
required: false
43-
default: 'false'
44-
solc-version:
45-
description: Version of solc to install (if use-solc is true)
46-
required: false
47-
default: '0.8.27'
27+
default: 'off' # 'off' | 'on' | <specific version>
28+
29+
env:
30+
NODE_DEFAULT_VERSION: "24.x"
31+
FOUNDRY_DEFAULT_VERSION: "stable"
32+
JAVA_DEFAULT_VERSION: "21"
33+
PYTHON_DEFAULT_VERSION: "3.13"
34+
SOLC_DEFAULT_VERSION: "0.8.27"
4835

4936
runs:
5037
using: composite
5138
steps:
39+
- id: versions
40+
run: |
41+
(
42+
[[ "${{ inputs.node }}" = "on" ]] \
43+
&& echo "node=$NODE_DEFAULT_VERSION" \
44+
|| echo "node=${{ inputs.node }}"
45+
[[ "${{ inputs.foundry }}" = "on" ]] \
46+
&& echo "foundry=$FOUNDRY_DEFAULT_VERSION" \
47+
|| echo "foundry=${{ inputs.foundry }}"
48+
[[ "${{ inputs.java }}" = "on" ]] \
49+
&& echo "java=$JAVA_DEFAULT_VERSION" \
50+
|| echo "java=${{ inputs.java }}"
51+
[[ "${{ inputs.python }}" = "on" ]] \
52+
&& echo "python=$PYTHON_DEFAULT_VERSION" \
53+
|| echo "python=${{ inputs.python }}"
54+
[[ "${{ inputs.solc }}" = "on" ]] \
55+
&& echo "solc=$SOLC_DEFAULT_VERSION" \
56+
|| echo "solc=${{ inputs.solc }}"
57+
) >> $GITHUB_OUTPUT
58+
shell: bash
5259
# Node & npm setup
53-
- name: Install Node (${{ inputs.node-version }})
54-
if: inputs.use-node == 'true'
60+
- name: Install Node (${{ steps.versions.outputs.node }})
61+
if: inputs.node != 'off'
5562
uses: actions/setup-node@v6
5663
with:
57-
node-version: ${{ inputs.node-version }}
64+
node-version: ${{ steps.versions.outputs.node }}
5865
- name: Try fetch node modules from cache
5966
id: cache
60-
if: inputs.use-node == 'true'
67+
if: inputs.node != 'off'
6168
uses: actions/cache@v5
6269
with:
6370
path: '**/node_modules'
64-
key: npm-${{ inputs.node-version }}-${{ hashFiles('**/package-lock.json') }}
71+
key: npm-${{ steps.versions.outputs.node }}-${{ hashFiles('**/package-lock.json') }}
6572
- name: Install dependencies
66-
if: inputs.use-node == 'true' && steps.cache.outputs.cache-hit != 'true'
73+
if: inputs.node != 'off' && steps.cache.outputs.cache-hit != 'true'
6774
shell: bash
6875
run: npm ci
6976
# Foundry setup
70-
- name: Install Foundry (${{ inputs.foundry-version }})
71-
if: inputs.use-foundry == 'true'
77+
- name: Install Foundry (${{ steps.versions.outputs.foundry }})
78+
if: inputs.foundry != 'off'
7279
uses: foundry-rs/foundry-toolchain@v1
7380
with:
74-
version: ${{ inputs.foundry-version }}
81+
version: ${{ steps.versions.outputs.foundry }}
7582
# Java setup
76-
- name: Install java (${{ inputs.java-version }})
77-
if: ${{ inputs.use-java == 'true' }}
83+
- name: Install java (${{ steps.versions.outputs.java }})
84+
if: ${{ inputs.java != 'off' }}
7885
uses: actions/setup-java@v5
7986
with:
8087
distribution: temurin
81-
java-version: ${{ inputs.java-version }}
88+
java-version: ${{ steps.versions.outputs.java }}
8289
# Python setup
83-
- name: Install python (${{ inputs.python-version }})
84-
if: inputs.use-python == 'true'
90+
- name: Install python (${{ steps.versions.outputs.python }})
91+
if: inputs.python != 'off'
8592
uses: actions/setup-python@v6
8693
with:
87-
python-version: ${{ inputs.python-version }}
94+
python-version: ${{ steps.versions.outputs.python }}
8895
cache: 'pip'
8996
cache-dependency-path: ${{ inputs.python-requirements }}
9097
- name: Install python packages
91-
if: inputs.use-python == 'true'
98+
if: inputs.python != 'off'
9299
shell: bash
93100
run: pip install -r ${{ inputs.python-requirements }}
94101
# Solc setup
95-
- name: Install solc (${{ inputs.solc-version }})
96-
if: inputs.use-solc == 'true'
102+
- name: Install solc (${{ steps.versions.outputs.solc }})
103+
if: inputs.solc != 'off'
97104
shell: bash
98105
run: |
99-
wget -q https://github.com/argotorg/solidity/releases/download/v${{ inputs.solc-version }}/solc-static-linux
106+
wget -q https://github.com/argotorg/solidity/releases/download/v${{ steps.versions.outputs.solc }}/solc-static-linux
100107
chmod +x solc-static-linux
101108
sudo mv solc-static-linux /usr/local/bin/solc

.github/workflows/formal-verification.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ jobs:
2727
- name: Set up environment
2828
uses: ./.github/actions/setup
2929
with:
30-
use-solc: 'true'
31-
use-java: 'true'
32-
use-python: 'true'
30+
solc: 'on'
31+
java: 'on'
32+
python: 'on'
3333
python-requirements: 'fv-requirements.txt'
3434
- name: identify specs that need to be run
3535
id: arguments
@@ -55,7 +55,7 @@ jobs:
5555
- name: Set up environment
5656
uses: ./.github/actions/setup
5757
with:
58-
use-python: 'true'
58+
python: 'on'
5959
python-requirements: 'fv-requirements.txt'
6060
- name: Run Halmos
6161
run: halmos --match-test '^symbolic|^testSymbolic' -vv

0 commit comments

Comments
 (0)