-
Notifications
You must be signed in to change notification settings - Fork 6
96 lines (77 loc) · 3.13 KB
/
test-libmagic-version.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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"
runs-on: ubuntu-22.04
steps:
- uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- run: |
sudo apt-get update
sudo apt-get install automake gcc libtool make python3 zlib1g-dev llvm-dev libclang-dev clang
- run: curl --output file-${{ matrix.version }}.tgz https://astron.com/pub/file/file-${{ matrix.version }}.tar.gz
- run: tar -xzf file-${{ matrix.version }}.tgz
- id: prefix
run: |
mkdir _prefix
echo "dir=$(readlink -f _prefix)" >> "${GITHUB_OUTPUT}"
- run: |
cd file-${{ matrix.version }}
autoreconf -f -i
./configure --disable-silent-rules --prefix=${{ steps.prefix.outputs.dir }} --enable-static
make
make install
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
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@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
components: "rustfmt"
- 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
- uses: taiki-e/install-action@47d27149ff6b3422864ec504071d5cc7873d642e # v2.20.3
with:
tool: [email protected]
# 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.47'
--output 'bindings.rs'
'${{ steps.prefix.outputs.dir }}/include/magic.h'
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: bindgen-${{ matrix.version }}
path: |
bindings.rs