Skip to content

ci: Attempt to actually fix clippy in CI since sarif doesn't seem to … #247

ci: Attempt to actually fix clippy in CI since sarif doesn't seem to …

ci: Attempt to actually fix clippy in CI since sarif doesn't seem to … #247

Workflow file for this run

name: Build
permissions:
contents: read
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
modern-default:
# Test modern compilers on standard platforms on Linux.
name: "Test: ${{ matrix.target }}, Rust ${{ matrix.rust }} (default configuration)"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- armv7-unknown-linux-gnueabihf
- armv7-unknown-linux-musleabihf
- i686-unknown-linux-gnu
- i686-unknown-linux-musl
- x86_64-pc-windows-gnu
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
rust:
- stable
- nightly
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup install --profile minimal ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Install cross
uses: taiki-e/install-action@cross
- name: Cache builds
uses: Swatinem/rust-cache@v2.7.1
with:
key: ${{ matrix.target }}
- name: Cross compile
run: cross build --locked --target ${{ matrix.target }} --verbose
- name: Cross test
run: cross test --locked --target ${{ matrix.target }} --verbose
- name: Compress binary
if: matrix.rust == 'stable' && matrix.target != 'x86_64-pc-windows-gnu'
run: zstd -T0 -6 target/${{ matrix.target }}/debug/chezmoi_modify_manager
- uses: actions/upload-artifact@v3
if: matrix.rust == 'stable' && matrix.target != 'x86_64-pc-windows-gnu'
with:
name: chezmoi_modify_manager_${{ matrix.target }}.zst
path: target/${{ matrix.target }}/debug/chezmoi_modify_manager.zst
retention-days: 7
configurations:
# Test non-standard configurations, MSRV and Rust versions
name: "Test: \"${{ matrix.features }}\" (Linux), Rust ${{ matrix.rust }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features:
- --no-default-features
- --no-default-features --features=updater-tls-native
- --no-default-features --features=updater-tls-native-vendored
- --no-default-features --features=updater-tls-rusttls
rust:
- 1.70.0
- stable
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup install --profile minimal ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Cache builds
uses: Swatinem/rust-cache@v2.7.1
with:
save-if: ${{ matrix.features == '--no-default-features --features=updater-tls-native-vendored' }}
- name: Compile and test
run: cargo test --locked ${{ matrix.features }} --verbose
exotic-linux:
# Test exotic Linux configs that only work with vendored OpenSSL
name: "Test: ${{ matrix.target }}, Rust ${{ matrix.rust }} (vendored OpenSSL)"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- i586-unknown-linux-gnu
- powerpc-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu
rust:
- stable
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup install --profile minimal ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Install cross
uses: taiki-e/install-action@cross
- name: Cache builds
uses: Swatinem/rust-cache@v2.7.1
with:
key: ${{ matrix.target }}
- name: Cross compile and test
run: cross test --locked --no-default-features --features=updater-tls-native-vendored --target ${{ matrix.target }} --verbose
exotic-os:
# Test native builds on non-Linux platforms
name: "Test: ${{ matrix.target }} on ${{ matrix.os }} with stable rust"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-msvc
os: windows-latest
suffix: .exe
- target: x86_64-apple-darwin
os: macos-latest
suffix:
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup install --profile minimal stable && rustup default stable
- name: Cache builds
uses: Swatinem/rust-cache@v2.7.1
- name: Compile
run: cargo build --locked --target ${{ matrix.target }} --verbose
- name: Test
run: cargo test --locked --target ${{ matrix.target }} --verbose
- name: Compress binary
run: zstd -T0 -6 target/${{ matrix.target }}/debug/chezmoi_modify_manager${{ matrix.suffix }}
- uses: actions/upload-artifact@v3
with:
name: chezmoi_modify_manager_${{ matrix.target }}.zst
path: target/${{ matrix.target }}/debug/chezmoi_modify_manager${{ matrix.suffix }}.zst
retention-days: 7
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup install --profile minimal stable && rustup default stable && rustup component add rustfmt
- run: cargo fmt -- --check