Eric Kilmer e5ba0165ab
Add simple test and corkami test suite using Catch2 (#145)
* Add simple test and corkami test suite using Catch2

* Enable testing with CMake option '-DPEPARSE_ENABLE_TESTING=ON'.

* The simple test is extremely basic just as an example of using Catch2.

* Corkami test suite is a git submodule within assets and the tests can
be run with or without cloning it. You are able to configure CMake
without the submodule and it will warn you that the tests are not
included, and then it will pick them up automatically on next cmake
rebuild.

There are a few Corkami files which pe-parse is unable to process. They
have been added as exceptions for now (just to get this merged), but we
can open new issues to track them. This will also catch any regressions
that could prevent the successful parsing of files that have been
parse-able in the past.

* Raise C++ standard from 11 to 17 for easier filesystem handling in
tests. Also included CMake script for handling how std::filesystem is
found/linked.

* Rename directory 'test' to 'tests'.

* Update README with testing instructions.

* Catch2 is downloaded and built unless otherwise specified
(undocumented, aside from reading CMake).
2021-03-10 14:01:34 -05:00

148 lines
3.5 KiB
YAML

name: CI
on:
push:
branches:
- master
pull_request:
schedule:
# run CI every day even if no PRs/merges occur
- cron: '0 12 * * *'
jobs:
lint:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: deps
run: |
sudo apt-get update
sudo apt-get install -y clang-format-9
- name: lint
run: |
mkdir build && cd build
cmake ..
cmake --build . --target peparse_format
cd .. && git diff --exit-code
pe-parse:
strategy:
matrix:
platform: ["ubuntu-18.04", "macos-latest"]
build-type: ["Debug", "Release"]
build-shared: ["0", "1"]
compiler:
- { CC: "clang", CXX: "clang++" }
- { CC: "gcc", CXX: "g++" }
exclude:
- platform: macos-latest
compiler: { CC: "gcc", CXX: "g++" }
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
with:
submodules: 'true'
- name: build
env:
CC: ${{ matrix.compiler.CC }}
CXX: ${{ matrix.compiler.CXX }}
run: |
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DBUILD_SHARED_LIBS=${{ matrix.build-shared }} \
-DPEPARSE_ENABLE_TESTING=ON \
..
cmake --build .
- name: test
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: |
cd build && ctest -V
./dump-pe/dump-pe ../tests/assets/example.exe
pepy:
strategy:
matrix:
platform: ["ubuntu-18.04", "macos-latest"]
python:
- "3.6"
- "3.7"
- "3.8"
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: build
run: |
python3 setup.py build
- name: sdist and install
run: |
python3 setup.py sdist
python3 -m pip install --user dist/*.tar.gz
- name: test
run: |
python3 tests/test_pepy.py tests/assets/example.exe
pe-parse-windows:
strategy:
matrix:
build-arch: ["x64", "Win32"]
build-type: ["Debug", "Release"]
build-shared: ["0", "1"]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'true'
- name: build
run: |
mkdir build
cd build
cmake `
-G "Visual Studio 16 2019" `
-A ${{ matrix.build-arch }} `
-DBUILD_SHARED_LIBS=${{ matrix.build-shared }} `
-DPEPARSE_ENABLE_TESTING=ON `
..
cmake --build . --config ${{ matrix.build-type }}
- name: install
run: |
cd build
cmake --build . --config ${{ matrix.build-type }} --target install
- name: test
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: |
cd build
ctest -V
.\bin\dump-pe.exe ..\tests\assets\example.exe
pepy-windows:
strategy:
matrix:
python:
- "3.6"
- "3.7"
- "3.8"
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: build
run: |
python setup.py build
- name: install
run: |
python -m pip install --user .
- name: test
run: |
python tests/test_pepy.py tests/assets/example.exe