Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add pre-commit and pre-push hooks, implement security audit workflow,… #52

Add pre-commit and pre-push hooks, implement security audit workflow,…

Add pre-commit and pre-push hooks, implement security audit workflow,… #52

Workflow file for this run

name: Test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Check formatting
run: cargo fmt --check
- name: Check clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
test-musl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- name: Install Cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-musl-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-musl-cargo-
- name: Build MUSL binary
run: |
OPENSSL_STATIC=1 \
LIBZ_SYS_STATIC=1 \
BZIP2_STATIC=1 \
ZSTD_STATIC=1 \
LZMA_API_STATIC=1 \
CURL_STATIC=1 \
CC_x86_64_unknown_linux_musl=musl-gcc \
CXX_x86_64_unknown_linux_musl=musl-g++ \
cross build --target x86_64-unknown-linux-musl --verbose
- name: Run tests on MUSL
run: |
OPENSSL_STATIC=1 \
LIBZ_SYS_STATIC=1 \
BZIP2_STATIC=1 \
ZSTD_STATIC=1 \
LZMA_API_STATIC=1 \
CURL_STATIC=1 \
CC_x86_64_unknown_linux_musl=musl-gcc \
CXX_x86_64_unknown_linux_musl=musl-g++ \
cross test --target x86_64-unknown-linux-musl --verbose
- name: Verify binary is static
run: |
file target/x86_64-unknown-linux-musl/debug/STRdust
ldd target/x86_64-unknown-linux-musl/debug/STRdust || echo "Static binary confirmed"