1
0
mirror of https://github.com/bitdefender/bddisasm.git synced 2024-11-21 15:08:08 +00:00

Merge pull request #103 from ianichitei/master

Run tests on every push and PR
This commit is contained in:
vlutas 2024-09-17 16:06:09 +03:00 committed by GitHub
commit b559081f1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 125 additions and 22 deletions

View File

@ -7,8 +7,6 @@ on:
- '*.md'
- 'docs/**'
- 'isagenerator/**'
- 'bddisasm_test/**'
- 'bdshemu_test/**'
- 'LICENSE'
pull_request:
branches: [ master ]
@ -16,8 +14,6 @@ on:
- '*.md'
- 'docs/**'
- 'isagenerator/**'
- 'bddisasm_test/**'
- 'bdshemu_test/**'
- 'LICENSE'
release:
types: [published]
@ -28,6 +24,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
preset: ["debug-sanitizers", "no-mnemonic", "release"]
permissions:
attestations: write
id-token: write
@ -35,46 +36,52 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build all
- name: Configure CMake
run: cmake --preset ${{ matrix.preset }} -DCMAKE_INSTALL_PREFIX=/usr
- name: Build
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
cd ./build/${{ matrix.preset }}
make -j$(nproc)
cd -
- name: Test bddisasm
if: ${{ matrix.preset != 'no-mnemonic' }}
run: python3 ./tests/main.py --disasm ./build/${{ matrix.preset }}/disasmtool/disasmtool --conf ./bddisasm_test/conf-x86.json
- name: Test bdshemu
if: ${{ matrix.preset != 'no-mnemonic' }}
run: python3 ./tests/main.py --disasm ./build/${{ matrix.preset }}/disasmtool/disasmtool --conf ./bdshemu_test/conf-x86.json
- name: Install
if: ${{ matrix.preset == 'release' }}
run: |
cd build
cd ./build/${{ matrix.preset }}
sudo make install
cd -
- name: Install setuptools
- name: Build pybddisasm
if: ${{ matrix.preset == 'release' }}
run: |
python3 -m pip install --upgrade pip
python3 -m pip install setuptools
- name: Build pybddisasm
run: |
cd bindings/pybddisasm
python3 setup.py build
cd -
- name: Create package
if: ${{ github.event_name == 'release' }}
if: ${{ github.event_name == 'release' && matrix.preset == 'release' }}
run: |
cd build
cd ./build/${{ matrix.preset }}
sudo make package
cd -
- name: Attest Build Provenance
if: ${{ github.event_name == 'release' }}
if: ${{ github.event_name == 'release' && matrix.preset == 'release' }}
uses: actions/attest-build-provenance@v1.1.0
with:
subject-path: |
build/disasmtool/disasmtool
build/*.a
build/*.deb
build/${{ matrix.preset }}/disasmtool/disasmtool
build/${{ matrix.preset }}/*.a
build/${{ matrix.preset }}/*.deb
- name: Release
if: ${{ github.event_name == 'release' }}
if: ${{ github.event_name == 'release' && matrix.preset == 'release' }}
uses: AButler/upload-release-assets@v3.0
with:
files: 'build/*.deb'
files: 'build/${{ matrix.preset }}/*.deb'
repo-token: ${{ secrets.GITHUB_TOKEN }}
Windows-msbuild:
@ -88,6 +95,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Setup Windows SDK
@ -98,6 +106,14 @@ jobs:
run: MSBuild /t:Rebuild /p:Configuration=Release /p:Platform=x64 bddisasm.sln
- name: Build bddisasm and bdshemu for Win32
run: MSBuild /t:Rebuild /p:Configuration=Release /p:Platform=Win32 bddisasm.sln
- name: Test bddisasm Win32
run: python3 tests\main.py --disasm bin\Win32\Release\disasmtool.exe --conf bddisasm_test\conf-x86.json
- name: Test bdshemu Win32
run: python3 tests\main.py --disasm bin\Win32\Release\disasmtool.exe --conf bdshemu_test\conf-x86.json
- name: Test bddisasm x64
run: python3 tests\main.py --disasm bin\x64\Release\disasmtool.exe --conf bddisasm_test\conf-x86.json
- name: Test bdshemu x64
run: python3 tests\main.py --disasm bin\x64\Release\disasmtool.exe --conf bdshemu_test\conf-x86.json
- name: Zip binaries
if: ${{ github.event_name == 'release' }}
run: |
@ -148,13 +164,18 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Build all
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake .. -DCMAKE_BUILD_TYPE=Release -DBDD_ASAN=ON -DBDD_UBSAN=ON
make -j$(nproc)
cd -
- name: Test bddisasm
run: python3 ./tests/main.py --disasm ./build/disasmtool/disasmtool --conf ./bddisasm_test/conf-x86.json
- name: Test bdshemu
run: python3 ./tests/main.py --disasm ./build/disasmtool/disasmtool --conf ./bdshemu_test/conf-x86.json
Code-checks:

82
CMakePresets.json Normal file
View File

@ -0,0 +1,82 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 20,
"patch": 0
},
"configurePresets": [
{
"name": "common-options",
"hidden": true,
"description": "Common options shared by all configurations",
"binaryDir": "${sourceDir}/build/${presetName}"
},
{
"name": "asan",
"inherits": "common-options",
"description": "Enables ASAN",
"cacheVariables": {
"BDD_ASAN": {
"type": "BOOL",
"value": "ON"
}
}
},
{
"name": "ubsan",
"inherits": "common-options",
"description": "Enables UBSAN",
"cacheVariables": {
"BDD_UBSAN": {
"type": "BOOL",
"value": "ON"
}
}
},
{
"name": "debug-sanitizers",
"inherits": ["asan", "ubsan"],
"description": "Debug build with ASAN and UBSAN",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "no-mnemonic",
"inherits": "common-options",
"description": "Excludes mnemonics",
"cacheVariables": {
"BDD_NO_MNEMONIC": {
"type": "BOOL",
"value": "ON"
}
}
},
{
"name": "debug",
"inherits": "common-options",
"description": "Debug build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "release",
"inherits": "common-options",
"description": "Release build with LTO",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BDD_LTO": {
"type": "BOOL",
"value": "ON"
}
}
}
],
"buildPresets": [
],
"testPresets": [
]
}