Skip to content

ci: add required permissions for gh pages deployment #135

ci: add required permissions for gh pages deployment

ci: add required permissions for gh pages deployment #135

Workflow file for this run

name: CI
permissions:
contents: read
on:
pull_request:
push:
branches:
- main
env:
CARGO_TERM_COLOR: always
CLICOLOR: 1
jobs:
check:
name: cargo check
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Install rust
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: cargo check
run: cargo check
fmt:
name: cargo fmt
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Install rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: cargo fmt -- --check
run: cargo fmt -- --check
clippy:
name: cargo clippy
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Install rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: cargo clippy --all-features -- -D warnings
run: cargo clippy --all-features -- -D warnings
test:
name: cargo test
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Install rust
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: cargo test
run: cargo test
- name: cargo test --all-features
run: cargo test --all-features
doc:
name: cargo doc
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Install rust
uses: dtolnay/rust-toolchain@stable
with:
components: rust-docs
- uses: Swatinem/rust-cache@v2
- name: cargo doc --no-deps --all-features
run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: -D warnings
doc-nightly-and-deploy:
name: cargo +nightly doc
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Install rust
uses: dtolnay/rust-toolchain@nightly
with:
components: rust-docs
- uses: Swatinem/rust-cache@v2
- name: cargo +nightly doc --no-deps --all-features
run: cargo +nightly doc --no-deps --all-features
env:
RUSTDOCFLAGS: --cfg docsrs -D warnings
# publish to GitHub Pages
- name: Move files
if: github.ref == 'refs/heads/main'
shell: bash
run: |
mkdir -p ./docs/main
mv ./target/doc/* ./docs/main/
- name: Deploy docs
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./docs
allow_empty_commit: false
keep_files: true