Skip to content

Commit 58e1adf

Browse files
committed
For master always build against release, dev instead against dev.
1 parent 21a9b20 commit 58e1adf

File tree

3 files changed

+36
-16
lines changed

3 files changed

+36
-16
lines changed

.ci-scripts/ci-build-linux.sh

+19-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
#!/bin/bash
22
set -e
33

4+
CI_BRANCH="$1"
45
CI_BRANCH="$1"
56
CI_JSDEC="$PWD"
6-
CI_RZ_VERSION=$(curl -s GET https://api.github.com/repos/rizinorg/rizin/tags\?per_page\=1 | jq -r '.[].name')
7+
CI_RZ_VERSION=$2
8+
9+
if [ "$2" != "dev" ]; then
10+
# master branch always build against latest release of rizin
11+
CI_RZ_VERSION=$(curl -s GET https://api.github.com/repos/rizinorg/rizin/tags\?per_page\=1 | jq -r '.[].name')
12+
fi
713

814
echo "CI_BRANCH: $CI_BRANCH"
915
echo "CI_RZ_VERSION: $CI_RZ_VERSION"
@@ -12,11 +18,19 @@ echo "CI_JSDEC: $CI_JSDEC"
1218
# avoid placing rizin in the same folder.
1319
cd ..
1420

15-
# download the latest tagged rizin version and install it
16-
wget -O "rizin.tar.xz" "https://github.com/rizinorg/rizin/releases/download/$CI_RZ_VERSION/rizin-src-$CI_RZ_VERSION.tar.xz"
17-
tar xf "rizin.tar.xz"
18-
cd "rizin-$CI_RZ_VERSION"
21+
# download rizin
22+
if [ "$CI_RZ_VERSION" == "dev" ]; then
23+
# dev branch always build against latest commit of rizin
24+
wget -O "rizin.tar.gz" "https://github.com/rizinorg/rizin/archive/refs/heads/dev.tar.gz"
25+
tar xf "rizin.tar.gz"
26+
else
27+
# master branch always build against latest release of rizin
28+
wget -O "rizin.tar.xz" "https://github.com/rizinorg/rizin/releases/download/$CI_RZ_VERSION/rizin-src-$CI_RZ_VERSION.tar.xz"
29+
tar xf "rizin.tar.xz"
30+
fi
1931

32+
# build rizin and install it.
33+
cd "rizin-$CI_RZ_VERSION"
2034
meson setup --buildtype=release -Denable_tests=false build
2135
sudo ninja -C build install
2236

.ci-scripts/ci-rizin-dl.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,25 @@
44
import os
55

66
file_name = sys.argv[1]
7+
latest = "master" if len(sys.argv) < 2 else sys.argv[2]
8+
79
_, file_extension = os.path.splitext(file_name)
810
out_file = f"rizin{file_extension}"
911
print(file_name, out_file)
1012

11-
tags = None
12-
with urllib.request.urlopen('https://api.github.com/repos/rizinorg/rizin/tags?per_page=1') as f:
13-
tags = json.load(f)
14-
latest = tags[0]['name']
15-
16-
url = f"https://github.com/rizinorg/rizin/releases/download/{latest}/{file_name}"
17-
url = url.format(version=latest)
13+
if latest != "dev":
14+
# master branch always build against latest release of rizin
15+
tags = None
16+
with urllib.request.urlopen('https://api.github.com/repos/rizinorg/rizin/tags?per_page=1') as f:
17+
tags = json.load(f)
18+
latest = tags[0]['name']
19+
url = f"https://github.com/rizinorg/rizin/releases/download/{latest}/{file_name}"
20+
url = url.format(version=latest)
21+
else:
22+
# dev branch always build against latest commit of rizin
23+
url = "https://github.com/rizinorg/rizin/archive/refs/heads/dev.zip"
1824

19-
print(f"Latest rizin tag: {latest}")
25+
print(f"Using rizin branch: {latest}")
2026
print(f"{url} as {out_file}")
2127

2228
urllib.request.urlretrieve(url, out_file)

.github/workflows/build-plugin.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install dependencies
2222
run: sudo apt -y install meson ninja-build
2323
- name: Build & run the plugin
24-
run: bash .ci-scripts/ci-build-linux.sh "${{ github.ref_name }}"
24+
run: bash .ci-scripts/ci-build-linux.sh "${{ github.event.pull_request.base.ref || github.ref_name }}"
2525

2626
windows-64:
2727
runs-on: windows-latest
@@ -52,8 +52,8 @@ jobs:
5252
run: |
5353
WORKDIR="$PWD"
5454
cd ..
55-
python "$WORKDIR/.ci-scripts/ci-rizin-dl.py" 'rizin-${{ matrix.release }}-{version}.zip'
56-
unzip rizin.zip
55+
python "$WORKDIR/.ci-scripts/ci-rizin-dl.py" 'rizin-${{ matrix.release }}-{version}.zip' '${{ github.event.pull_request.base.ref || github.ref_name }}'
56+
unzip -q rizin.zip
5757
rm *.zip
5858
mv rizin* rizin
5959
cd "$WORKDIR"

0 commit comments

Comments
 (0)