Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests on every push and PR #103

Merged
merged 13 commits into from
Sep 17, 2024
65 changes: 43 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ on:
- '*.md'
- 'docs/**'
- 'isagenerator/**'
- 'bddisasm_test/**'
- 'bdshemu_test/**'
- 'LICENSE'
pull_request:
branches: [ master ]
paths-ignore:
- '*.md'
- 'docs/**'
- 'isagenerator/**'
- 'bddisasm_test/**'
- 'bdshemu_test/**'
- 'LICENSE'
release:
types: [published]
Expand All @@ -28,53 +24,64 @@ jobs:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
preset: ["debug-sanitizers", "no-mnemonic", "release"]

permissions:
attestations: write
id-token: write
contents: write

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
make -j$(nproc)
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/[email protected]
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/[email protected]
with:
files: 'build/*.deb'
files: 'build/${{ matrix.preset }}/*.deb'
repo-token: ${{ secrets.GITHUB_TOKEN }}

Windows-msbuild:
Expand All @@ -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
Expand All @@ -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: |
Expand Down Expand Up @@ -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:

Expand Down
82 changes: 82 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -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": [
]
}
Loading