ci: restrict permissions granted to Github token #222
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: sqlformat | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| build-test-unix: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| conf: | |
| - minimum | |
| - latest-stable | |
| - latest-beta | |
| - latest-nightly | |
| include: | |
| - conf: minimum | |
| toolchain: 1.84.0 | |
| - conf: latest-stable | |
| toolchain: stable | |
| - conf: latest-beta | |
| toolchain: beta | |
| - conf: latest-nightly | |
| toolchain: nightly | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install ${{ matrix.toolchain }} | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ matrix.toolchain }} | |
| components: clippy, rustfmt | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry/cache | |
| key: ${{ runner.os }}-${{ matrix.conf }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.conf }}-cargo-registry- | |
| - name: Run rustfmt | |
| if: matrix.toolchain == 'stable' | |
| run: | | |
| cargo fmt --all -- --check | |
| - name: Run clippy | |
| if: matrix.toolchain == 'stable' | |
| uses: actions-rs-plus/clippy-check@v2.3.0 | |
| with: | |
| args: --all -- -D warnings | |
| - name: Run tests | |
| run: cargo test | |
| - name: Build docs | |
| run: cargo doc --no-deps |