Skip to content

Attempt to fix docrs in CI #1420

Attempt to fix docrs in CI

Attempt to fix docrs in CI #1420

Workflow file for this run

name: Documentation
on:
push:
branches: [ main ]
paths-ignore:
- '*.md'
- 'docker/**'
- 'docker_scylla/**'
- 'configuration/**'
- 'kubernetes/**'
- 'scripts/**'
pull_request:
branches:
- "**"
workflow_dispatch:
# This allows a subsequently queued workflow run to interrupt previous runs on pull-requests
concurrency:
group: '${{ github.workflow }} ${{ github.ref }}'
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
RUSTFLAGS: "-D warnings"
RUSTUP_MAX_RETRIES: 10
LINERA_PACKAGES: "packages.txt"
permissions:
contents: read
jobs:
test-crates-and-docrs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable, nightly
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install cargo tools
run: |
cargo install --locked cargo-index
# TODO(#2338): Remove the pinned Git URL and revision
cargo install --locked cargo-local-registry --git https://github.com/dhovart/cargo-local-registry --rev 2b20904a
- name: Setup git committer information
run: |
git config --global user.email "ci@linera.io"
git config --global user.name "CI"
- name: Generate packages
run: |
scripts/test_publish.sh "$LINERA_PACKAGES" ${{ runner.temp }}/registry
- name: Extract SDK version
run: |
VERSION=$(REGEXP='version = "(.*)"'; grep -A 1 '\[workspace\.package\]' Cargo.toml | while read I; do if [[ $I =~ $REGEXP ]]; then echo "${BASH_REMATCH[1]}"; fi; done)
echo "Found SDK version $VERSION"
echo "SDK_VERSION=$VERSION" >> "$GITHUB_ENV"
- name: Extract packaged crates
run: |
cd "${{ runner.temp }}/registry"
grep -v '^#' "$GITHUB_WORKSPACE/$LINERA_PACKAGES" | while read LINE; do
CRATE="${LINE%% *}"
tar -xzvf ${CRATE}-${SDK_VERSION}.crate
done
- name: Checkout docs.rs tool repository
run: |
cd ${{ runner.temp }}
git clone https://github.com/ma2bd/docs.rs docsrs
cd docsrs
git submodule update --init
- name: Build documentation using docs.rs
run: |
cd ${{ runner.temp }}/docsrs
cp .env.sample .env
mkdir -p ignored/cratesfyi-prefix/crates.io-index
. .env
SQLX_OFFLINE=1 cargo build
docker compose up -d db s3
sleep 10
psql "${DOCSRS_DATABASE_URL}"
cargo run -- database migrate
grep -v ^# "$GITHUB_WORKSPACE/$LINERA_PACKAGES" | while read LINE; do
CRATE="${LINE%% *}"
cargo run -- build crate --local ${{ runner.temp }}/registry/${CRATE}-${SDK_VERSION}/
done