Skip to content

Update Swatinem/rust-cache action to v2.7.7 #1466

Update Swatinem/rust-cache action to v2.7.7

Update Swatinem/rust-cache action to v2.7.7 #1466

Workflow file for this run

name: Rust
on:
push:
branches:
- main
tags:
- v*
pull_request:
env:
CARGO_INCREMENTAL: 0
jobs:
rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Get Rust toolchain
id: toolchain
run: |
awk -F'[ ="]+' '$1 == "channel" { print "toolchain=" $2 }' rust-toolchain >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.toolchain.outputs.toolchain }}
- name: cache dependencies
uses: Swatinem/rust-cache@720f7e45ccee46c12a7b1d7bed2ab733be9be5a1 # v2.7.6
- name: reviewdog / clippy
uses: sksat/action-clippy@04496073ad8af969ce7abd0ff14d863f25d7057d # v1.0.0
with:
reporter: github-pr-review
clippy_flags: --all-features
- name: unit test
run: cargo test
rustdoc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Get Rust toolchain
id: toolchain
run: |
awk -F'[ ="]+' '$1 == "channel" { print "toolchain=" $2 }' rust-toolchain >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.toolchain.outputs.toolchain }}
- name: cache dependencies
uses: Swatinem/rust-cache@720f7e45ccee46c12a7b1d7bed2ab733be9be5a1 # v2.7.6
- name: build rustdoc
run: |
cargo doc --no-deps
- name: add index.html
run: |
cat > ./target/doc/index.html << EOS
<meta http-equiv="refresh" content="1;URL=github_webhook">
EOS
- name: fix permissions
run: |
chmod -c -R +rX ./target/doc | while read -r line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: arcive rustdoc
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: ./target/doc
deploy-rustdoc-pages:
if: github.ref == 'refs/heads/main'
needs: rustdoc
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
semver:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: obi1kenobi/cargo-semver-checks-action@c7306483f698c511eaf7416d1bf2e1958c90140f # v2.4
msrv:
strategy:
fail-fast: false
matrix:
crate-path:
- github-webhook
- type-generator
- dts-downloader
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: cache dependencies
uses: Swatinem/rust-cache@720f7e45ccee46c12a7b1d7bed2ab733be9be5a1 # v2.7.6
- name: install cargo-msrv
run: |
cargo install cargo-msrv --version 0.16.0-beta.22 --locked
# cargo msrv --add-component is not working?
- name: install rustfmt manually
run: |
rustup toolchain install 1.70.0
rustup component add --toolchain 1.70.0-x86_64-unknown-linux-gnu rustfmt
- name: check MSRV
working-directory: ${{ matrix.crate-path }}
run: |
cargo msrv verify --log-target stdout