Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Release flow migration to CircleCI [2/N] #318

Merged
merged 6 commits into from
Jan 16, 2025
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
66 changes: 45 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ version: 2.1
executors:
default:
docker:
- image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:v0.35.0
- image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:v0.55.0

orbs:
go: circleci/[email protected]
utils: ethereum-optimism/[email protected]

commands:
# By default, CircleCI does not checkout any submodules
Expand All @@ -23,23 +24,6 @@ commands:
name: Initialize submodules
command: git submodule update --init --recursive

install-foundry:
steps:
# Since CircleCI only sources the $BASH_ENV before each step, we isolate our $PATH modification to a separate step
- run:
name: Setup $PATH for foundry
command: echo 'export PATH=$HOME/.foundry/bin:$PATH' >> $BASH_ENV
- run:
name: Install Foundry
command: |
curl -L https://foundry.paradigm.xyz | bash
foundryup
- run:
name: Output foundry versions
command: |
anvil --version
forge --version

install-golangci-lint:
parameters:
version:
Expand All @@ -50,6 +34,22 @@ commands:
name: Setup golangci-lint
command: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin << parameters.version >>

install-goreleaser:
parameters:
version:
type: string
default: "2.5.1"
steps:
- run:
name: Install GoReleaser
command: |
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list
apt -q update -y
apt -q install -y --no-install-recommends goreleaser=<< parameters.version >>
- run:
name: Output GoReleaser version
command: goreleaser --version

install-go-modules:
steps:
- go/load-mod-cache # Load cached Go modules.
Expand All @@ -71,7 +71,6 @@ jobs:
FOUNDRY_PROFILE: ci
steps:
- checkout-with-submodules
- install-foundry
- run:
name: Run Forge build
command: just build-contracts
Expand All @@ -93,7 +92,6 @@ jobs:
executor: default
steps:
- checkout-with-submodules
- install-foundry
- install-go-modules
- run:
# We need to "rename" some of the variables coming from the CircleCI context
Expand All @@ -106,6 +104,19 @@ jobs:
name: Run tests
command: just test-go
no_output_timeout: 20m

go-release:
executor: default
steps:
- checkout-with-submodules
- install-goreleaser
- install-go-modules
- utils/get-github-access-token:
# GoReleaser expects a GITHUB_TOKEN environment variable to be set
output-token-name: GITHUB_TOKEN
- run:
name: Run GoReleaser
command: goreleaser release --clean

workflows:
main:
Expand All @@ -115,4 +126,17 @@ workflows:
- go-lint
- go-tests:
context:
- oplabs-rpc-urls
- oplabs-rpc-urls
release:
jobs:
- go-release:
context:
- circleci-repo-supersim
filters:
tags:
only:
- /^v?\d+\.\d+\.\d+.*?/
# Without explicitly ignoring all branches, CircleCI will run the job on all branches
# even if no tags have been pushed
branches:
ignore: /.*/
3 changes: 1 addition & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,4 @@ brews:
description: "Supersim is a local dev environment for the Superchain"
repository:
owner: ethereum-optimism
name: homebrew-tap
token: "{{ .Env.TAP_REPO_GITHUB_TOKEN }}"
name: homebrew-tap
Loading