Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/binja-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Binary Ninja package

on:
push:
branches: ["**"]
paths:
- "mcrit_plugin/binja/**"
- "plugin.json"
Expand Down Expand Up @@ -48,6 +49,8 @@ on:
- "pyproject.toml"
- ".gitattributes"

workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -57,7 +60,8 @@ permissions:

jobs:
package:
name: Binary Ninja plugin package
name: Validate package
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
67 changes: 43 additions & 24 deletions .github/workflows/binja-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ concurrency:

jobs:
verify:
name: Verify release
timeout-minutes: 15
# the release is always cut from the default branch, whichever ref the workflow was started from
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -61,20 +63,7 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
SHA: ${{ steps.commit.outputs.sha }}
BRANCH: ${{ github.event.repository.default_branch }}
run: |
conclusion=$(gh api \
"repos/${REPO}/actions/workflows/pytest.yml/runs?head_sha=${SHA}&status=completed&event=push&branch=${BRANCH}" \
--jq '.workflow_runs[0].conclusion // ""')
if [ -z "${conclusion}" ]; then
echo "::error::No completed CI run for ${SHA}. Wait for main to go green, then re-run."
exit 1
fi
if [ "${conclusion}" != "success" ]; then
echo "::error::CI concluded '${conclusion}' for ${SHA}. Fix main before releasing."
exit 1
fi
echo "CI passed on ${SHA}"
run: python scripts/common/verify_release_ci.py --repo "$REPO" --sha "$SHA" --plugin binja

# extensions.binary.ninja silently skips a version it has already seen, so the version must be
# new: no tag may name it yet, and it must be greater than that of the current latest release.
Expand Down Expand Up @@ -106,10 +95,25 @@ jobs:
echo "previous=${previous}" >> "$GITHUB_OUTPUT"
echo "Releasing ${previous:-nothing} -> ${version}"

- name: Install test tooling
build:
name: Validate
needs: verify
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ needs.verify.outputs.sha }}
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- name: Install release tooling
run: |
python -m pip install --upgrade pip
python -m pip install pytest requests ruff
python -m pip install pytest requests ruff PySide6

- name: Verify metadata sync
run: python scripts/binja/verify_metadata_sync.py --repo .
Expand All @@ -120,17 +124,28 @@ jobs:
- name: Run quality checks
run: python scripts/common/run_quality_checks.py --repo .

- name: Run pure Python tests
- name: Run unit tests
run: python -m pytest tests

release:
needs: verify
name: Publish release
timeout-minutes: 10
needs: [verify, build, offline-dependencies]
if: ${{ !cancelled() && needs.verify.result == 'success' && needs.build.result == 'success' && (inputs.dry-run || needs.offline-dependencies.result == 'success') }}
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
tag: ${{ steps.publish.outputs.tag }}
steps:
- name: Download dependency bundles
if: ${{ !inputs.dry-run }}
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: mcrit-plugin-dependencies-*
path: dist
merge-multiple: true

- name: Refuse to release an unverified commit
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -146,7 +161,7 @@ jobs:

# The release API creates the tag on the verified commit; nothing is pushed to the branch.
# --generate-notes appends its list under the notes, counted from the previous latest release.
- name: Tag and publish the release
- name: Publish release
id: publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -157,7 +172,7 @@ jobs:
DESCRIPTION: ${{ inputs.description }}
DRY_RUN: ${{ inputs.dry-run }}
run: |
flags=(--repo "${REPO}" --target "${SHA}" --title "${VERSION}" --latest --generate-notes)
flags=(--repo "${REPO}" --target "${SHA}" --title "${VERSION}" --generate-notes)
if [ -n "${PREVIOUS}" ]; then
flags+=(--notes-start-tag "${PREVIOUS}")
fi
Expand All @@ -168,18 +183,22 @@ jobs:
} >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
gh release create "${VERSION}" "${flags[@]}" --notes "${DESCRIPTION}"
shopt -s failglob
gh release create "${VERSION}" dist/* --draft "${flags[@]}" --notes "${DESCRIPTION}"
gh release edit "$VERSION" --repo "$REPO" --draft=false --latest
echo "tag=${VERSION}" >> "$GITHUB_OUTPUT"

offline-dependencies:
name: Attach offline dependency bundles
needs: release
name: Build offline dependency bundles
needs: verify
if: ${{ !inputs.dry-run }}
permissions:
contents: write
uses: ./.github/workflows/offline-dependencies.yml
with:
tag: ${{ needs.release.outputs.tag }}
tag: ${{ needs.verify.outputs.version }}
ref: ${{ needs.verify.outputs.sha }}
upload-to-release: false
variants: '[{"name": "binja", "packages": "-r requirements.txt"}]'
# smda 4.9.0, which requirements.txt asks for, needs Python 3.11 or newer
pythons: '["3.11", "3.12", "3.13"]'
Loading
Loading