adjust #9138
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint Clippy | |
on: | |
push: | |
concurrency: | |
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" | |
cancel-in-progress: true | |
permissions: | |
# Leaving clippy annotations on commits... | |
contents: write | |
# And on PRs | |
pull-requests: write | |
# Updating commit and PR statuses | |
checks: write | |
jobs: | |
lint-clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | |
- name: Get all test, doc and src files that have changed | |
id: changed-files-yaml | |
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c | |
with: | |
files_yaml: | | |
src: | |
- Dockerfile* | |
- Cargo.lock | |
- Cargo.toml | |
- deny.toml | |
- rust-toolchain.toml | |
- iris-*/** | |
# - .github/workflows/lint-clippy.yaml -- bring this back after Canonical incident | |
# remove this once the latest ubuntu image has been rolled out | |
- name: Fix APT mirror (working patch) | |
if: steps.changed-files-yaml.outputs.src_any_changed == 'true' | |
run: | | |
echo "Patching sources.list..." | |
sudo sed -i 's|mirror+file:/etc/apt/apt-mirrors.txt|http://archive.ubuntu.com/ubuntu|g' /etc/apt/sources.list | |
sudo apt-get clean | |
sudo apt-get update | |
- name: Cache Rust build | |
if: steps.changed-files-yaml.outputs.src_any_changed == 'true' | |
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 | |
id: cache-rust | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: rust-build-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
rust-build-${{ runner.os }}- | |
# The following steps will only run if any of the src files have changed | |
- name: Install Dependencies | |
if: steps.changed-files-yaml.outputs.src_any_changed == 'true' | |
run: sudo apt install protobuf-compiler | |
- name: Install Rust | |
if: steps.changed-files-yaml.outputs.src_any_changed == 'true' | |
run: rustup toolchain install 1.85.0 | |
- name: Set Rust as default | |
if: steps.changed-files-yaml.outputs.src_any_changed == 'true' | |
run: rustup default 1.85.0 | |
- name: Install Rust clippy for checking clippy errors | |
if: steps.changed-files-yaml.outputs.src_any_changed == 'true' | |
run: rustup component add clippy | |
- name: Clippy | |
if: steps.changed-files-yaml.outputs.src_any_changed == 'true' | |
run: cargo clippy --all-targets --all-features -- -D warnings --no-deps |