Skip to content

Commit 83bcde8

Browse files
Merge pull request #319 from ethereum-optimism/jan/circleci--003
chore: Manage dependencies using mise [3/N]
2 parents 4cec4b9 + de7d31f commit 83bcde8

File tree

5 files changed

+75
-27
lines changed

5 files changed

+75
-27
lines changed

.circleci/config.yml

+18-27
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ version: 2.1
22

33
executors:
44
default:
5-
docker:
6-
- image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:v0.55.0
5+
machine:
6+
image: ubuntu-2204:2024.08.1
77

88
orbs:
99
go: circleci/[email protected]
@@ -24,31 +24,17 @@ commands:
2424
name: Initialize submodules
2525
command: git submodule update --init --recursive
2626

27-
install-golangci-lint:
28-
parameters:
29-
version:
30-
type: string
31-
default: v1.63.4
27+
install-dependencies:
3228
steps:
3329
- run:
34-
name: Setup golangci-lint
35-
command: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin << parameters.version >>
36-
37-
install-goreleaser:
38-
parameters:
39-
version:
40-
type: string
41-
default: "2.5.1"
42-
steps:
30+
name: Install mise
31+
command: curl https://mise.run | MISE_INSTALL_PATH=/home/circleci/bin/mise sh
4332
- run:
44-
name: Install GoReleaser
45-
command: |
46-
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list
47-
apt -q update -y
48-
apt -q install -y --no-install-recommends goreleaser=<< parameters.version >>
33+
name: Activate mise
34+
command: echo 'eval "$(mise activate bash)"' >> $BASH_ENV
4935
- run:
50-
name: Output GoReleaser version
51-
command: goreleaser --version
36+
name: Install mise dependencies
37+
command: mise install
5238

5339
install-go-modules:
5440
steps:
@@ -61,6 +47,7 @@ jobs:
6147
executor: default
6248
steps:
6349
- checkout-with-submodules
50+
- install-dependencies
6451
- run:
6552
name: Check versions
6653
command: just check-monorepo-versions
@@ -71,6 +58,7 @@ jobs:
7158
FOUNDRY_PROFILE: ci
7259
steps:
7360
- checkout-with-submodules
61+
- install-dependencies
7462
- run:
7563
name: Run Forge build
7664
command: just build-contracts
@@ -82,8 +70,7 @@ jobs:
8270
executor: default
8371
steps:
8472
- checkout-with-submodules
85-
- install-go-modules
86-
- install-golangci-lint
73+
- install-dependencies
8774
- run:
8875
name: Run linter
8976
command: just lint-go
@@ -92,12 +79,14 @@ jobs:
9279
executor: default
9380
steps:
9481
- checkout-with-submodules
82+
- install-dependencies
9583
- install-go-modules
9684
- run:
9785
# We need to "rename" some of the variables coming from the CircleCI context
9886
# to match what supersim expects
9987
name: Setup environment variables
10088
command: |
89+
echo "export SUPERSIM_RPC_URL_MAINNET=$RPC_URL_ETHEREUM_MAINNET" >> $BASH_ENV
10190
echo "export SUPERSIM_RPC_URL_OP=$RPC_URL_OP_MAINNET" >> $BASH_ENV
10291
echo "export SUPERSIM_RPC_URL_BASE=$RPC_URL_BASE_MAINNET" >> $BASH_ENV
10392
- run:
@@ -109,10 +98,12 @@ jobs:
10998
executor: default
11099
steps:
111100
- checkout-with-submodules
112-
- install-goreleaser
101+
- install-dependencies
113102
- install-go-modules
114103
- utils/get-github-access-token:
115-
# GoReleaser expects a GITHUB_TOKEN environment variable to be set
104+
# GoReleaser uses the GITHUB_TOKEN environment variable to authenticate with GitHub
105+
#
106+
# It's important that the token has write permissions both to this repository and to the homebrew-tap repository
116107
output-token-name: GITHUB_TOKEN
117108
- run:
118109
name: Run GoReleaser

Justfile

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
set positional-arguments
22

3+
build-book:
4+
mdbook build ./docs
5+
36
build-contracts:
47
forge --version
58
forge build --sizes --root ./contracts

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,24 @@ L2s: Predeploy Contracts Spec ( https://specs.optimism.io/protocol/predeploys.ht
203203

204204
### Development
205205

206+
#### Software dependencies
207+
208+
We use [`mise`](https://mise.jdx.dev/) as a dependency manager for these tools.
209+
Once properly installed, `mise` will provide the correct versions for each tool. `mise` does not
210+
replace any other installations of these binaries and will only serve these binaries when you are
211+
working inside of the `optimism` directory.
212+
213+
##### Install `mise`
214+
215+
Install `mise` by following the instructions provided on the
216+
[Getting Started page](https://mise.jdx.dev/getting-started.html#_1-install-mise-cli).
217+
218+
##### Install dependencies
219+
220+
```sh
221+
mise install
222+
```
223+
206224
#### Running locally
207225

208226
```sh

mise.book.toml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# These dependencies are only required if you want to build the book
2+
#
3+
# To install them, run mise with --env book (or set the MISE_ENV variable to "book"):
4+
#
5+
# mise --env book install
6+
#
7+
# MISE_ENV=book mise install
8+
9+
[tools]
10+
11+
# Cargo dependencies
12+
"cargo:mdbook" = "0.4.43"
13+
"cargo:mdbook-mermaid" = "0.14.1"

mise.toml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[tools]
2+
3+
# Core dependencies
4+
go = "1.22.3"
5+
rust = "1.83.0"
6+
just = "1.37.0"
7+
8+
# Go dependencies
9+
"ubi:goreleaser/goreleaser" = "2.5.1"
10+
"ubi:golangci/golangci-lint" = "v1.63.4"
11+
12+
# Foundry dependencies
13+
# Foundry is a special case because it supplies multiple binaries at the same
14+
# GitHub release, so we need to use the aliasing trick to get mise to not error
15+
forge = "nightly-017c59d6806ce11f1dc131f8607178efad79d84a"
16+
cast = "nightly-017c59d6806ce11f1dc131f8607178efad79d84a"
17+
anvil = "nightly-017c59d6806ce11f1dc131f8607178efad79d84a"
18+
19+
# Foundry provides multiple binaries so we alias them here
20+
[alias]
21+
forge = "ubi:foundry-rs/foundry[exe=forge]"
22+
cast = "ubi:foundry-rs/foundry[exe=cast]"
23+
anvil = "ubi:foundry-rs/foundry[exe=anvil]"

0 commit comments

Comments
 (0)