-
-
Notifications
You must be signed in to change notification settings - Fork 710
78 lines (66 loc) · 2.6 KB
/
run-tests.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
name: CI Test for GEF
on:
push:
branches:
- master
- dev
pull_request:
branches:
- master
- dev
jobs:
build:
name: "Run Unit tests"
runs-on: [ubuntu-20.04]
defaults:
run:
shell: bash
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Cache trinity libs
uses: actions/cache@v2
id: cache-libs
env:
cache-name: cache-trinity-libs-and-python-modules
with:
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('/usr/local/lib/libkeystone.so.0', '/usr/lib/libcapstone.a', '/usr/lib64/libunicorn.a') }}
path: |
~/.cache/trinity-libs.tar.xz
~/.cache/pip
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Refresh environment
run: |
sudo apt-get update
sudo apt-get install -y gdb-multiarch python3-dev python3-pip python3-wheel python3-setuptools git cmake gcc g++ pkg-config libglib2.0-dev
- name: Compile Capstone/Keystone/Unicorn and install Python modules
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
mkdir -p ~/.cache/pip || echo ok
wget -O /tmp/update-trinity.sh https://github.com/hugsy/stuff/raw/master/update-trinity.sh
chmod +x /tmp/update-trinity.sh
python3 -c 'import capstone, keystone, unicorn' || /tmp/update-trinity.sh
sudo tar --ignore-failed-read -cJf ~/.cache/trinity-libs.tar.xz /usr/include/capstone /usr/lib/libcapstone* /usr/local/lib/python3.9/site-packages/capstone* /usr/local/lib/python3.8/site-packages/capstone* /usr/local/include/keystone /usr/local/lib/libkeystone* /usr/local/lib/python3.9/dist-packages/keystone* /usr/local/lib/python3.8/dist-packages/keystone* /usr/include/unicorn /usr/lib64/libunicorn* /usr/local/lib/python3.9/dist-packages/unicorn* /usr/local/lib/python3.8/dist-packages/unicorn*
- name: Restore Capstone/Keystone/Unicorn
if: steps.cache-libs.outputs.cache-hit == 'true'
run: |
sudo cp -v ~/.cache/trinity-libs.tar.xz /
cd /
sudo tar -vxJf ./trinity-libs.tar.xz
- name: Install Python optional modules
run: |
python3 -m pip install --user --upgrade -r ./requirements.txt
- name: Setup GEF
run: |
echo "source $(pwd)/gef.py" > ~/.gdbinit
gdb -q -ex 'gef missing' -ex 'gef help' -ex 'gef config' -ex start -ex continue -ex quit /bin/pwd
- name: Run linter
run: |
make lint
- name: Run Tests
run: |
make test