-
Notifications
You must be signed in to change notification settings - Fork 63
147 lines (131 loc) · 4.2 KB
/
tests.yaml
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Tests
on:
pull_request:
types: [ opened, reopened, synchronize, ready_for_review ]
push:
jobs:
test:
name: Test
env:
CARGO_TERM_COLOR: always
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: true
matrix:
build:
- msrv
- stable
- nightly
- macos
- win-msvc
# - win-gnu
- no-default-features
- protoc
- linux-32
include:
- build: msrv
os: ubuntu-latest
rust: 1.82.0
target: x86_64-unknown-linux-gnu
args: "--features=magic-module,rules-profiling"
rust_flags: "-Awarnings"
experimental: false
- build: stable
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
args: "--features=magic-module,rules-profiling"
rust_flags: "-Awarnings"
experimental: false
- build: nightly
os: ubuntu-latest
rust: nightly
target: x86_64-unknown-linux-gnu
args: "--features=magic-module,rules-profiling"
# Link is currently failing with rust-lld (rust-lang/rust#124129)
# Disable rust-lld with -Zlinker-features=-lld
# See: https://github.com/dtolnay/linkme/commit/d13709bfd2c1278b4c8b6c846e2017b623923c0c
rust_flags: "-Awarnings -Zlinker-features=-lld"
experimental: true
- build: macos
os: macos-latest
rust: stable
target: aarch64-apple-darwin
args: "--features=rules-profiling"
rust_flags: "-Awarnings"
experimental: false
- build: win-msvc
os: windows-latest
rust: stable
target: x86_64-win7-windows-msvc
args: "--features=rules-profiling"
rust_flags: "-Awarnings"
experimental: false
# Tests for the `stable-x86_64-pc-windows-gnu` toolchain disabled
# due to https://github.com/VirusTotal/yara-x/issues/29
#
# - build: win-gnu
# os: windows-latest
# target: x86_64-win7-windows-gnu
# rust: stable-x86_64-gnu
# args: ""
- build: no-default-features
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
args: "--package yara-x --no-default-features --features=test_proto2-module,test_proto3-module,string-module,time-module,hash-module,macho-module,magic-module,math-module,lnk-module,elf-module,pe-module,dotnet-module,console-module"
rust_flags: "-Awarnings"
experimental: false
- build: protoc
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
args: "--package yara-x --features=protoc,magic-module"
rust_flags: "-Awarnings"
experimental: false
- build: 32bits
os: ubuntu-latest
rust: stable
target: i686-unknown-linux-gnu
args: ""
rust_flags: "-Awarnings"
experimental: false
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libmagic-dev gcc-multilib
- name: Install protoc
if: matrix.build == 'protoc'
run: |
sudo apt-get install -y protobuf-compiler
cargo install protobuf-codegen
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
- name: Build
run: cargo build --all-targets ${{ matrix.args }}
env:
RUSTFLAGS: ${{ matrix.rust_flags }}
- name: Run tests
run: cargo test --all-targets ${{ matrix.args }}
env:
RUSTFLAGS: ${{ matrix.rust_flags }}
- name: Run doc tests
run: cargo test --doc
env:
RUSTDOCFLAGS: ${{ matrix.rust_flags }}