This repository has been archived by the owner on Feb 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
97 lines (87 loc) · 2.93 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Test Generation Code
on:
pull_request:
push:
branches:
- master
workflow_dispatch:
inputs:
workflow-ghidra-ver:
description: "Specify Ghidra Version to Build"
required: true
type: string
default: "latest"
jobs:
set-versions:
runs-on: ubuntu-20.04
outputs:
ghidra-ver: ${{ env.GHIDRA_VER }}
pyi-ver: ${{ env.PYI_VER }}
pyi-rel-ver: ${{ env.PYI_REL_VER }}
steps:
- name: Get Latest Ghidra Version
id: get_latest_ghidra_ver
uses: pozetroninc/[email protected]
with:
repository: NationalSecurityAgency/ghidra
excludes: prerelease, draft
- name: Set Ghidra Version from Latest
id: format_ghidra_ver
run: |
echo "GHIDRA_VER=$(echo ${{steps.get_latest_ghidra_ver.outputs.release}} | cut -d_ -f2)" >> $GITHUB_ENV
- name: Set Ghidra Version from Input
if: github.event_name == 'workflow_dispatch' && github.event.inputs.workflow-ghidra-ver != 'latest'
run: |
echo "GHIDRA_VER=$(echo ${{github.event.inputs.workflow-ghidra-ver}})" >> $GITHUB_ENV
- name: Checkout repo
uses: actions/checkout@v3
- name: Get Ghidra Stubs Version
id: get_pyi_ver
run: |
echo "PYI_VER=$(python version.py)" >> $GITHUB_ENV
- name: Get Ghidra Stubs Full Release Version
id: get_pyi_rel_ver
run: |
echo "PYI_REL_VER=$GHIDRA_VER.$PYI_VER" >> $GITHUB_ENV
build:
needs:
- set-versions
name: Build and publish Python Package
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up JDK 1.11
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "21"
- uses: er28-0652/setup-ghidra@master
with:
version: "${{ needs.set-versions.outputs.ghidra-ver }}"
- name: Prepare Jython Environment
run: |
"$GHIDRA_INSTALL_DIR/support/analyzeHeadless" /tmp tmp -scriptPath $(pwd) -preScript vendor_packages.py
- name: Build Package
run: |
"$GHIDRA_INSTALL_DIR/support/analyzeHeadless" /tmp tmp -scriptPath $(pwd) -preScript generate_ghidra_pyi.py ./ ${{ needs.set-versions.outputs.pyi-ver }}
test -f setup.py # check manually, because analyzeHeadless doesn't fail on script failure
test -d ghidra-stubs
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install pypa/build
run: >-
python -m
pip install
wheel
--user
- name: Build a binary wheel and a source tarball
run: |
python setup.py bdist_wheel --universal
python setup.py sdist
- name: Upload dist as artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist