Skip to content

Add initial CI jobs

Add initial CI jobs #5

Workflow file for this run

# TODO: add windows and run the testsuite
name: ci
env:
R2V: 5.8.8
on:
push:
branches:
- master
pull_request:
jobs:
build-linux20:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Installing radare2
run: |
wget https://github.com/radareorg/radare2/releases/download/5.8.8/radare2_5.8.8_amd64.deb
wget https://github.com/radareorg/radare2/releases/download/5.8.8/radare2-dev_5.8.8_amd64.deb
sudo dpkg -i radare2_5.8.8_amd64.deb
sudo dpkg -i radare2-dev_5.8.8_amd64.deb
- name: Installing yara via r2pm
run: r2pm -Ui yara
- name: Building r2yara
run: |
r2pm -r export
find ${R2PM_PREFIX}
r2pm -r ./configure
r2pm -r make -j
make user-install
- name: Packaging
run: make -C dist/debian
- name: Pub
uses: actions/upload-artifact@v3
with:
name: build-linux
path: dist/debian/*.deb
build-linux22:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Installing radare2
run: |
wget https://github.com/radareorg/radare2/releases/download/5.8.8/radare2_5.8.8_amd64.deb
wget https://github.com/radareorg/radare2/releases/download/5.8.8/radare2-dev_5.8.8_amd64.deb
sudo dpkg -i radare2_5.8.8_amd64.deb
sudo dpkg -i radare2-dev_5.8.8_amd64.deb
- name: Installing yara via r2pm
run: r2pm -Ui r2yara
- name: Building r2yara
run: |
r2pm -r ./configure
r2pm -r make -j
make user-install
build-macos:
runs-on: macos-11
# runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: brew install pkg-config
- name: Building Radare2
run: ( git clone --depth=1 https://github.com/radareorg/radare2 && cd radare2 && export CFLAGS=-O0 && ./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@v3
# 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/master' }}
outputs:
is_release: ${{ steps.release.outputs.is }}
tag_name: ${{ steps.release.outputs.tag }}
needs:
- build-linux20
- build-macos
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Download all git history and tags
- name: Check if is a release
run: git describe --exact-match --tags ${{ github.sha }} | awk 'BEGIN{tag="-";r="no"}/^[0-9]+\.[0-9]+/{tag=$0;r="yes"};END{print "::set-output name=is::"r;print "::set-output name=tag::"tag}'
id: release
release:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && needs.check_release.outputs.is_release == 'yes' }}
needs:
- check_release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Download all git history and tags
- name: Extract r2f version
run: echo "##[set-output name=branch;]$( ./configure -qV )"
id: r2fv
- name: Prepare release notes
run: echo Release > ./RELEASE_NOTES.md
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: dist/artifacts
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.check_release.outputs.tag_name }}
release_name: ${{ steps.r2fv.outputs.branch }}
body_path: ./RELEASE_NOTES.md
draft: false
prerelease: false
- name: Upload asset for Linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/artifacts/build-linux/r2yara_${{ steps.r2fv.outputs.branch }}_amd64.deb
asset_name: r2yara_${{ steps.r2fv.outputs.branch }}_amd64.deb
asset_content_type: application/vnd.debian.binary-package
- name: Upload precompiled agent script
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/artifacts/build-agent/_agent.js
asset_name: _agent.js
asset_content_type: application/javascript
- name: Upload asset for macOS
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/artifacts/build-macos/r2yara-${{ steps.r2fv.outputs.branch }}-x64.pkg
asset_name: r2yara-${{ steps.r2fv.outputs.branch }}-x64.pkg
asset_content_type: application/octet-stream
- name: Upload asset for Windows (w64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/artifacts/build-windows/r2yara-${{env.R2V}}-w64.zip
asset_name: r2yara-${{ steps.r2fv.outputs.branch }}-w64.zip
asset_content_type: application/zip