Skip to content

Bump the actions group with 2 updates #93

Bump the actions group with 2 updates

Bump the actions group with 2 updates #93

Workflow file for this run

name: Ghidra Extension
on:
push:
branches:
- main
tags:
- "*"
paths:
- "bindings/python/quokka/**"
- "ghidra_extension/**"
- "proto/**"
- "tests/dataset/sig_test"
- "tests/python/tests/ghidra/**"
- ".gitmodules"
- ".github/workflows/ghidra.yml"
pull_request:
branches: ["**"]
paths:
- "bindings/python/quokka/**"
- "ghidra_extension/**"
- "proto/**"
- "tests/dataset/sig_test"
- "tests/python/tests/ghidra/**"
- ".gitmodules"
- ".github/workflows/ghidra.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
ghidra-build:
name: "Build and test Ghidra extension"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
lfs: true
submodules: false
- name: Checkout Ghidra submodule
run: git submodule update --init third_party/ghidra
- name: Resolve Ghidra version from submodule
id: ghidra-version
run: |
TAG="$(git -C third_party/ghidra describe --tags --exact-match)"
VERSION="$(echo "$TAG" | sed -n 's/^Ghidra_\([0-9]*\.[0-9]*\.[0-9]*\)_build$/\1/p')"
if [[ -z "$VERSION" ]]; then
echo "Error: tag '$TAG' does not match Ghidra_X.Y.Z_build" >&2
exit 1
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0
with:
distribution: temurin
java-version: '21'
- name: Cache Ghidra installation
id: ghidra-cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: /opt/ghidra_${{ steps.ghidra-version.outputs.version }}_PUBLIC
key: ghidra-${{ steps.ghidra-version.outputs.tag }}
- name: Download Ghidra
if: steps.ghidra-cache.outputs.cache-hit != 'true'
run: |
bash scripts/fetch_ghidra.sh --dest /opt
- name: Set Ghidra environment
env:
GHIDRA_VERSION: ${{ steps.ghidra-version.outputs.version }}
run: echo "GHIDRA_INSTALL_DIR=/opt/ghidra_${GHIDRA_VERSION}_PUBLIC" >> "$GITHUB_ENV"
- name: Build, test, and install extension
working-directory: ghidra_extension
run: ./gradlew installExtension
- uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
python-version: "3.12"
enable-cache: false
- name: Create Python test environment
run: |
uv venv --python 3.12
uv pip install '.[test]'
- name: Run Ghidra apply-back integration test
run: .venv/bin/python -m pytest tests/python/tests/ghidra/test_ghidra_apply_back.py
- name: Save Ghidra cache
if: github.event_name == 'push' && steps.ghidra-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: /opt/ghidra_${{ steps.ghidra-version.outputs.version }}_PUBLIC
key: ghidra-${{ steps.ghidra-version.outputs.tag }}
- name: Upload extension artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ghidra-extension
path: ghidra_extension/dist/*.zip
if-no-files-found: error
upload:
name: Upload Ghidra extension for Release
needs: [ghidra-build]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ghidra-extension
- name: Upload to GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.ref_name }}
run: |
shopt -s failglob
gh release upload "$TAG_NAME" ./*.zip