Run forge doc on CI #240
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
merge_group: | |
pull_request: | |
branches: [main, "release-*"] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
# this is needed to gain access via OIDC to the S3 bucket for caching | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RISC0_TOOLCHAIN_VERSION: v2024-02-08.1 | |
RISC0_CRATE_VERSION: "^0.21" | |
jobs: | |
# see: https://github.com/orgs/community/discussions/26822 | |
main-status-check: | |
if: always() | |
needs: | |
- check | |
- doc | |
- docs-rs | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check all job status | |
# see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context | |
# see https://stackoverflow.com/a/67532120/4907315 | |
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} | |
run: exit 1 | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# Full history is required by license-check.py | |
fetch-depth: 0 | |
submodules: recursive | |
- uses: risc0/risc0/.github/actions/rustup@release-0.21 | |
- name: Install cargo-sort | |
uses: risc0/cargo-install@b9307573043522ab0d3e3be64a51763b765b52a4 | |
with: | |
crate: cargo-sort | |
version: "1.0" | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- uses: risc0/foundry-toolchain@2fe7e70b520f62368a0e3c464f997df07ede420f | |
with: | |
version: nightly-09fe3e041369a816365a020f715ad6f94dbce9f2 | |
- run: cargo fmt --all --check | |
- run: cargo fmt --all --check --manifest-path relay/tests/methods/guest/Cargo.toml | |
- run: cargo sort --workspace --check | |
- run: cargo sort --workspace --check relay/tests/methods/guest | |
- run: cargo clippy --workspace --exclude risc0-ethereum-relay-test-methods | |
- run: forge fmt --check | |
working-directory: contracts | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- run: python license-check.py | |
- name: check for "D0 NOT MERGE" comments | |
run: | | |
[ "$(grep -re 'DO[_ ]\?NOT[_ ]\?MERGE' $(git ls-tree --full-tree --name-only -r HEAD) | tee /dev/fd/2 | wc -l)" -eq "0" ] | |
test: | |
runs-on: [self-hosted, prod, "${{ matrix.os }}", "${{ matrix.device }}"] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [Linux, macOS] | |
feature: [default] | |
device: [cpu] | |
include: | |
- os: Linux | |
feature: cuda | |
device: nvidia_rtx_a5000 | |
- os: macOS | |
feature: metal | |
device: apple_m2_pro | |
env: | |
FEATURE: ${{ matrix.feature }} | |
RISC0_BUILD_LOCKED: 1 | |
RUST_BACKTRACE: full | |
steps: | |
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842 | |
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :" | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- if: matrix.feature == 'cuda' | |
uses: risc0/risc0/.github/actions/cuda@release-0.21 | |
- uses: risc0/risc0/.github/actions/rustup@release-0.21 | |
- uses: risc0/risc0/.github/actions/sccache@release-0.21 | |
with: | |
key: ${{ matrix.os }}-${{ matrix.feature }} | |
- run: cargo install --force --locked cargo-risczero@$RISC0_CRATE_VERSION -F $FEATURE | |
- run: cargo risczero install --version $RISC0_TOOLCHAIN_VERSION | |
- uses: risc0/foundry-toolchain@2fe7e70b520f62368a0e3c464f997df07ede420f | |
with: | |
version: nightly-09fe3e041369a816365a020f715ad6f94dbce9f2 | |
- name: build workspace | |
run: cargo test --workspace --timings --no-run | |
- name: test workspace | |
run: cargo test --workspace --timings | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: cargo-timings-${{ matrix.os }}-${{ matrix.device }} | |
path: target/cargo-timings/ | |
retention-days: 5 | |
- run: forge test -vvv | |
working-directory: contracts | |
- run: sccache --show-stats | |
examples: | |
runs-on: ubuntu-latest | |
steps: | |
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842 | |
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :" | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: risc0/risc0/.github/actions/rustup@release-0.21 | |
- uses: risc0/foundry-toolchain@2fe7e70b520f62368a0e3c464f997df07ede420f | |
with: | |
version: nightly-09fe3e041369a816365a020f715ad6f94dbce9f2 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Install Ganache | |
run: npm install ganache --global | |
- uses: risc0/risc0/.github/actions/sccache@release-0.21 | |
with: | |
key: Linux-default | |
- run: cargo install --force --locked cargo-risczero@$RISC0_CRATE_VERSION | |
- run: cargo risczero install --version $RISC0_TOOLCHAIN_VERSION | |
- name: build erc20 | |
run: cargo build | |
working-directory: examples/erc20 | |
- name: build erc20-Counter | |
run: cargo build | |
working-directory: examples/erc20-counter | |
- name: test erc20-Counter | |
run: ./test-local-deployment.sh | |
env: | |
BONSAI_API_URL: ${{ secrets.BONSAI_API_URL }} | |
BONSAI_API_KEY: ${{ secrets.BONSAI_API_KEY }} | |
working-directory: examples/erc20-counter | |
- run: sccache --show-stats | |
doc: | |
runs-on: [self-hosted, prod, macOS, cpu] | |
steps: | |
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842 | |
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :" | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: risc0/risc0/.github/actions/rustup@release-0.21 | |
- uses: risc0/foundry-toolchain@2fe7e70b520f62368a0e3c464f997df07ede420f | |
with: | |
version: nightly-09fe3e041369a816365a020f715ad6f94dbce9f2 | |
# TODO(#106) Re-enable sccache | |
# - uses: risc0/risc0/.github/actions/sccache@release-0.21 | |
# with: | |
# key: macOS-default | |
- run: cargo install --force --locked cargo-risczero@$RISC0_CRATE_VERSION | |
- run: cargo risczero install --version $RISC0_TOOLCHAIN_VERSION | |
- run: cargo doc --no-deps --workspace | |
- run: forge doc | |
#- run: sccache --show-stats | |
# Run as a separate job because we need to install a different set of tools. | |
# In particular, it uses nightly Rust and _does not_ install Forge or cargo risczero. | |
docs-rs: | |
runs-on: [self-hosted, prod, macOS, cpu] | |
steps: | |
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842 | |
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :" | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: risc0/risc0/.github/actions/rustup@release-0.21 | |
with: | |
# Building with docs.rs config requires the nightly toolchain. | |
toolchain: nightly | |
- run: cargo +nightly doc -p risc0-steel --all-features --no-deps | |
env: | |
RUSTDOCFLAGS: "--cfg docsrs -D warnings" | |
- run: cargo +nightly doc -p risc0-build-ethereum --all-features --no-deps | |
env: | |
RUSTDOCFLAGS: "--cfg docsrs -D warnings" |