Skip to content

Merge branch 'fraccaman/ci-minors' (#1719) #5755

Merge branch 'fraccaman/ci-minors' (#1719)

Merge branch 'fraccaman/ci-minors' (#1719) #5755

Workflow file for this run

name: Build docs
on:
push:
branches:
- main
# Run in PRs with conflicts (https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request)
pull_request_target:
types: [opened, synchronize, reopened]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
id-token: write
contents: read
env:
GIT_LFS_SKIP_SMUDGE: 1
jobs:
docs:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
nightly_version: [nightly-2023-06-01]
mdbook_version: [rust-lang/[email protected]]
mdbook_mermaid: [badboy/[email protected]]
mdbook_linkcheck: [Michael-F-Bryan/[email protected]]
mdbook_open_on_gh: [badboy/[email protected]]
mdbook_admonish: [tommilligan/[email protected]]
mdbook_katex: [lzanini/[email protected]]
mdbook_pagetoc: [slowsage/[email protected]]
make:
- 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
distribution_id: E6XPP5KFWXJFQ
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 Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install sccache (ubuntu-20.04)
if: matrix.os == 'ubuntu-20.04'
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: Install cargo tool
run: |
curl -k https://installer.heliax.click/${{ matrix.mdbook_version }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_mermaid }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_linkcheck }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_open_on_gh }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_admonish }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_katex }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_pagetoc }}! | bash
cd ${{ matrix.make.folder }} && mdbook-admonish install
- name: ${{ matrix.make.name }}
run: ${{ matrix.make.command }}
- name: Zip doc folder
run: tar -cvf ${{ matrix.make.bucket }}.tar ${{ matrix.make.folder }}/book
- name: Upload rendered docs
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.make.bucket }}-${{ github.event.pull_request.head.sha || github.sha }}
path: ${{ matrix.make.bucket }}.tar
- name: Publish docs
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: aws s3 sync ${{ matrix.make.folder }}/book/html/ s3://${{ matrix.make.bucket }} --region eu-west-1 --delete
- name: Invalidate distribution cache
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: aws cloudfront create-invalidation --distribution-id ${{ matrix.make.distribution_id }} --paths "/*"
- name: Print sccache stats
if: always()
run: sccache --show-stats
- name: Stop sccache server
if: always()
run: sccache --stop-server || true
rust-docs:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
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 Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install sccache (ubuntu-20.04)
if: matrix.os == 'ubuntu-20.04'
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