Squashed 'external/capstone/' content from commit e46f64fa
git-subtree-dir: external/capstone git-subtree-split: e46f64fadb351e9ecd05264fab26f2772feb0994
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
---
|
||||
name: Bug report - Incorrect disassembly
|
||||
about: Create a report about incorrect disassembly.
|
||||
---
|
||||
|
||||
<!-- This template is meant for disassembly related bug reports, please be as descriptive as possible -->
|
||||
|
||||
### Work environment
|
||||
|
||||
<!-- Filling this table is mandatory -->
|
||||
|
||||
| Questions | Answers
|
||||
|------------------------------------------|--------------------
|
||||
| System Capstone runs on OS/arch/bits | Debian arm 64, MacOS AArch64, MacOS x86, Windows x86 etc.
|
||||
| Capstone module affected | ppc, x86, arm, aarch64 etc.
|
||||
| Source of Capstone | `git clone`, brew, pip, release binaries etc.
|
||||
| Version/git commit | v5.0.1, <commit hash>
|
||||
|
||||
<!-- INCORRECT DISASSEMBLY BUGS -->
|
||||
|
||||
### Instruction bytes giving faulty results
|
||||
|
||||
```
|
||||
0x00,0x00,0x00,0x00
|
||||
```
|
||||
|
||||
### Expected results
|
||||
|
||||
It should be:
|
||||
```
|
||||
<this or that>
|
||||
```
|
||||
|
||||
### Steps to get the wrong result
|
||||
|
||||
With `cstool`:
|
||||
|
||||
```sh
|
||||
cstool arm -d 0x00,0x00,0x00,0x00
|
||||
```
|
||||
|
||||
or with `Python`
|
||||
|
||||
```python
|
||||
CODE = b'\x90\x90\x90\x90'
|
||||
|
||||
md = Cs(CS_ARCH_ARM, CS_MODE_THUMB)
|
||||
md.detail = True
|
||||
for insn in md.disasm(CODE, 0x1000):
|
||||
# Print the faulty disassembly
|
||||
```
|
||||
|
||||
<!-- ADDITIONAL CONTEXT -->
|
||||
|
||||
### Additional Logs, screenshots, source code, configuration dump, ...
|
||||
|
||||
Drag and drop zip archives containing the Additional info here, don't use external services or link.
|
||||
Screenshots can be directly dropped here.
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
name: Bug report - Other bugs
|
||||
about: Create a report to help us improve
|
||||
|
||||
---
|
||||
|
||||
<!-- This template is meant for GENERAL bug reports.
|
||||
For bugs regarding incorrect disassembly,
|
||||
please use the "Bug report - Incorrect disassembly" template.
|
||||
|
||||
Please be as descriptive as possible
|
||||
-->
|
||||
|
||||
### Work environment
|
||||
|
||||
<!-- Filling this table is mandatory -->
|
||||
|
||||
| Questions | Answers
|
||||
|------------------------------------------|--------------------
|
||||
| System Capstone runs on OS/arch/bits | Debian arm 64, MacOS AArch64, MacOS x86, Windows x86 etc.
|
||||
| Capstone module affected | ppc, x86, arm, aarch64 etc.
|
||||
| Source of Capstone | `git clone`, brew, pip, release binaries etc.
|
||||
| Version/git commit | v5.0.1, <commit hash>
|
||||
|
||||
<!-- OTHER BUGS -->
|
||||
|
||||
### Expected behavior
|
||||
|
||||
### Actual behavior
|
||||
|
||||
### Steps to reproduce the behavior
|
||||
|
||||
- Use code markdown `CODE` to make your code visible
|
||||
|
||||
<!-- ADDITIONAL CONTEXT -->
|
||||
|
||||
### Additional Logs, screenshots, source code, configuration dump, ...
|
||||
|
||||
Drag and drop zip archives containing the Additional info here, don't use external services or link.
|
||||
Screenshots can be directly dropped here.
|
||||
@@ -0,0 +1,19 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
|
||||
---
|
||||
|
||||
### Feature
|
||||
|
||||
- [ ] New architecture module
|
||||
- [ ] Support for processor extension
|
||||
- [ ] Add more instruction details (elaborated below)
|
||||
- [ ] Binding support for: `language`
|
||||
- [ ] Other (elaborated below)
|
||||
|
||||
**Describe the feature you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the feature request here.
|
||||
@@ -0,0 +1,23 @@
|
||||
<!-- Filling this template is mandatory -->
|
||||
|
||||
**Your checklist for this pull request**
|
||||
- [ ] I've documented or updated the documentation of every API function and struct this PR changes.
|
||||
- [ ] I've added tests that prove my fix is effective or that my feature works (if possible)
|
||||
|
||||
**Detailed description**
|
||||
|
||||
<!-- Explain the **details** for making this change. Is a new feature implemented? What existing problem does the pull request solve? How does the pull request solve these issues? Please provide enough information so that others can review your pull request. -->
|
||||
|
||||
...
|
||||
|
||||
**Test plan**
|
||||
|
||||
<!-- What steps should the reviewer take to test your pull request? Demonstrate the code is solid. Or what test cases you added. Disassembly tests should be added in suite/cs_test/issues.cs -->
|
||||
|
||||
...
|
||||
|
||||
**Closing issues**
|
||||
|
||||
<!-- put "closes #XXXX" in your comment to auto-close the issue that your PR fixes (if any). -->
|
||||
|
||||
...
|
||||
@@ -0,0 +1,204 @@
|
||||
Auto-Sync-files:
|
||||
- suite/auto-sync/**
|
||||
|
||||
LLVM-core-files:
|
||||
- MC*.[ch]
|
||||
|
||||
LLVM-generated-files:
|
||||
- arch/*/*.inc
|
||||
|
||||
Documentation:
|
||||
- '**/*.md'
|
||||
|
||||
CS-core-files:
|
||||
- cs*.[ch]
|
||||
- SStream.[ch]
|
||||
- utis.[ch]
|
||||
- MathExtras.h
|
||||
- Mapping.[ch]
|
||||
- LEB128.h
|
||||
- cstool/cstool.[ch]
|
||||
- cstool/getopt.[ch]
|
||||
- include/capstone/capstone.h
|
||||
- include/capstone/cs_operand.h
|
||||
- include/capstone/platform.h
|
||||
|
||||
ARM:
|
||||
- arch/ARM/**
|
||||
- cstool/cstool_arm.c
|
||||
- include/capstone/arm.h
|
||||
- suite/MC/ARM/**
|
||||
- tests/MC/ARM/**
|
||||
- tests/details/arm.yaml
|
||||
|
||||
AArch64:
|
||||
- arch/AArch64/**
|
||||
- cstool/cstool_aarch64.c
|
||||
- include/capstone/aarch64.h
|
||||
- include/capstone/arm64.h
|
||||
- suite/MC/AArch64/**
|
||||
- tests/MC/AArch64/**
|
||||
- tests/details/aarch64.yaml
|
||||
|
||||
Alpha:
|
||||
- arch/Alpha/**
|
||||
- cstool/cstool_alpha.c
|
||||
- include/capstone/alpha.h
|
||||
- suite/MC/Alpha/**
|
||||
- tests/MC/Alpha/**
|
||||
- tests/details/alpha.yaml
|
||||
|
||||
ARC:
|
||||
- arch/ARC/*
|
||||
- cstool/cstool_arc.c
|
||||
- include/capstone/arc.h
|
||||
- suite/MC/ARC/*
|
||||
- tests/test_arc.c
|
||||
|
||||
BPF:
|
||||
- arch/BPF/**
|
||||
- cstool/cstool_bpf.c
|
||||
- include/capstone/bpf.h
|
||||
- suite/MC/BPF/**
|
||||
- tests/MC/BPF/**
|
||||
- tests/details/bpf.yaml
|
||||
|
||||
EVM:
|
||||
- arch/EVM/**
|
||||
- cstool/cstool_evm.c
|
||||
- include/capstone/evm.h
|
||||
- tests/details/evm.yaml
|
||||
|
||||
HPPA:
|
||||
- arch/HPPA/**
|
||||
- cstool/cstool_hppa.c
|
||||
- include/capstone/hppa.h
|
||||
- suite/MC/HPPA/**
|
||||
- tests/MC/HPPA/**
|
||||
- tests/details/hppa.yaml
|
||||
|
||||
LoongArch:
|
||||
- arch/LoongArch/**
|
||||
- cstool/cstool_loongarch.c
|
||||
- include/capstone/loongarch.h
|
||||
- suite/MC/LoongArch/**
|
||||
- tests/MC/LoongArch/**
|
||||
- tests/details/loongarch.yaml
|
||||
|
||||
M680X:
|
||||
- arch/M680X/**
|
||||
- cstool/cstool_m680x.c
|
||||
- include/capstone/m680x.h
|
||||
- tests/details/m680x.yaml
|
||||
|
||||
M68K:
|
||||
- arch/M68K/**
|
||||
- cstool/cstool_m68k.c
|
||||
- include/capstone/m68k.h
|
||||
- tests/details/m68k.yaml
|
||||
|
||||
MOS65XX:
|
||||
- arch/MOS65XX/**
|
||||
- cstool/cstool_mos65xx.c
|
||||
- include/capstone/mos65xx.h
|
||||
- tests/details/mos65xx.yaml
|
||||
|
||||
Mips:
|
||||
- arch/Mips/**
|
||||
- cstool/cstool_mips.c
|
||||
- include/capstone/mips.h
|
||||
- suite/MC/Mips/**
|
||||
- tests/MC/Mips/**
|
||||
- tests/details/mips.yaml
|
||||
|
||||
PowerPC:
|
||||
- arch/PowerPC/**
|
||||
- cstool/cstool_powerpc.c
|
||||
- include/capstone/ppc.h
|
||||
- suite/MC/PowerPC/**
|
||||
- tests/MC/PowerPC/**
|
||||
- tests/details/ppc.yaml
|
||||
|
||||
RISCV:
|
||||
- arch/RISCV/**
|
||||
- cstool/cstool_riscv.c
|
||||
- include/capstone/riscv.h
|
||||
- suite/MC/RISCV/**
|
||||
- tests/MC/RISCV/**
|
||||
- tests/details/riscv.yaml
|
||||
|
||||
SH:
|
||||
- arch/SH/**
|
||||
- cstool/cstool_sh.c
|
||||
- include/capstone/sh.h
|
||||
- tests/details/sh.yaml
|
||||
|
||||
Sparc:
|
||||
- arch/Sparc/**
|
||||
- cstool/cstool_sparc.c
|
||||
- include/capstone/sparc.h
|
||||
- suite/MC/Sparc/**
|
||||
- tests/MC/Sparc/**
|
||||
- tests/details/sparc.yaml
|
||||
|
||||
SystemZ:
|
||||
- arch/SystemZ/**
|
||||
- cstool/cstool_systemz.c
|
||||
- include/capstone/systemz.h
|
||||
- include/capstone/systemz_compatibility.h
|
||||
- suite/MC/SystemZ/**
|
||||
- tests/MC/SystemZ/**
|
||||
- tests/details/systemz.yaml
|
||||
|
||||
TMS320C64x:
|
||||
- arch/TMS320C6x/**
|
||||
- cstool/cstool_tms320c64x.c
|
||||
- include/capstone/tms320x64x.h
|
||||
- tests/details/tms320c64x.yaml
|
||||
|
||||
TriCore:
|
||||
- arch/TriCore/**
|
||||
- cstool/cstool_tricore.c
|
||||
- include/capstone/tricore.h
|
||||
- suite/MC/Tricore/**
|
||||
- tests/MC/Tricore/**
|
||||
- tests/details/tricore.yaml
|
||||
|
||||
WASM:
|
||||
- arch/WASM/**
|
||||
- cstool/cstool_wasm.c
|
||||
- include/capstone/wasm.h
|
||||
- tests/details/wasm.yaml
|
||||
|
||||
X86:
|
||||
- arch/X86/**
|
||||
- cstool/cstool_x86.c
|
||||
- include/capstone/x86.h
|
||||
- suite/MC/X86/**
|
||||
- tests/MC/X86/**
|
||||
- tests/details/x86.yaml
|
||||
|
||||
XCore:
|
||||
- arch/XCore/**
|
||||
- cstool/cstool_xcore.c
|
||||
- include/capstone/xcore.h
|
||||
- tests/details/xcore.yaml
|
||||
|
||||
Xtensa:
|
||||
- arch/Xtensa/**
|
||||
- cstool/cstool_xtensa.c
|
||||
- include/capstone/xtensa.h
|
||||
- tests/MC/Xtensa/**
|
||||
- tests/details/xtensa.yaml
|
||||
|
||||
python:
|
||||
- bindings/python/**
|
||||
|
||||
ocaml:
|
||||
- bindings/ocaml/**
|
||||
|
||||
java:
|
||||
- bindings/java/**
|
||||
|
||||
Github-files:
|
||||
- .github/**
|
||||
@@ -0,0 +1,251 @@
|
||||
name: Run Test
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- ".gitignore"
|
||||
- "docs/**"
|
||||
- "ChangeLog"
|
||||
- "CREDITS.TXT"
|
||||
- "COMPILE_MAKE.TXT"
|
||||
- "BUILDING.md"
|
||||
- "CONTRIBUTING.md"
|
||||
- "LICENSE.TXT"
|
||||
- "LICENSE_LLVM.TXT"
|
||||
- "README.md"
|
||||
- "RELEASE_NOTES"
|
||||
- "SPONSORS.TXT"
|
||||
- "TODO"
|
||||
pull_request:
|
||||
|
||||
# Stop previous runs on the same branch on new push
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
CI: true
|
||||
UBSAN_OPTIONS: "halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1"
|
||||
ASAN_OPTIONS: "halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1"
|
||||
LSAN_OPTIONS: "halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1"
|
||||
|
||||
jobs:
|
||||
Linux:
|
||||
runs-on: ${{ matrix.config.os }}
|
||||
name: ${{ matrix.config.name }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- {
|
||||
name: 'ubuntu-22.04 x64 make',
|
||||
os: ubuntu-22.04,
|
||||
arch: x64,
|
||||
build-system: 'make',
|
||||
diet-build: 'OFF',
|
||||
enable-asan: 'OFF'
|
||||
}
|
||||
- {
|
||||
name: 'ubuntu-22.04 x64 cmake',
|
||||
os: ubuntu-22.04,
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
enable-asan: 'OFF',
|
||||
build_type: 'Debug'
|
||||
}
|
||||
- {
|
||||
name: 'ubuntu-22.04 x64 debug - assert warn',
|
||||
os: ubuntu-22.04,
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
enable-asan: 'OFF',
|
||||
build_type: 'Debug',
|
||||
build_options: '-DCAPSTONE_ASSERTION_WARNINGS=ON'
|
||||
}
|
||||
- {
|
||||
name: 'ubuntu-22.04 x64 release - no assert warnings',
|
||||
os: ubuntu-22.04,
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
enable-asan: 'OFF',
|
||||
build_type: 'Release',
|
||||
build_options: '-DCAPSTONE_ASSERTION_WARNINGS=OFF'
|
||||
}
|
||||
- {
|
||||
name: 'ubuntu-22.04 x64 release - assert warn',
|
||||
os: ubuntu-22.04,
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
enable-asan: 'OFF',
|
||||
build_type: 'Release',
|
||||
build_options: '-DCAPSTONE_ASSERTION_WARNINGS=ON'
|
||||
}
|
||||
- {
|
||||
name: 'ubuntu-24.04 x64 ASAN',
|
||||
os: ubuntu-24.04,
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
enable-asan: 'ON',
|
||||
build_type: 'Debug'
|
||||
}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.config.python-version }}
|
||||
|
||||
- name: Prepare fuzzing
|
||||
run: |
|
||||
export LD_LIBRARY_PATH=`pwd`/tests/:$LD_LIBRARY_PATH
|
||||
wget https://github.com/groundx/capstonefuzz/raw/master/corpus/corpus-libFuzzer-capstone_fuzz_disasmnext-latest.zip
|
||||
unzip -q corpus-libFuzzer-capstone_fuzz_disasmnext-latest.zip -d suite/fuzz
|
||||
|
||||
- name: make
|
||||
if: startsWith(matrix.config.build-system, 'make')
|
||||
run: |
|
||||
./make.sh
|
||||
sudo make install
|
||||
|
||||
- name: cmake
|
||||
if: startsWith(matrix.config.build-system, 'cmake')
|
||||
env:
|
||||
asan: ${{ matrix.config.enable-asan }}
|
||||
build_option: ${{ matrix.config.build_option }}
|
||||
build_type: ${{ matrix.config.build_type }}
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
# build static library
|
||||
cmake -DCMAKE_BUILD_TYPE=${build_type} -DCAPSTONE_INSTALL=1 -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_ASAN=${asan} -DCAPSTONE_BUILD_DIET=${diet_build} ${build_option} ..
|
||||
cmake --build . --config ${build_type}
|
||||
# build shared library
|
||||
cmake -DCMAKE_BUILD_TYPE=${build_type} -DCAPSTONE_INSTALL=1 -DCAPSTONE_BUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX=/usr -DCAPSTONE_BUILD_CSTEST=ON -DENABLE_ASAN=${asan} ${build_option} ..
|
||||
sudo cmake --build . --config ${build_type} --target install
|
||||
|
||||
- name: Lower number of KASL randomized address bits
|
||||
run: |
|
||||
# Work-around ASAN bug https://github.com/google/sanitizers/issues/1716
|
||||
sudo sysctl vm.mmap_rnd_bits=28
|
||||
|
||||
- name: unit tests
|
||||
if: startsWith(matrix.config.build-system, 'cmake')
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R unit_*
|
||||
|
||||
- name: "Integration tests"
|
||||
if: startsWith(matrix.config.build-system, 'cmake') && matrix.config.diet-build == 'OFF'
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R integration_*
|
||||
|
||||
- name: cstool - reaches disassembler engine
|
||||
run: |
|
||||
sh suite/run_invalid_cstool.sh
|
||||
|
||||
- name: cstest negatives
|
||||
if: startsWith(matrix.config.build-system, 'cmake')
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R NegativeTests1
|
||||
ctest --test-dir build --output-on-failure -R NegativeTests2
|
||||
ctest --test-dir build --output-on-failure -R NegativeTests3
|
||||
ctest --test-dir build --output-on-failure -R NegativeTests4
|
||||
ctest --test-dir build --output-on-failure -R NegativeTests5
|
||||
ctest --test-dir build --output-on-failure -R NegativeTests6
|
||||
|
||||
- name: cstest MC
|
||||
if: startsWith(matrix.config.build-system, 'cmake')
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R MCTests
|
||||
|
||||
- name: cstest details
|
||||
if: startsWith(matrix.config.build-system, 'cmake')
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R DetailTests
|
||||
|
||||
- name: cstest issues
|
||||
if: startsWith(matrix.config.build-system, 'cmake')
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R IssueTests
|
||||
|
||||
- name: cstest features
|
||||
if: startsWith(matrix.config.build-system, 'cmake')
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R FeaturesTests
|
||||
|
||||
- name: Legacy integration tests
|
||||
if: startsWith(matrix.config.build-system, 'cmake')
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R legacy*
|
||||
|
||||
- name: Valgrind cstest
|
||||
if: startsWith(matrix.config.build-system, 'cmake') && startsWith(matrix.config.enable-asan, 'OFF')
|
||||
run: |
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install valgrind
|
||||
valgrind --leak-check=full cstest tests/details
|
||||
valgrind --leak-check=full cstest tests/features
|
||||
valgrind --leak-check=full cstest tests/issues
|
||||
valgrind --leak-check=full cstest tests/MC
|
||||
|
||||
- name: Compatibility header generation
|
||||
# clang-format-20 is only available in Ubuntu 24.04
|
||||
# Hence the check only happens for it.
|
||||
if: startsWith(matrix.config.build-system, 'cmake') && startsWith(matrix.config.os, 'ubuntu-24.04')
|
||||
run: |
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install clang-format-20
|
||||
clang-format-20 --version
|
||||
cp ./include/capstone/arm64.h arm64_compat_current.h
|
||||
cp ./include/capstone/systemz_compatibility.h systemz_compat_current.h
|
||||
./suite/auto-sync/src/autosync/HeaderPatcher.py -C ./.clang-format -c --v6 ./include/capstone/aarch64.h --v5 ./include/capstone/arm64.h
|
||||
./suite/auto-sync/src/autosync/HeaderPatcher.py -C ./.clang-format -c --v6 ./include/capstone/systemz.h --v5 ./include/capstone/systemz_compatibility.h
|
||||
diff ./include/capstone/arm64.h arm64_compat_current.h &&
|
||||
diff ./include/capstone/systemz_compatibility.h systemz_compat_current.h
|
||||
|
||||
Windows:
|
||||
runs-on: ${{ matrix.config.os }}
|
||||
name: ${{ matrix.config.name }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- name: 'windows x64 MSVC 64bit'
|
||||
os: windows-latest
|
||||
arch: x64
|
||||
platform: windows
|
||||
python-arch: x64
|
||||
python-version: '3.9'
|
||||
diet_build: false
|
||||
- name: 'windows x64 MSVC 64bit DIET'
|
||||
os: windows-latest
|
||||
arch: x64
|
||||
platform: windows
|
||||
python-arch: x64
|
||||
python-version: '3.9'
|
||||
diet_build: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: lukka/get-cmake@latest
|
||||
name: Get CMake
|
||||
|
||||
- name: '🛠️ Win MSVC 64 setup'
|
||||
if: contains(matrix.config.name, 'MSVC 64')
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: 'x64'
|
||||
|
||||
- name: '🚧 Win MSVC 64 build'
|
||||
if: contains(matrix.config.name, 'MSVC 64')
|
||||
shell: bash
|
||||
run: |
|
||||
cmake --version
|
||||
cmake --preset=${{ matrix.config.platform }}-x64${{ matrix.config.diet_build == true && '-diet' || '' }}
|
||||
cmake --build --preset build-${{ matrix.config.platform }}${{ matrix.config.diet_build == true && '-diet' || '' }}-release
|
||||
cmake --build --preset install-${{ matrix.config.platform }}${{ matrix.config.diet_build == true && '-diet' || '' }}-release
|
||||
@@ -0,0 +1,202 @@
|
||||
name: Cross Build Tests
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- ".gitignore"
|
||||
- "docs/**"
|
||||
- "ChangeLog"
|
||||
- "CREDITS.TXT"
|
||||
- "COMPILE_MAKE.TXT"
|
||||
- "BUILDING.md"
|
||||
- "CONTRIBUTING.md"
|
||||
- "LICENSE.TXT"
|
||||
- "LICENSE_LLVM.TXT"
|
||||
- "README.md"
|
||||
- "RELEASE_NOTES"
|
||||
- "SPONSORS.TXT"
|
||||
- "TODO"
|
||||
pull_request:
|
||||
|
||||
# Stop previous runs on the same branch on new push
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
CI: true
|
||||
UBSAN_OPTIONS: "halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1"
|
||||
ASAN_OPTIONS: "halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1"
|
||||
LSAN_OPTIONS: "halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1"
|
||||
|
||||
jobs:
|
||||
Linux:
|
||||
runs-on: ${{ matrix.config.os }}
|
||||
name: ${{ matrix.config.name }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- {
|
||||
name: 'QEMU Linux s390x',
|
||||
os: ubuntu-24.04,
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
build_type: 'Debug',
|
||||
diet_build: false,
|
||||
packages: 'gcc-s390x-linux-gnu g++-s390x-linux-gnu binutils-s390x-linux-gnu libc6-dev-s390x-cross qemu-user-static',
|
||||
cross_file: 'cross_configs/linux_s390x_ubuntu24.cmake',
|
||||
}
|
||||
- {
|
||||
name: 'QEMU Linux Mips 32',
|
||||
os: ubuntu-24.04,
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
build_type: 'Debug',
|
||||
diet_build: false,
|
||||
packages: 'gcc-mips-linux-gnu g++-mips-linux-gnu binutils-mips-linux-gnu libc6-dev-mips-cross qemu-user-static',
|
||||
cross_file: 'cross_configs/linux_mips_ubuntu24.cmake',
|
||||
}
|
||||
- {
|
||||
name: 'QEMU Linux Mips64el',
|
||||
os: ubuntu-24.04,
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
build_type: 'Debug',
|
||||
diet_build: false,
|
||||
packages: 'gcc-mips64el-linux-gnuabi64 g++-mips64el-linux-gnuabi64 binutils-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross qemu-user-static',
|
||||
cross_file: 'cross_configs/linux_mips64_ubuntu24.cmake',
|
||||
}
|
||||
- {
|
||||
name: 'QEMU Linux PPC64',
|
||||
os: ubuntu-24.04,
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
build_type: 'Debug',
|
||||
diet_build: false,
|
||||
packages: 'gcc-powerpc64-linux-gnu g++-powerpc64-linux-gnu binutils-powerpc64-linux-gnu libc6-dev-ppc64-cross qemu-user-static',
|
||||
cross_file: 'cross_configs/linux_ppc64_ubuntu24.cmake',
|
||||
}
|
||||
- {
|
||||
name: 'QEMU Linux ARM',
|
||||
os: ubuntu-24.04,
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
build_type: 'Debug',
|
||||
diet_build: false,
|
||||
packages: 'gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross qemu-user-static',
|
||||
cross_file: 'cross_configs/linux_arm_ubuntu24.cmake',
|
||||
}
|
||||
- {
|
||||
name: '[BUILD ONLY] Windows i686 mingw',
|
||||
os: ubuntu-24.04,
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
build_type: 'Debug',
|
||||
diet_build: false,
|
||||
skip_tests: true,
|
||||
packages: 'gcc-mingw-w64-i686 g++-mingw-w64-i686 mingw-w64-tools',
|
||||
cross_file: 'cross_configs/windows_i686_ubuntu24.cmake',
|
||||
}
|
||||
- {
|
||||
name: '[BUILD ONLY] Android 35 (arm64_v8a) NDK 29',
|
||||
os: ubuntu-24.04,
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
build_option: '-DANDROID_NDK=ndk/ -DANDROID_PLATFORM=android-35 -DANDROID_ABI=arm64-v8a',
|
||||
diet-build: 'OFF',
|
||||
build_type: 'Debug',
|
||||
diet_build: false,
|
||||
# QEMU alone can't emulate the binaries, because the NDK doesn't
|
||||
# provide dynamic linker.
|
||||
skip_tests: true,
|
||||
packages: 'qemu-user-static',
|
||||
ndk_version: 'r29',
|
||||
cross_file: 'ndk/build/cmake/android.toolchain.cmake',
|
||||
qemu: 'qemu-aarch64-static'
|
||||
}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.config.python-version }}
|
||||
|
||||
- name: Install cross build dependencies
|
||||
if: ${{ matrix.config.packages != '' }}
|
||||
env:
|
||||
packages: ${{ matrix.config.packages }}
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ${packages}
|
||||
|
||||
- name: Setup Android NDK
|
||||
if: contains(matrix.config.name, 'Android')
|
||||
env:
|
||||
ndk_version: ${{ matrix.config.ndk_version }}
|
||||
qemu: ${{ matrix.config.qemu }}
|
||||
cross_file: ${{ matrix.config.cross_file }}
|
||||
run: |
|
||||
wget -q https://dl.google.com/android/repository/android-ndk-${ndk_version}-linux.zip
|
||||
mkdir ndk
|
||||
unzip -q -d ndk android-ndk-${ndk_version}-linux.zip
|
||||
mv ndk/*/* ndk/
|
||||
cat ndk/source.properties
|
||||
|
||||
- name: cmake (cross build)
|
||||
env:
|
||||
build_option: ${{ matrix.config.build_option }}
|
||||
build_type: ${{ matrix.config.build_type }}
|
||||
cross_file: ${{ matrix.config.cross_file }}
|
||||
run: |
|
||||
cmake -DCMAKE_BUILD_TYPE=${build_type} \
|
||||
-DCAPSTONE_BUILD_STATIC_LIBS=ON \
|
||||
-S . \
|
||||
-DCAPSTONE_BUILD_CSTEST=ON \
|
||||
-DCAPSTONE_BUILD_DIET=${diet_build} \
|
||||
-DCMAKE_TOOLCHAIN_FILE=${cross_file} \
|
||||
${build_option} \
|
||||
-B build .
|
||||
cmake --build build --config ${build_type}
|
||||
|
||||
- name: unit tests
|
||||
if: ${{ matrix.config.skip_tests != true }}
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R unit_*
|
||||
|
||||
- name: "Integration tests"
|
||||
if: ${{ matrix.config.skip_tests != true }}
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R integration_c_*
|
||||
|
||||
- name: cstest MC
|
||||
if: ${{ matrix.config.skip_tests != true }}
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R MCTests
|
||||
|
||||
- name: cstest details
|
||||
if: ${{ matrix.config.skip_tests != true }}
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R DetailTests
|
||||
|
||||
- name: cstest issues
|
||||
if: ${{ matrix.config.skip_tests != true }}
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R IssueTests
|
||||
|
||||
- name: cstest features
|
||||
if: ${{ matrix.config.skip_tests != true }}
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R FeaturesTests
|
||||
|
||||
- name: Legacy integration tests
|
||||
if: ${{ matrix.config.skip_tests != true }}
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R legacy*
|
||||
@@ -0,0 +1,104 @@
|
||||
name: Auto-Sync
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "suite/auto-sync/**"
|
||||
- ".github/workflows/auto-sync.yml"
|
||||
pull_request:
|
||||
|
||||
# Stop previous runs on the same branch on new push
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-24.04
|
||||
defaults:
|
||||
run:
|
||||
working-directory: suite/auto-sync/
|
||||
steps:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Install auto-sync package
|
||||
run: |
|
||||
pip install .
|
||||
|
||||
- name: Check formatting
|
||||
run: |
|
||||
python3.11 -m black --check src/autosync
|
||||
|
||||
- name: Install llvm-mc
|
||||
run: |
|
||||
sudo apt install llvm-18
|
||||
llvm-mc-18 --version
|
||||
FileCheck-18 --version
|
||||
sudo ln -s $(whereis -b llvm-mc-18 | grep -Eo "/.*") /usr/local/bin/llvm-mc
|
||||
sudo ln -s $(whereis -b FileCheck-18 | grep -Eo "/.*") /usr/local/bin/FileCheck
|
||||
llvm-mc --version
|
||||
FileCheck --version
|
||||
|
||||
- name: Clone llvm-capstone
|
||||
run: |
|
||||
git clone https://github.com/capstone-engine/llvm-capstone.git vendor/llvm_root
|
||||
|
||||
- name: Build llvm-tblgen
|
||||
run: |
|
||||
cd vendor/llvm_root
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=ARC ../llvm
|
||||
cmake --build . --target llvm-tblgen --config Debug
|
||||
cd ../../../
|
||||
|
||||
- name: Test Header patcher
|
||||
run: |
|
||||
python -m unittest src/autosync/Tests/test_header_patcher.py
|
||||
python -m unittest src/autosync/Tests/test_mcupdater.py
|
||||
|
||||
- name: Remove llvm-mc
|
||||
run: |
|
||||
sudo apt remove llvm-18
|
||||
sudo rm /usr/local/bin/llvm-mc
|
||||
sudo rm /usr/local/bin/FileCheck
|
||||
|
||||
- name: Test generation of inc files
|
||||
run: |
|
||||
./src/autosync/ASUpdater.py -d -a AArch64 -s IncGen
|
||||
./src/autosync/ASUpdater.py -d -a Alpha -s IncGen
|
||||
./src/autosync/ASUpdater.py -d -a ARC -s IncGen
|
||||
./src/autosync/ASUpdater.py -d -a ARM -s IncGen
|
||||
./src/autosync/ASUpdater.py -d -a PPC -s IncGen
|
||||
./src/autosync/ASUpdater.py -d -a LoongArch -s IncGen
|
||||
./src/autosync/ASUpdater.py -d -a Mips -s IncGen
|
||||
./src/autosync/ASUpdater.py -d -a SystemZ -s IncGen
|
||||
./src/autosync/ASUpdater.py -d -a Xtensa -s IncGen
|
||||
./src/autosync/ASUpdater.py -d -a TriCore -s IncGen
|
||||
|
||||
- name: CppTranslator - Patch tests
|
||||
run: |
|
||||
python -m unittest src/autosync/cpptranslator/Tests/test_patches.py
|
||||
|
||||
- name: CppTranslator - Differ tests
|
||||
run: |
|
||||
python -m unittest src/autosync/cpptranslator/Tests/test_differ.py
|
||||
|
||||
- name: CppTranslator - Test translation
|
||||
run: |
|
||||
./src/autosync/ASUpdater.py --ci -d -a AArch64 -s Translate
|
||||
./src/autosync/ASUpdater.py --ci -d -a ARC -s Translate
|
||||
./src/autosync/ASUpdater.py --ci -d -a ARM -s Translate
|
||||
./src/autosync/ASUpdater.py --ci -d -a PPC -s Translate
|
||||
./src/autosync/ASUpdater.py --ci -d -a LoongArch -s Translate
|
||||
./src/autosync/ASUpdater.py --ci -d -a Mips -s Translate
|
||||
./src/autosync/ASUpdater.py --ci -d -a SystemZ -s Translate
|
||||
./src/autosync/ASUpdater.py --ci -d -a Xtensa -s Translate
|
||||
./src/autosync/ASUpdater.py --ci -d -a TriCore -s Translate
|
||||
@@ -0,0 +1,175 @@
|
||||
# SPDX-FileCopyrightText: 2024 Antelox <anteloxrce@gmail.com>
|
||||
# SPDX-License-Identifier: BSD-3
|
||||
|
||||
name: Python - Build and publish wheels with cibuildwheel
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
debugMode:
|
||||
description: 'Debug Mode'
|
||||
required: false
|
||||
default: ''
|
||||
type: choice
|
||||
options:
|
||||
- '0'
|
||||
- '1'
|
||||
|
||||
push:
|
||||
paths-ignore:
|
||||
- ".gitignore"
|
||||
- "CREDITS.TXT"
|
||||
- "ChangeLog"
|
||||
- "README.md"
|
||||
- "docs/**"
|
||||
pull_request:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
# Automatically cancel any previous running workflow on new push
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
# Enable DEBUG flag either according to the tag release or manual override
|
||||
CAPSTONE_DEBUG: ${{ inputs.debugMode != '' && inputs.debugMode || startsWith(github.ref, 'refs/tags') && '0' || '1' }}
|
||||
|
||||
jobs:
|
||||
build_and_test_wheels:
|
||||
name: Building on ${{ matrix.os }} - ${{ matrix.arch }} - ${{ matrix.cibw_build }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# NOTE: Making this to parallelize and speed up workflow
|
||||
# i686 - manylinux
|
||||
- { os: ubuntu-latest, arch: i686, cibw_build: 'cp*-manylinux*', cibw_skip: '' }
|
||||
# i686 - musllinux
|
||||
- { os: ubuntu-latest, arch: i686, cibw_build: 'cp*-musllinux*', cibw_skip: '' }
|
||||
# x86_64 - manylinux
|
||||
- { os: ubuntu-latest, arch: x86_64, cibw_build: 'cp*-manylinux*', cibw_skip: '' }
|
||||
# x86_64 - musllinux
|
||||
- { os: ubuntu-latest, arch: x86_64, cibw_build: 'cp*-musllinux*', cibw_skip: '' }
|
||||
# aarch64 - manylinux
|
||||
- { os: ubuntu-24.04-arm, arch: aarch64, cibw_build: 'cp*-manylinux*', cibw_skip: '' }
|
||||
# aarch64 - musllinux
|
||||
- { os: ubuntu-24.04-arm, arch: aarch64, cibw_build: 'cp*-musllinux*', cibw_skip: '' }
|
||||
# macos - x86_64
|
||||
- { os: macos-15-intel, arch: x86_64, cibw_build: 'cp*', cibw_skip: '' }
|
||||
# macos - arm64
|
||||
- { os: macos-latest, arch: arm64, cibw_build: 'cp*', cibw_skip: '' }
|
||||
# windows - amd64
|
||||
- { os: windows-latest, arch: AMD64, cibw_build: 'cp*', cibw_skip: '' }
|
||||
# windows - x86
|
||||
- { os: windows-latest, arch: x86, cibw_build: 'cp*', cibw_skip: '' }
|
||||
# windows - arm64
|
||||
- { os: windows-11-arm, arch: ARM64, cibw_build: 'cp*', cibw_skip: '*38* *39* *310*' }
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# https://github.com/actions/upload-artifact/issues/22
|
||||
- name: Prepare a unique name for Artifacts
|
||||
shell: bash
|
||||
run: |
|
||||
# replace not-allowed chars with dash
|
||||
name="cibw-wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.cibw_build }}"
|
||||
name=$(echo -n "$name" | sed -e 's/[ \t:\/\\"<>|*?]/-/g' -e 's/--*/-/g' | sed -e 's/\-$//')
|
||||
echo "ARTIFACT_NAME=$name" >> $GITHUB_ENV
|
||||
|
||||
# https://cibuildwheel.pypa.io/en/stable/faq/#macos-building-cpython-38-wheels-on-arm64
|
||||
- uses: actions/setup-python@v5
|
||||
if: runner.os == 'macOS' && runner.arch == 'ARM64'
|
||||
with:
|
||||
python-version: 3.8
|
||||
|
||||
- name: '🛠️ Win MSVC 32 dev cmd setup'
|
||||
if: runner.os == 'Windows' && matrix.arch == 'x86'
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x86
|
||||
|
||||
- name: '🛠️ Win MSVC 64 dev cmd setup'
|
||||
if: runner.os == 'Windows' && matrix.arch == 'AMD64'
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x64
|
||||
|
||||
- name: '🛠️ Win MSVC ARM64 dev cmd setup'
|
||||
if: runner.os == 'Windows' && matrix.arch == 'ARM64'
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: amd64_arm64
|
||||
|
||||
- name: '🛠️ Set up QEMU'
|
||||
if: runner.os == 'Linux' && matrix.arch == 'i686'
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: '🚧 cibuildwheel run'
|
||||
uses: pypa/cibuildwheel@v3.1.3
|
||||
env:
|
||||
CIBW_BUILD_FRONTEND: build
|
||||
CIBW_BUILD: ${{ matrix.cibw_build }}
|
||||
CIBW_SKIP: ${{ matrix.cibw_skip }}
|
||||
CIBW_ARCHS: ${{ matrix.arch }}
|
||||
CIBW_ENVIRONMENT: DEBUG=${{ env.CAPSTONE_DEBUG }}
|
||||
CIBW_ENVIRONMENT_PASS_LINUX: DEBUG
|
||||
# https://github.com/pypa/cibuildwheel/pull/1169
|
||||
CIBW_TEST_SKIP: "cp38-macosx_*:arm64"
|
||||
CIBW_TEST_COMMAND: >
|
||||
python -m pip install {package}/cstest_py &&
|
||||
python {project}/suite/run_tests.py
|
||||
with:
|
||||
package-dir: bindings/python
|
||||
output-dir: wheelhouse
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.ARTIFACT_NAME }}
|
||||
path: ./wheelhouse/*.whl
|
||||
|
||||
make_sdist:
|
||||
name: Make SDist
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
|
||||
- name: Build SDist
|
||||
run: |
|
||||
python3 -m pip install -U pip build
|
||||
python3 -m build --sdist bindings/python
|
||||
python3 -m pip install bindings/python/dist/*.tar.gz
|
||||
python3 -c 'import capstone; print(f"Capstone version installed from sdist: {capstone.__version__}")'
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: sdist-archive
|
||||
path: bindings/python/dist/*.tar.gz
|
||||
|
||||
publish:
|
||||
needs: [ build_and_test_wheels, make_sdist ]
|
||||
environment: pypi
|
||||
permissions:
|
||||
id-token: write
|
||||
runs-on: ubuntu-latest
|
||||
if: startsWith(github.ref, 'refs/tags') && github.event_name == 'release'
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
merge-multiple: true
|
||||
path: dist
|
||||
|
||||
- name: Show downloaded artifacts
|
||||
run: ls -laR dist
|
||||
|
||||
- name: '📦 Publish distribution to PyPI'
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
if: ${{ success() }}
|
||||
with:
|
||||
user: __token__
|
||||
password: ${{ secrets.pypi_pass }}
|
||||
@@ -0,0 +1,151 @@
|
||||
name: Packages Build
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- ".gitignore"
|
||||
- "docs/**"
|
||||
- "ChangeLog"
|
||||
- "CREDITS.TXT"
|
||||
- "COMPILE_MAKE.TXT"
|
||||
- "BUILDING.md"
|
||||
- "CONTRIBUTING.md"
|
||||
- "LICENSE.TXT"
|
||||
- "LICENSE_LLVM.TXT"
|
||||
- "README.md"
|
||||
- "RELEASE_NOTES"
|
||||
- "SPONSORS.TXT"
|
||||
- "TODO"
|
||||
pull_request:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build_linux
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Create archive
|
||||
id: archive
|
||||
run: |
|
||||
VERSION=${{ github.event.release.tag_name }}
|
||||
PKGNAME="capstone-$VERSION"
|
||||
SHASUM=$PKGNAME.tar.xz.sha256
|
||||
mkdir -p /tmp/$PKGNAME
|
||||
rsync -a --exclude=build --exclude='.*' ./ /tmp/$PKGNAME/
|
||||
TARBALL=$PKGNAME.tar.xz
|
||||
tar -C /tmp -cJf $TARBALL $PKGNAME
|
||||
sha256sum $TARBALL > $SHASUM
|
||||
echo "tarball=$TARBALL" >> $GITHUB_OUTPUT
|
||||
echo "shasum=$SHASUM" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.archive.outputs.tarball }}
|
||||
path: ${{ steps.archive.outputs.tarball }}
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.archive.outputs.shasum }}
|
||||
path: ${{ steps.archive.outputs.shasum }}
|
||||
|
||||
- name: Upload tarball and shasum to release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags') && github.event_name == 'release'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.event.release.tag_name }}
|
||||
files: |
|
||||
${{ steps.archive.outputs.tarball }}
|
||||
${{ steps.archive.outputs.shasum }}
|
||||
|
||||
- name: Configure CMake and build the project
|
||||
run: |
|
||||
cmake -B build \
|
||||
-DPROJECT_VERSION=${{ github.event.release.tag_name }} \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCAPSTONE_BUILD_SHARED_LIBS=1 \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr
|
||||
cmake --build build
|
||||
|
||||
- name: Package DEB and RPM package
|
||||
run: |
|
||||
cd build
|
||||
cpack -G DEB
|
||||
cpack -G RPM
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: capstone_x86.deb
|
||||
path: ./build/*.deb
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: capstone_x86.rpm
|
||||
path: ./build/*.rpm
|
||||
|
||||
- name: Upload debian package to release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags') && github.event_name == 'release'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.event.release.tag_name }}
|
||||
files: |
|
||||
./build/*.deb
|
||||
./build/*.rpm
|
||||
|
||||
build_windows:
|
||||
name: build_windows
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Win MSVC 64 dev cmd setup
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x64
|
||||
|
||||
- name: Configure CMake and build the project
|
||||
run: |
|
||||
cmake -B build `
|
||||
-T "ClangCL,host=x64" `
|
||||
-A x64 `
|
||||
-DPROJECT_VERSION="${{ github.event.release.tag_name }}" `
|
||||
-DCMAKE_BUILD_TYPE=Release `
|
||||
-DCAPSTONE_BUILD_SHARED_LIBS=1
|
||||
cmake --build build --config Release
|
||||
cmake --install build --config Release
|
||||
|
||||
# Install NSIS according to https://github.com/NSIS-Dev/ci-examples/blob/main/.github/workflows/windows-latest.yml
|
||||
- name: Package NSIS installer
|
||||
run: |
|
||||
iwr -useb get.scoop.sh -outfile 'install.ps1'
|
||||
.\install.ps1 -RunAsAdmin
|
||||
scoop update
|
||||
scoop bucket add extras
|
||||
scoop install nsis --global
|
||||
cd build
|
||||
cpack -G NSIS
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: capstone_x64.exe
|
||||
path: ./build/*.exe
|
||||
|
||||
- name: Upload NSIS installer to release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags') && github.event_name == 'release'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.event.release.tag_name }}
|
||||
files: |
|
||||
./build/*.exe
|
||||
@@ -0,0 +1,33 @@
|
||||
name: Run clang-format-20
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
# Ignore
|
||||
- '!suite/auto-sync/**'
|
||||
pull_request:
|
||||
|
||||
# Stop previous runs on the same branch on new push
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
name: clang-format-20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install clang-format-20
|
||||
run: |
|
||||
sudo apt update -y
|
||||
sudo apt install -y clang-format-20
|
||||
clang-format-20 --version
|
||||
|
||||
- name: Check formatting
|
||||
run: |
|
||||
./suite/run_clang_format.sh
|
||||
@@ -0,0 +1,48 @@
|
||||
name: Run clang-tidy
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
pull_request:
|
||||
|
||||
# Stop previous runs on the same branch on new push
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
name: clang-tidy
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install clang-tidy
|
||||
run: |
|
||||
sudo apt install clang-tidy
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
CC=clang cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCAPSTONE_BUILD_SHARED_LIBS=1 ..
|
||||
CC=clang sudo cmake --build . --config Release
|
||||
cd ..
|
||||
|
||||
- name: Install clang-tidy-18
|
||||
run: |
|
||||
sudo apt install clang-tidy-18
|
||||
|
||||
- name: Check for warnings
|
||||
env:
|
||||
base_sha: ${{ github.event.pull_request.base.sha }}
|
||||
head_sha: ${{ github.event.pull_request.head.sha }}
|
||||
run: |
|
||||
./suite/run_clang_tidy.sh build
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
path: ct-warnings.txt
|
||||
@@ -0,0 +1,60 @@
|
||||
name: Coverity Scan
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 0 * * 1' # On every Monday at midnight UTC
|
||||
|
||||
|
||||
# Automatically cancel any previous workflow on new push.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
latest:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Determine current repository
|
||||
id: "determine-repo"
|
||||
run: echo "repo=${GITHUB_REPOSITORY}" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- name: Download Coverity Build Tool
|
||||
run: |
|
||||
wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=capstone-next" -O cov-analysis-linux64.tar.gz
|
||||
mkdir cov-analysis-linux64
|
||||
tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64
|
||||
env:
|
||||
TOKEN: ${{ secrets.COVERITY_TOKEN }}
|
||||
|
||||
- name: Installing build dependencies
|
||||
run: |
|
||||
sudo apt-get --assume-yes install cmake
|
||||
|
||||
- name: Setup
|
||||
run: |
|
||||
cmake . -B build -DCAPSTONE_BUILD_CSTEST=ON
|
||||
|
||||
- name: Build with cov-build
|
||||
run: |
|
||||
export PATH=`pwd`/cov-analysis-linux64/bin:$PATH
|
||||
cov-build --dir cov-int cmake --build build
|
||||
tar czvf capstone.tgz cov-int
|
||||
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: capstone.tgz
|
||||
|
||||
- name: Submit the result to Coverity Scan
|
||||
run: |
|
||||
curl \
|
||||
--form token=$TOKEN \
|
||||
--form email=capstone.engine@gmail.com \
|
||||
--form file=@capstone.tgz \
|
||||
--form version=trunk \
|
||||
--form description="capstone" \
|
||||
https://scan.coverity.com/builds?project=capstone-next
|
||||
env:
|
||||
TOKEN: ${{ secrets.COVERITY_TOKEN }}
|
||||
if: steps.determine-repo.outputs.repo == 'capstone-engine/capstone'
|
||||
@@ -0,0 +1,12 @@
|
||||
version: 2
|
||||
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
||||
- package-ecosystem: pip
|
||||
directory: "/suite/auto-sync"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
@@ -0,0 +1,23 @@
|
||||
name: CIFuzz
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
Fuzzing:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build Fuzzers
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'capstone'
|
||||
dry-run: false
|
||||
- name: Run Fuzzers
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'capstone'
|
||||
fuzz-seconds: 600
|
||||
dry-run: false
|
||||
- name: Upload Crash
|
||||
uses: actions/upload-artifact@v4
|
||||
if: failure()
|
||||
with:
|
||||
name: artifacts
|
||||
path: ./out/artifacts
|
||||
@@ -0,0 +1,20 @@
|
||||
name: "Pull Request Labeler"
|
||||
on:
|
||||
- pull_request_target
|
||||
|
||||
# Automatically cancel any previous workflow on new push.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
triage:
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/labeler@v4
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
Reference in New Issue
Block a user