-
Notifications
You must be signed in to change notification settings - Fork 9
165 lines (162 loc) · 5.55 KB
/
test.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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Rust
on:
push:
branches: [ "master" ]
pull_request:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Install YARA deps
run: sudo apt-get install -y automake libtool make gcc pkg-config libssl-dev libjansson-dev libmagic-dev
- name: Build YARA
run: |
cd yari-sys/yara
./bootstrap.sh
CFLAGS="-fPIC" ./configure --enable-debug --disable-shared --enable-static --enable-cuckoo --enable-magic --enable-dotnet --with-crypto
make
- name: Build
run: cargo build
- name: Run Rust tests
run: cargo test
- name: Run tests with yari using bundled bindings
run: |
cargo clean
YARI_USE_BUNDLED_BINDINGS=1 cargo test
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Run Python tests
run: |
cd yari-py
pip install --upgrade pip
python -m venv env
. env/bin/activate
pip install maturin pytest
maturin develop
pytest tests
build-macos:
runs-on: macos-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Install YARA deps
run: brew install autoconf automake libtool pkg-config jansson libmagic openssl [email protected] [email protected] [email protected]
- name: Build Yara
run: |
cd yari-sys/yara
./bootstrap.sh
CFLAGS="-fPIC -I$(brew --prefix)/include" LDFLAGS="-L$(brew --prefix)/lib $LDFLAGS" LIBRARY_PATH="$(brew --prefix)/lib:$LIBRARY_PATH" ./configure --enable-debug --disable-shared --enable-static --enable-cuckoo --enable-magic --enable-dotnet --with-crypto
make
- name: Build Yari (yari-sys)
run: cd yari-sys && CFLAGS="-I$(brew --prefix)/include" LDFLAGS="-L$(brew --prefix)/lib $LDFLAGS" LIBRARY_PATH="$(brew --prefix)/lib:$LIBRARY_PATH" cargo build --release
- name: Build Yari (yari-cli)
run: cd yari-cli && CFLAGS="-I$(brew --prefix)/include" LDFLAGS="-L$(brew --prefix)/lib $LDFLAGS" LIBRARY_PATH="$(brew --prefix)/lib:$LIBRARY_PATH" cargo build --release
- name: Run Rust tests
run: CFLAGS="-I$(brew --prefix)/include" LDFLAGS="-L$(brew --prefix)/lib $LDFLAGS" LIBRARY_PATH="$(brew --prefix)/lib:$LIBRARY_PATH" cargo test
- name: Run Rust tests with bundled bindings
run: |
cargo clean
YARI_USE_BUNDLED_BINDINGS=1 CFLAGS="-I$(brew --prefix)/include" LDFLAGS="-L$(brew --prefix)/lib $LDFLAGS" LIBRARY_PATH="$(brew --prefix)/lib:$LIBRARY_PATH" cargo test
- name: Run Python tests
run: |
cd yari-py
python3.12 -m venv .venv
.venv/bin/pip install maturin pytest
CFLAGS="-I$(brew --prefix)/include" LDFLAGS="-L$(brew --prefix)/lib $LDFLAGS" LIBRARY_PATH="$(brew --prefix)/lib:$LIBRARY_PATH" .venv/bin/maturin build -i python3.10 -i python3.11 -i python3.12
.venv/bin/maturin build
.venv/bin/maturin develop
.venv/bin/pytest
build-windows:
runs-on: windows-latest
steps:
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: List Windows SDK versions
run: dir "C:\Program Files (x86)\Windows Kits\10\Include"
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Install YARA deps
run: |
cd yari-sys/yara
nuget.exe restore .\windows\vs2017\yara.sln
- name: Build YARA
run: |
cd yari-sys/yara
msbuild /m /p:Platform=x64 /p:Configuration=Release /p:PlatformToolset="v142" /p:WindowsTargetPlatformVersion="10.0.22621.0" windows\vs2017\yara.sln
- name: Build Yari (yari-sys)
run: |
cd yari-sys
cargo build
cargo test
- name: Build Yari (yari-cli)
run: |
cd yari-cli
cargo build
cargo test
- uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Run Python tests
run: |
cd yari-py
pip install --upgrade pip
python -m venv env
. env/Scripts/activate
pip install maturin pytest
maturin develop
pytest tests
build1-windows:
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: |
3.8
3.9
3.10
3.11
- name: Setup Nuget.exe
uses: nuget/setup-nuget@v1
with:
nuget-version: 'latest'
- name: Setup msbuild
uses: microsoft/[email protected]
- name: Install YARA Dependencies
run: nuget.exe restore windows/vs2017/yara.sln
working-directory: ./yari-sys/yara
- name: Build YARA
run: msbuild /m /p:Platform=x64 /p:Configuration=Release /p:PlatformToolset="v142" /p:WindowsTargetPlatformVersion="10.0.19041.0" windows/vs2017/yara.sln
working-directory: ./yari-sys/yara
shell: cmd
- name: Build yari-sys
run: cargo build
working-directory: ./yari-sys
- name: Build Python wheels
run: |
pip install maturin
maturin build -f --release --strip
working-directory: ./yari-py
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: Windows python wheels
path: target/wheels/*.whl