Skip to content

Commit

Permalink
Add multiplatform CI (#418)
Browse files Browse the repository at this point in the history
* Add multiplatform CI

* Fix install paths

* Skip tests missing dependencies

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Install optional test dependencies

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
twizmwazin and pre-commit-ci[bot] authored Aug 18, 2023
1 parent e05cbfe commit efb5460
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
jobs:
ci:
uses: angr/ci-settings/.github/workflows/angr-ci.yml@master
windows:
uses: ./.github/workflows/windows.yml
macos:
uses: ./.github/workflows/macos.yml
docs:
runs-on: ubuntu-22.04
steps:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test on macOS

on:
workflow_dispatch:
workflow_call:

jobs:
macos:
name: Test macOS
runs-on: macos-12
steps:
- uses: actions/checkout@v3
with:
path: cle
- uses: actions/checkout@v3
with:
repository: angr/binaries
path: binaries
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- run: python -m venv $HOME/venv
name: Create venv
shell: bash
- run: |
source $HOME/venv/bin/activate
pip install git+https://github.com/angr/archinfo.git
pip install git+https://github.com/angr/pyvex.git
name: Install dependencies
- run: |
source $HOME/venv/bin/activate
pip install ./cle[testing]
name: Install
- run: |
source $HOME/venv/bin/activate
pytest -n auto cle
name: Run pytest
42 changes: 42 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Test on Windows

on:
workflow_dispatch:
workflow_call:

jobs:
windows:
name: Test Windows
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
with:
path: cle
- uses: actions/checkout@v3
with:
repository: angr/binaries
path: binaries
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- run: python -m venv $HOME/venv
name: Create venv
shell: bash
- run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
call %USERPROFILE%\venv\Scripts\activate
pip install git+https://github.com/angr/archinfo.git
pip install git+https://github.com/angr/pyvex.git
name: Install dependencies
shell: cmd
- run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
call %USERPROFILE%\venv\Scripts\activate
pip install ./cle[testing]
name: Install
shell: cmd
- run: |
call %USERPROFILE%\venv\Scripts\activate
pytest -n auto cle
name: Run pytest
shell: cmd
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ pcode =
pypcode>=1.1
testing =
cffi
minidump>=0.0.10
pypcode>=1.1
pytest
pytest-xdist
pyxbe==0.0.4
uefi =
uefi-firmware>=1.10
xbe =
Expand Down
4 changes: 1 addition & 3 deletions tests/test_macho_bindinghelper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
# Contributed September 2019 by Fraunhofer SIT (https://www.sit.fraunhofer.de/en/).
import os
import unittest
Expand Down Expand Up @@ -517,5 +516,4 @@ def test_bind_real_64(self):


if __name__ == "__main__":
# TODO run the testclasses without having to run each test in case the CI needs this
raise NotImplementedError()
unittest.main()
6 changes: 2 additions & 4 deletions tests/test_minidump.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python

import logging
import os
import unittest

import archinfo

Expand All @@ -10,6 +8,7 @@
TEST_BASE = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.path.join("..", "..", "binaries"))


@unittest.skipIf(cle.backends.minidump.minidumpfile is None, "minidump not available")
def test_minidump():
exe = os.path.join(TEST_BASE, "tests", "x86", "windows", "jusched_x86.dmp")
ld = cle.Loader(exe, auto_load_libs=False)
Expand Down Expand Up @@ -44,5 +43,4 @@ def test_minidump():


if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
test_minidump()
4 changes: 2 additions & 2 deletions tests/test_xbe.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env python

import logging
import os
import unittest

import cle

TEST_BASE = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.path.join("..", "..", "binaries"))


@unittest.skipIf(cle.backends.xbe.Xbe is None, "pyxbe not available")
def test_xbe():
xbe = os.path.join(TEST_BASE, "tests", "x86", "xbox", "triangle.xbe")
ld = cle.Loader(xbe, auto_load_libs=False)
Expand Down

0 comments on commit efb5460

Please sign in to comment.