Skip to content

Update source header in source files #3873

Update source header in source files

Update source header in source files #3873

Workflow file for this run

name: Rust CI
on:
push:
branches: ['**']
pull_request:
branches: ['**']
env:
CARGO_TERM_COLOR: always
jobs:
build:
if: |
github.event_name == 'workflow_dispatch' ||
(github.actor != 'github-actions[bot]' &&
github.actor != 'bythelindemans-actions-bot')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
actions: write
security-events: write
steps:
- name: Generate GitHub App Token
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ vars.BTL_ACTIONS_BOT_APP_ID }}
private_key: ${{ secrets.BTL_ACTIONS_BOT_PRIVATE_KEY }}
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ steps.generate_token.outputs.token }}
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
override: true
- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache Cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
- name: Run cargo fmt
run: cargo fmt --all
- name: Check if any files were formatted
id: changes
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "changes=true" >> $GITHUB_OUTPUT
else
echo "changes=false" >> $GITHUB_OUTPUT
fi
- name: Run Clippy
if: steps.changes.outputs.changes == 'false'
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Build
if: steps.changes.outputs.changes == 'false'
run: cargo build --verbose
- name: Run tests
if: steps.changes.outputs.changes == 'false'
run: cargo test --verbose
- name: Run cargo audit
if: steps.changes.outputs.changes == 'false'
uses: actions-rs/audit-check@v1
with:
token: ${{ steps.generate_token.outputs.token }}