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: Migrate github pages deployment workflow to CircleCI #507

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
87 changes: 67 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
version: 2.1

orbs:
slack: circleci/[email protected]
parameters:
ci_builder_image:
type: string
default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:v0.35.0
base_image:
type: string
default: ubuntu-2204:2022.07.1
utils: ethereum-optimism/[email protected]

executors:
default:
machine:
image: ubuntu-2204:2024.08.1

commands:
install-dependencies:
steps:
- run:
name: Install mise
command: curl https://mise.run | MISE_INSTALL_PATH=/home/circleci/bin/mise sh
- run:
name: Activate mise
command: echo 'eval "$(mise activate bash)"' >> $BASH_ENV
- run:
name: Install mise dependencies
command: mise install

notify-failures-on-develop:
description: "Notify Slack"
parameters:
Expand All @@ -21,47 +34,81 @@ commands:
event: fail
template: basic_fail_1
branch_pattern: develop

jobs:
lint-specs:
docker:
- image: <<pipeline.parameters.ci_builder_image>>
executor: default
steps:
- checkout
- run:
name: Install pnpm
command: npm install -g [email protected]
- run:
name: Install deps
command: just deps
- install-dependencies
- run:
name: markdown lint
command: just lint-specs-md-check
- run:
name: markdown toc
command: just lint-specs-toc-check
- run:
name: build book
command: just build

lint-links:
machine:
image: <<pipeline.parameters.base_image>>
executor: default
steps:
- checkout
- install-dependencies
- run:
name: Lint check
command: just lint-links
- notify-failures-on-develop:
channel: C055R639XT9 #notify-link-check

build-book:
executor: default
steps:
- checkout
- install-dependencies
- run:
name: Build
command: just build
- run:
name: Add CNAME file
command: echo "specs.optimism.io" > ./book/html/CNAME
- persist_to_workspace:
root: ./book
paths:
- html

publish-book:
executor: default
steps:
- checkout
- attach_workspace:
at: /tmp/book
- utils/get-github-access-token
- utils/github-pages-deploy:
src-pages-dir: /tmp/book/html

workflows:
specs-check:
when:
not:
equal: [scheduled_pipeline, << pipeline.trigger_source >>]
jobs:
- lint-specs
- build-book

scheduled-links-check:
when:
equal: [build_daily, <<pipeline.schedule.name>>]
jobs:
- lint-links:
context: slack

publish:
jobs:
- build-book:
filters:
branches:
only: main
- publish-book:
requires:
- build-book
context:
- circleci-repo-specs
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@ We welcome your contributions. Read through [CONTRIBUTING.md](./CONTRIBUTING.md)

### Dependencies

#### Using `mise`

We use [`mise`](https://mise.jdx.dev/) as a dependency manager for these tools.
Once properly installed, `mise` will provide the correct versions for each tool. `mise` does not
replace any other installations of these binaries and will only serve these binaries when you are
working inside of the `optimism` directory.

##### Install `mise`

Install `mise` by following the instructions provided on the
[Getting Started page](https://mise.jdx.dev/getting-started.html#_1-install-mise-cli).

##### Install dependencies

```sh
mise install
```

#### Manual installation

**Rust Toolchain**

```sh
Expand Down
23 changes: 23 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[tools]

# Core dependencies
rust = "1.83.0"
just = "1.37.0"
node = "20.9.0"

# Cargo dependencies
"cargo:mdbook" = "0.4.43"
"cargo:mdbook-katex" = "0.9.2"
"cargo:mdbook-linkcheck" = "0.7.7"
"cargo:mdbook-mermaid" = "0.14.1"

[hooks]
postinstall = [
# Enabling corepack will install the `pnpm` package manager specified in package.json
'npx corepack enable',
'pnpm i --frozen-lockfile'
]

[settings]
# Needs to be enabled for hooks to work
experimental = true
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"doctoc": "^2.2.1",
"markdownlint-cli2": "0.4.0",
"cspell": "^8.1.3"
}
},
"packageManager": "[email protected]"
}