diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..53f118d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,65 @@ +name: "build" + +permissions: {} + +on: + pull_request: + +jobs: + build: + name: "cargo build" + permissions: + contents: read + strategy: + matrix: + runner: [ubuntu-22.04, windows-2022, macos-12] + runs-on: ${{ matrix.runner }} + steps: + - uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 + with: + egress-policy: audit + + - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + + - uses: ./.github/actions/setup-libmagic + + - id: toolchain + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # doesn't have usual versioned releases/tags + with: + toolchain: "1.54.0" # hardcoded crate MSRV, see rust-toolchain.toml etc. + # minimal profile includes rustc component which includes cargo and rustdoc + + - uses: rui314/setup-mold@354d1662b2a6f02e5eccc9712f22657621bf645b # does not have recent tags + + - uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0 + + - run: cargo +${{ steps.toolchain.outputs.name }} build --all-targets --all-features --verbose + + test: + name: "cargo test" + permissions: + contents: read + strategy: + matrix: + runner: [ubuntu-22.04, windows-2022, macos-12] + runs-on: ${{ matrix.runner }} + steps: + - uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 + with: + egress-policy: audit + + - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + + - uses: ./.github/actions/setup-libmagic + + - id: toolchain + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # doesn't have usual versioned releases/tags + with: + toolchain: "1.54.0" # hardcoded crate MSRV, see rust-toolchain.toml etc. + # minimal profile includes rustc component which includes cargo and rustdoc + + - uses: rui314/setup-mold@354d1662b2a6f02e5eccc9712f22657621bf645b # does not have recent tags + + - uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0 + + - run: cargo +${{ steps.toolchain.outputs.name }} test --all-targets --all-features --verbose diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml deleted file mode 100644 index 38952de..0000000 --- a/.github/workflows/linux.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Linux - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/setup-libmagic - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml deleted file mode 100644 index 6d78e90..0000000 --- a/.github/workflows/mac.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: macOS - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: macos-latest - - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/setup-libmagic - - name: install Rust MSRV - uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # v1.0.6 - with: - profile: minimal - # toolchain could be implicit from rust-toolchain.toml see https://github.com/actions-rs/toolchain#the-toolchain-file - # but this doesn't support .toml files - toolchain: "1.64.0" - override: true - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index 3c26075..0000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Windows - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: windows-latest - - steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/setup-libmagic - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose diff --git a/README.md b/README.md index e0ce6f8..9299294 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -rust-magic-sys [![linux build status](https://github.com/robo9k/rust-magic-sys/actions/workflows/linux.yml/badge.svg)](https://github.com/robo9k/rust-magic-sys/actions/workflows/linux.yml) [![windows build status](https://github.com/robo9k/rust-magic-sys/actions/workflows/windows.yml/badge.svg)](https://github.com/robo9k/rust-magic-sys/actions/workflows/windows.yml) [![mac build status](https://github.com/robo9k/rust-magic-sys/actions/workflows/mac.yml/badge.svg)](https://github.com/robo9k/rust-magic-sys/actions/workflows/mac.yml) +rust-magic-sys +[![build status](https://github.com/robo9k/rust-magic-sys/actions/workflows/build.yml/badge.svg)](https://github.com/robo9k/rust-magic-sys/actions/workflows/build.yml) ============== [Rust](https://www.rust-lang.org/f) declarations for [libmagic](https://www.darwinsys.com/file/).