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

Improve CI docs #405

Merged
merged 4 commits into from
Sep 1, 2022
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
75 changes: 74 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ jobs:
command: cd documentation/docs && mdbook build
cache_subkey: docs
cache_version: v1
- name: Build development docs
folder: documentation/dev
bucket: namada-dev-static-website
command: cargo run --bin namada_encoding_spec && cd documentation/dev && mdbook build
cache_subkey: dev
cache_version: v1

env:
CARGO_INCREMENTAL: 0
Expand All @@ -64,7 +70,6 @@ jobs:
# See comment in build-and-test.yml
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down Expand Up @@ -121,3 +126,71 @@ jobs:
- name: Stop sccache server
if: always()
run: sccache --stop-server || true

rust-docs:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]

env:
CARGO_INCREMENTAL: 0
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 100G
SCCACHE_BUCKET: namada-sccache-master

steps:
- name: Checkout repo
uses: actions/checkout@v3
if: ${{ github.event_name != 'pull_request_target' }}
- name: Checkout PR
uses: actions/checkout@v3
if: ${{ github.event_name == 'pull_request_target' }}
# See comment in build-and-test.yml
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::375643557360:role/anoma-github-action-ci-master
aws-region: eu-west-1
- name: Install sccache (ubuntu-latest)
if: matrix.os == 'ubuntu-latest'
env:
LINK: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: v0.3.0
run: |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
chmod +x $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install sccache (macos-latest)
if: matrix.os == 'macos-latest'
run: |
brew update
brew install sccache
- name: Setup rust toolchain
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
profile: default
override: true
- name: Setup rust nightly
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
toolchain: ${{ matrix.nightly_version }}
profile: default
- name: Show rust toolchain info
run: rustup show
- name: Start sccache server
run: sccache --start-server
- name: Build rust-docs
run: make build-doc
- name: Print sccache stats
if: always()
run: sccache --show-stats
- name: Stop sccache server
if: always()
run: sccache --stop-server || true
2 changes: 1 addition & 1 deletion documentation/dev/src/specs/encoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The encoding schemas below are described in terms of [Borsh specification](https

Note that "nil" corresponds to unit (`()`) which is encoded as empty bytes (nothing is being written).

<!--- The file included below is generated by the `encoding_spec` crate. To re-generate, run `cargo run --bin anoma_encoding_spec`. -->
<!--- The file included below is generated by the `encoding_spec` crate. To re-generate, run `cargo run --bin namada_encoding_spec`. -->

{{#include encoding/generated-borsh-spec.md}}

Expand Down
2 changes: 1 addition & 1 deletion documentation/specs/src/economics/proof-of-stake.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ with the intent of carrying out attacks. Many PoS blockcains rely on the 1/3 Byz
In blockchain systems we do not rely on altruistic behavior but rather economic
security. We expect the validators to execute the protocol correctly. They get rewarded for doing so and punished otherwise. Each validator has some self-stake and some stake that is delegated to it by other token holders. The validator and delegators share the reward and risk of slashing impact with each other.

The total stake behind consensus should be taken into account when value is transferred via a transaction. The total value transferred cannot exceed 2/3 of the total stake. For example, if we have 1 billion tokens, we aim that 300 Million of these tokens is backing validators. This means that users should not transfer more than 200 million of this token within a block.
The total stake behind consensus should be taken into account when value is transferred via a transaction. For example, if we have 1 billion tokens, we aim that 300 Million of these tokens is backing validators. This means that users should not transfer more than 200 million of this token within a block.
2 changes: 1 addition & 1 deletion encoding_spec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

This bin crate is used to derive encoding specifications from pre-selected public types via their `BorshSchema` implementations. The `BorshSchema` provides recursive definitions of all the used types and these are also included in the generated specification.

When executed, this crate will generate `docs/src/specs/encoding/generated-borsh-spec.md` (see `OUTPUT_PATH` in the source). This page is itself included in the `docs/src/specs/encoding.md` page.
When executed, this crate will generate `documentation/dev/src/specs/encoding/generated-borsh-spec.md` (see `OUTPUT_PATH` in the source). This page is itself included in the `documentation/dev/src/specs/encoding.md` page.
3 changes: 2 additions & 1 deletion encoding_spec/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use namada::types::{token, transaction};

/// This generator will write output into this `docs` file.
const OUTPUT_PATH: &str =
"documentation/docs/src/specs/encoding/generated-borsh-spec.md";
"documentation/dev/src/specs/encoding/generated-borsh-spec.md";

lazy_static! {
/// Borsh types may be used by declarations. These are displayed differently in the [`md_fmt_type`].
Expand Down Expand Up @@ -394,6 +394,7 @@ fn escape_fragment_anchor(string: impl AsRef<str>) -> String {
.replace('<', "")
.replace(',', "")
.replace(' ', "-")
.replace(':', "")
.to_ascii_lowercase()
}

Expand Down