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