Ci #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO: add windows | |
name: ci | |
env: | |
R2V: 5.9.0 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build-linux: | |
runs-on: ubuntu-22.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: Setting up the Python virtual environment | |
run: | | |
python -m venv venv | |
. venv/bin/activate | |
pip install pylint | |
- name: Linting | |
run: | | |
. venv/bin/activate | |
make cilint | |
- name: Install Python dependencies | |
run: | | |
. venv/bin/activate | |
pip install -r requirements.txt | |
- name: Running r2ai from the shell | |
run: | | |
. venv/bin/activate | |
python main.py -h | |
- name: Running r2ai from r2 | |
run: | | |
. venv/bin/activate | |
r2 -q -i main.py -c r2ai /bin/ls | |
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-linux | |
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 |