Skip to content

Update rust-library.yaml managed Github Workflow #20

Update rust-library.yaml managed Github Workflow

Update rust-library.yaml managed Github Workflow #20

Workflow file for this run

# Managed by infra via Terraform, edits will be lost
name: rust-lint
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
jobs:
rust-changes:
runs-on: ubuntu-latest
if: github.actor != 'bitdriftlabs-terraform[bot]'
permissions:
contents: read
pull-requests: read
outputs:
rust-changes: ${{ steps.rust-changes.outputs.any_changed }}
steps:
- if: github.event_name == 'push'
name: Checkout
uses: actions/checkout@v4
- uses: tj-actions/changed-files@v41
id: rust-changes
with:
files_ignore: |
.github/**
k8s/**
lint:
needs: rust-changes
if: needs.rust-changes.outputs.rust-changes == 'true' && github.actor != 'bitdriftlabs-terraform[bot]'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# Get a token that can be used for org read-only clones.
- name: org-read-only-install token
id: org-read-only
uses: getsentry/action-github-app-token@v2
with:
app_id: ${{ secrets.ORG_READ_ONLY_APP_ID }}
private_key: ${{ secrets.ORG_READ_ONLY_APP_PRIVATE_KEY }}
# Install the token so all ssh pulls are rewritten to use the token from the previous step.
- name: setup git credentials
uses: de-vri-es/setup-git-credentials@v2
with:
credentials: https://x-access-token:${{ steps.org-read-only.outputs.token }}@github.com/
- name: Cache
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43
- name: Rust Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: clippy
- name: Clippy
# Typically: cargo clippy --workspace --bins --examples --tests -- --no-deps
run: make clippy
fmt:
needs: rust-changes
if: needs.rust-changes.outputs.rust-changes == 'true' && github.actor != 'bitdriftlabs-terraform[bot]'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Rust Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
profile: minimal
components: rustfmt
- name: Fmt
run: cargo +nightly fmt --all --check