Skip to content

Commit

Permalink
ci: Unify and update build workflow
Browse files Browse the repository at this point in the history
Signed-off-by: robot9001 <[email protected]>
  • Loading branch information
robo9k committed Oct 7, 2023
1 parent d7c18f8 commit 63c410f
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 78 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
23 changes: 0 additions & 23 deletions .github/workflows/linux.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/mac.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/windows.yml

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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/).
Expand Down

0 comments on commit 63c410f

Please sign in to comment.