-
-
Notifications
You must be signed in to change notification settings - Fork 4
159 lines (154 loc) · 4.54 KB
/
ci.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
# TODO: add windows
name: ci
env:
R2V: 5.9.4
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
build-linux20:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Installing radare2
run: |
wget "https://github.com/radareorg/radare2/releases/download/${R2V}/radare2_${R2V}_amd64.deb"
wget "https://github.com/radareorg/radare2/releases/download/${R2V}/radare2-dev_${R2V}_amd64.deb"
sudo dpkg -i "radare2_${R2V}_amd64.deb"
sudo dpkg -i "radare2-dev_${R2V}_amd64.deb"
- name: Installing yara via r2pm
run: r2pm -Ui yara
- name: Building with meson
run: |
sudo apt install meson
r2pm -ci ninja
r2pm -r meson b
r2pm -r ninja -C b
- name: Building r2yara
run: |
r2pm -r ./configure
r2pm -r make -j
make user-install
- name: Packaging
run: make -C dist/debian
- name: Pub
uses: actions/upload-artifact@v4
with:
name: build-linux
path: dist/debian/*.deb
build-linux22:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
repository: radareorg/radare2
ref: master
path: ./radare2
- name: Installing radare2
run: |
cd radare2
sys/install.sh
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
path: ./r2yara
- name: Init r2pm in a local folder
run: |
export R2PM_GITDIR=`pwd`
r2pm -Uci yara
r2pm -i r2yara
- name: Testing r2yara installation
run: R2_DEBUG=1 r2 -qcq -c 'yrv' --
- name: Running Testsuite
run: |
cd r2yara
r2pm -r make -C test
build-macos:
runs-on: macos-12
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: brew install pkg-config
- name: Building Radare2 from git
run: |
brew install automake autoconf
export CFLAGS=-O0
git clone --branch "${R2V}" --depth=1 https://github.com/radareorg/radare2 && cd radare2
./configure
make -j && sudo make install
- name: Installing yara via r2pm
run: r2pm -Ui yara
- name: Building r2yara
run: |
r2pm -r ./configure
r2pm -r make -j
make user-install
# - name: Packaging
# run: make -C dist/macos
# - name: Pub
# uses: actions/upload-artifact@v4
# with:
# if-no-files-found: error
# name: build-macos
# path: dist/macos/r2yara-*.pkg
check_release:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
outputs:
is_release: ${{ steps.release.outputs.is }}
tag_name: ${{ steps.release.outputs.tag }}
needs:
- build-linux20
- build-linux22
- build-macos
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Download all git history and tags
- name: Check if is a release
run: |
TAG="`git describe --exact-match --tags ${{ github.sha }} || true`"
if [ -n "$TAG" ]; then
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "is=yes" >> $GITHUB_OUTPUT
else
echo "is=no" >> $GITHUB_OUTPUT
fi
id: release
release:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.check_release.outputs.is_release == 'yes' }}
needs:
- check_release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Download all git history and tags
- name: Extract r2f version
shell: bash
run: echo "branch=`./configure -qV`" >> $GITHUB_OUTPUT
id: r2fv
- name: Prepare release notes
run: echo Release > ./RELEASE_NOTES.md
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist/artifacts
- name: Create GitHub release
id: create_release
uses: softprops/[email protected]
with:
name: ${{ steps.r2fv.outputs.branch }}
tag_name: ${{ needs.check_release.outputs.tag_name }}
body_path: ./RELEASE_NOTES.md
draft: false
prerelease: false
generate_release_notes: false
files: |
dist/artifacts/build-linux/r2yara_${{ steps.r2fv.outputs.branch }}_amd64.deb
# dist/artifacts/build-macos/r2yara-${{ steps.r2fv.outputs.branch }}-x64.pkg