Skip to content

Commit

Permalink
doc: generate cargo docs on github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
delehef committed Aug 13, 2024
1 parent aacbe4f commit 92edeef
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 39 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

# Controls when the workflow will run
on:
pull_request:
push:
branches: [ "main" ]

name: Generate cargo docs

jobs:
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Configure cache
uses: Swatinem/rust-cache@v2
- name: Setup pages
id: pages
uses: actions/configure-pages@v4
- name: Clean docs folder
run: cargo clean --doc
- name: Build docs
run: cargo doc --no-deps
- name: Add redirect
run: echo '<meta http-equiv="refresh" content="0;url=aoc/index.html">' > target/doc/index.html
- name: Remove lock file
run: rm target/doc/.lock
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: target/doc

deploy:
name: Deploy
runs-on: ubuntu-latest
needs: docs
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
79 changes: 40 additions & 39 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,43 +28,44 @@ jobs:
command: fmt
args: --all -- --check

check:
name: Check
runs-on: ubuntu-latest
steps:
- run: sudo apt-get update && sudo apt-get install -yq pkg-config libssl-dev
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: ~1.20
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2024-05-17
override: true
- uses: actions-rs/cargo@v1
with:
command: check
# check:
# name: Check
# runs-on: ubuntu-latest
# steps:
# - run: sudo apt-get update && sudo apt-get install -yq pkg-config libssl-dev
# - uses: actions/checkout@v2
# - uses: actions/setup-go@v3
# with:
# go-version: ~1.20
# - uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: nightly-2024-05-17
# override: true
# - uses: actions-rs/cargo@v1
# with:
# command: check

test:
name: Test Suite
runs-on: nix-128g
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Generate a random port number
run: echo PGSQL_PORT=$(shuf -i 5000-30000 -n1) > .env
- name: Install foundry
shell: devenv shell bash -- -e {0}
run: cargo install --root ${HOME}/.cargo --git https://github.com/foundry-rs/foundry --rev c4a984f forge anvil
- name: Put cargo in PATH
shell: devenv shell bash -- -e {0}
run: echo "${HOME}/.cargo/bin" >> $GITHUB_PATH
- name: Run cargo test
run: devenv test
env:
RUST_LOG: "info"
RUST_MIN_STACK: 10485760
CI_RPC_URL: ${{ secrets.CI_RPC_URL }}
CI_SEPOLIA: ${{ secrets.CI_SEPOLIA }}
CI_ETH: ${{ secrets.CI_ETH }}

# test:
# name: Test Suite
# runs-on: nix-128g
# steps:
# - name: Checkout sources
# uses: actions/checkout@v4
# - name: Generate a random port number
# run: echo PGSQL_PORT=$(shuf -i 5000-30000 -n1) > .env
# - name: Install foundry
# shell: devenv shell bash -- -e {0}
# run: cargo install --root ${HOME}/.cargo --git https://github.com/foundry-rs/foundry --rev c4a984f forge anvil
# - name: Put cargo in PATH
# shell: devenv shell bash -- -e {0}
# run: echo "${HOME}/.cargo/bin" >> $GITHUB_PATH
# - name: Run cargo test
# run: devenv test
# env:
# RUST_LOG: "info"
# RUST_MIN_STACK: 10485760
# CI_RPC_URL: ${{ secrets.CI_RPC_URL }}
# CI_SEPOLIA: ${{ secrets.CI_SEPOLIA }}
# CI_ETH: ${{ secrets.CI_ETH }}

0 comments on commit 92edeef

Please sign in to comment.