Skip to content

chore(deps): update taiki-e/install-action action to v2.65.15 #492

chore(deps): update taiki-e/install-action action to v2.65.15

chore(deps): update taiki-e/install-action action to v2.65.15 #492

name: "test-libmagic-version"
permissions: {}
on:
workflow_dispatch:
pull_request:
jobs:
build:
name: "cargo test && bindgen"
permissions:
contents: read
strategy:
matrix:
version: ["5.39", "5.40", "5.41", "5.42", "5.43", "5.44", "5.45", "5.46"]
fail-fast: false
runs-on: ubuntu-24.04
steps:
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- run: |
sudo apt-get update
sudo apt-get install automake gcc libtool make python3 zlib1g-dev llvm-dev libclang-dev clang
- id: tarball
run: |
echo "file=$(mktemp '${{ runner.temp }}/file-${{ matrix.version }}-XXX.tgz')" >> "${GITHUB_OUTPUT}"
shasum=$(./.github/libmagic-version-to-shasum.sh "${LIBMAGIC_VERSION}")
echo "shasum=${shasum}" >> "${GITHUB_OUTPUT}"
env:
LIBMAGIC_VERSION: ${{ matrix.version }}
- run: curl --output '${{ steps.tarball.outputs.file }}' 'https://astron.com/pub/file/file-${{ matrix.version }}.tar.gz'
- run: echo "${TARBALL_SHASUM} ${TARBALL_FILE}" | sha512sum --check --status
env:
TARBALL_SHASUM: ${{ steps.tarball.outputs.shasum }}
TARBALL_FILE: ${{ steps.tarball.outputs.file }}
- id: release
run: |
DIR="$(mktemp --directory '${{ runner.temp }}/file-${{ matrix.version }}-release-XXX')"
tar --directory "${DIR}" --strip-components=1 -xzf '${{ steps.tarball.outputs.file }}'
echo "dir=${DIR}" >> "${GITHUB_OUTPUT}"
feature=$(./.github/libmagic-version-to-crate-feature.sh "${LIBMAGIC_VERSION}")
echo "feature=${feature}" >> "${GITHUB_OUTPUT}"
env:
LIBMAGIC_VERSION: ${{ matrix.version }}
- id: prefix
run: |
DIR="$(mktemp --directory '${{ runner.temp }}/file-${{ matrix.version }}-prefix-XXX')"
echo "dir=${DIR}" >> "${GITHUB_OUTPUT}"
- run: |
cd '${{ steps.release.outputs.dir }}'
autoreconf -f -i
./configure --disable-silent-rules --prefix='${{ steps.prefix.outputs.dir }}' --enable-static
make
make install
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: file-${{ matrix.version }}
path: |
${{ steps.prefix.outputs.dir }}/include/
${{ steps.prefix.outputs.dir }}/lib/pkgconfig/
${{ steps.prefix.outputs.dir }}/share/misc/
- run: echo "PKG_CONFIG_PATH=${{ steps.prefix.outputs.dir }}/lib/pkgconfig" >> "${GITHUB_ENV}"
- id: toolchain
uses: dtolnay/rust-toolchain@6d653acede28d24f02e3cd41383119e8b1b35921 # doesn't have usual versioned releases/tags
with:
toolchain: "1.88.0" # current pinned stable
# minimal profile includes rustc component which includes cargo and rustdoc
components: "rustfmt"
- uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # does not have recent tags
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
- run: cargo build --verbose --verbose --locked --all-targets --features "${CRATE_LIBMAGIC_VERSION_FEATURE}"
env:
RUSTUP_TOOLCHAIN: ${{ steps.toolchain.outputs.name }}
CRATE_LIBMAGIC_VERSION_FEATURE: ${{ steps.release.outputs.feature }}
- run: cargo test --locked --all-targets --features "${CRATE_LIBMAGIC_VERSION_FEATURE}" --verbose
env:
RUSTUP_TOOLCHAIN: ${{ steps.toolchain.outputs.name }}
CRATE_LIBMAGIC_VERSION_FEATURE: ${{ steps.release.outputs.feature }}
- run: |
cd systest
cargo run --features "${CRATE_LIBMAGIC_VERSION_FEATURE}"
env:
RUSTUP_TOOLCHAIN: ${{ steps.toolchain.outputs.name }}
CRATE_LIBMAGIC_VERSION_FEATURE: ${{ steps.release.outputs.feature }}
- uses: taiki-e/install-action@271014ec0fe73d05f4206c04b4392ad895d8f0e3 # v2.62.66
with:
# renovate: taiki-e/install-action
tool: bindgen-cli@0.72.0
- id: bindings
run: |
DIR="$(mktemp --directory '${{ runner.temp }}/file-${{ matrix.version }}-bindings-XXX')"
echo "dir=${DIR}" >> "${GITHUB_OUTPUT}"
# bindgen doesn't exactly match crate MSRV
- run: >
bindgen
--use-core
--no-size_t-is-usize
--allowlist-file '${{ steps.prefix.outputs.dir }}/include/magic.h'
--opaque-type 'magic_set'
--no-copy 'magic_set'
--rust-target '1.64.0'
--output '${{ steps.bindings.outputs.dir }}/bindings.rs'
'${{ steps.prefix.outputs.dir }}/include/magic.h'
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: bindgen-${{ matrix.version }}
path: |
${{ steps.bindings.outputs.dir }}/bindings.rs